Merge pull request #1 from Ellpeck/master

Merge current changes to fork.
This commit is contained in:
Paktosan 2015-03-20 11:25:31 +01:00
commit 8a840c7a10
50 changed files with 867 additions and 176 deletions

View file

@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-0.0.1.3"
version = "1.7.10-0.0.1.4"
group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"

View file

@ -10,6 +10,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.ConfigurationHandler;
import ellpeck.actuallyadditions.crafting.GrinderCrafting;
import ellpeck.actuallyadditions.crafting.InitCrafting;
import ellpeck.actuallyadditions.event.InitEvents;
import ellpeck.actuallyadditions.gen.OreGen;
@ -67,6 +68,7 @@ public class ActuallyAdditions{
public void postInit(FMLPostInitializationEvent event){
Util.logInfo("Starting PostInitialization Phase...");
GrinderCrafting.init();
proxy.postInit();
Util.logInfo("PostInitialization Finished.");

View file

@ -0,0 +1,171 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.creative.CreativeTab;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import ellpeck.actuallyadditions.util.IName;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockInputter extends BlockContainerBase implements IName{
public static final int NAME_FLAVOUR_AMOUNTS = 12;
private long lastSysTime;
private int toPick;
public BlockInputter(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
this.setCreativeTab(CreativeTab.instance);
}
@Override
public void onBlockAdded(World world, int x, int y, int z){
super.onBlockAdded(world, x, y, z);
if (!world.isRemote){
Block block1 = world.getBlock(x, y, z-1);
Block block2 = world.getBlock(x, y, z+1);
Block block3 = world.getBlock(x-1, y, z);
Block block4 = world.getBlock(x+1, y, z);
int metaToSet = 1;
if (block1.func_149730_j() && !block2.func_149730_j()) metaToSet = 0;
if (block2.func_149730_j() && !block1.func_149730_j()) metaToSet = 1;
if (block3.func_149730_j() && !block4.func_149730_j()) metaToSet = 2;
if (block4.func_149730_j() && !block3.func_149730_j()) metaToSet = 3;
world.setBlockMetadataWithNotify(x, y, z, metaToSet, 2);
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if (rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if (rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
if (rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
@Override
public String getUnlocalizedName(){
String norm = "tile." + Util.MOD_ID_LOWER + "." + this.getName();
Random rand = new Random();
long sysTime = System.currentTimeMillis();
if(this.lastSysTime+5000 < sysTime){
this.lastSysTime = sysTime;
this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS+1);
}
return norm + "." + this.toPick;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityInputter();
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z){
return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0;
}
@Override
public IIcon getIcon(int side, int meta){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityInputter furnace = (TileEntityInputter)world.getTileEntity(x, y, z);
if (furnace != null) player.openGui(ActuallyAdditions.instance, GuiHandler.INPUTTER_ID, world, x, y, z);
return true;
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public String getName(){
return "blockInputter";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocalFormatted("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + 1, Util.OBFUSCATED, Util.LIGHT_GRAY));
for(int i = 1; i < 5; i++){
list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1)));
}
}
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -26,6 +26,8 @@ public class BlockMisc extends Block implements IName{
public BlockMisc(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
}
@SuppressWarnings("all")

View file

@ -1,5 +1,7 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.util.IName;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
@ -13,6 +15,7 @@ public class InitBlocks{
public static Block blockGrinder;
public static Block blockGrinderDouble;
public static Block blockFurnaceDouble;
public static Block blockInputter;
public static void init(){
Util.logInfo("Initializing Blocks...");
@ -37,5 +40,8 @@ public class InitBlocks{
blockFurnaceDouble = new BlockFurnaceDouble();
Util.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class);
blockInputter = new BlockInputter();
GameRegistry.registerBlock(blockInputter, BlockInputter.TheItemBlock.class, ((IName)blockInputter).getName());
}
}

View file

@ -74,7 +74,6 @@ public class ConfigValues{
blackQuartzMinHeight = config.getInt("Black Quartz Min Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate");
blackQuartzMaxHeight = config.getInt("Black Quartz Max Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at");
//TODO CHANGE TO BE TRUE BY DEFAULT
enableExperienceDrop = config.getBoolean("Solidified Experience", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Solidified Experience drops from Mobs");
enableBloodDrop = config.getBoolean("Blood Fragments", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Blood Fragments drop from Mobs");
enableHeartDrop = config.getBoolean("Heart Parts", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Heart Parts drop from Mobs");

View file

@ -15,6 +15,7 @@ import java.util.ArrayList;
public class GrinderCrafting{
public static void init(){
Util.logInfo("Initializing Grinder Recipes...");
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10);
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0);
@ -26,24 +27,43 @@ public class GrinderCrafting{
public static void registerFinally(){
String[] names = OreDictionary.getOreNames();
for(String name : names){
if(name.contains("ore")){
String nameOfOre = name.substring(3);
ArrayList<ItemStack> allDusts;
if(nameOfOre.contains("Nether")) allDusts = OreDictionary.getOres("dust" + nameOfOre.substring(6));
else allDusts = OreDictionary.getOres("dust" + nameOfOre);
int resultAmount = 1;
String nameOfOre = null;
if(name.length() > 3 && name.substring(0, 3).equals("ore")){
nameOfOre = name.substring(3);
resultAmount = 2;
}
if(name.length() > 9 && name.substring(0, 9).equals("oreNether")){
nameOfOre = name.substring(9);
resultAmount = 2;
}
if(name.length() > 8 && name.substring(0, 8).equals("denseore")){
nameOfOre = name.substring(8);
resultAmount = 6;
}
if(name.length() > 3 && name.substring(0, 3).equals("gem")) nameOfOre = name.substring(3);
if(name.length() > 5 && name.substring(0, 5).equals("ingot")) nameOfOre = name.substring(5);
if(nameOfOre != null){
ArrayList<ItemStack> allDusts;
String nameToGetFrom = "dust" + nameOfOre;
allDusts = OreDictionary.getOres(nameToGetFrom);
if(allDusts != null && allDusts.size() > 0){
ArrayList<ItemStack> allOresOfName = OreDictionary.getOres(name);
if(allOresOfName != null && allOresOfName.size() > 0){
for(ItemStack output : allDusts){
output.stackSize = 2;
output.stackSize = resultAmount;
for(ItemStack input : allOresOfName){
if(GrinderRecipes.instance().getOutput(input, false) == null){
//Special Second Outputs
if(name.equals("oreNickel"))
GrinderRecipes.instance().registerRecipe(input, output, OreDictionary.getOres("dustPlatinum").get(0), 10);
if(name.equals("oreNickel")){
ArrayList<ItemStack> specialStacks = OreDictionary.getOres("dustPlatinum");
for(ItemStack theSpecial : specialStacks) GrinderRecipes.instance().registerRecipe(input, output, theSpecial, 10);
}
else GrinderRecipes.instance().registerRecipe(input, output, null, 0);
}
@ -52,9 +72,8 @@ public class GrinderCrafting{
}
else Util.AA_LOGGER.log(Level.ERROR, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + name + "'! This shouldn't happen as there is something registered as '" + name + "' that doesn't exist!");
}
else Util.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry 'dust" + nameOfOre + "' doesn't exist! It should correspond to '" + name + "'! This is not an Error, just a bit sad :(");
else if(!name.equals("ingotBrick") && !name.equals("ingotBrickNether")) Util.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + nameToGetFrom + "' doesn't exist! It should correspond to '" + name + "'! This is not an Error, just a bit sad :(");
}
}
}
}

View file

@ -12,7 +12,6 @@ public class InitCrafting {
MiscCrafting.init();
FoodCrafting.init();
ToolCrafting.init();
GrinderCrafting.init();
}

View file

@ -30,9 +30,10 @@ public class MiscCrafting{
//Knife Blade
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_BLADE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(Items.iron_ingot),
new ItemStack(Items.flint));
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
"KF",
'K', new ItemStack(Items.iron_ingot),
'F', new ItemStack(Items.flint));
}

View file

@ -26,6 +26,7 @@ public class CreativeTab extends CreativeTabs{
public void displayAllReleventItems(List list){
this.list = list;
this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockGrinder);
this.addBlock(InitBlocks.blockGrinderDouble);
this.addBlock(InitBlocks.blockFurnaceDouble);
@ -58,7 +59,7 @@ public class CreativeTab extends CreativeTabs{
@Override
public Item getTabIconItem(){
return Item.getItemFromBlock(InitBlocks.blockGrinderDouble);
return Item.getItemFromBlock(InitBlocks.blockInputter);
}
@Override

View file

@ -15,7 +15,7 @@ public class ContainerGiantChest extends Container{
public ContainerGiantChest(InventoryPlayer inventory, TileEntityBase tile){
this.tileChest = (TileEntityGiantChest)tile;
for (int i = 0; i < 13; i++){
for (int i = 0; i < 9; i++){
for (int j = 0; j < 13; j++){
this.addSlotToContainer(new Slot(this.tileChest, j + (i*13), 5 + j * 18, 5 + i * 18));
}
@ -23,11 +23,11 @@ public class ContainerGiantChest extends Container{
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 33 + 8 + j * 18, 244 + 4 + i * 18));
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 33 + 8 + j * 18, 172 + 4 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 33 + 8 + i * 18, 244 + 62));
this.addSlotToContainer(new Slot(inventory, i, 33 + 8 + i * 18, 172 + 62));
}
}

View file

@ -0,0 +1,92 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerInputter extends Container{
private TileEntityInputter tileInputter;
private int lastSideToPut;
private int lastSlotToPut;
private int lastSideToPull;
private int lastSlotToPull;
private int lastPlaceToPutSlotAmount;
private int lastPlaceToPullSlotAmount;
public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile){
this.tileInputter = (TileEntityInputter)tile;
this.addSlotToContainer(new Slot(this.tileInputter, 0, 80, 21));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.tileInputter.sideToPut);
iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.slotToPut);
iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.sideToPull);
iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull);
iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount);
iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount);
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastSideToPut != this.tileInputter.sideToPut) iCraft.sendProgressBarUpdate(this, 0, this.tileInputter.sideToPut);
if(this.lastSlotToPut != this.tileInputter.slotToPut) iCraft.sendProgressBarUpdate(this, 1, this.tileInputter.slotToPut);
if(this.lastSideToPull != this.tileInputter.sideToPull) iCraft.sendProgressBarUpdate(this, 2, this.tileInputter.sideToPull);
if(this.lastSlotToPull != this.tileInputter.slotToPull) iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull);
if(this.lastPlaceToPullSlotAmount != this.tileInputter.placeToPullSlotAmount) iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount);
if(this.lastPlaceToPutSlotAmount != this.tileInputter.placeToPutSlotAmount) iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount);
}
this.lastSideToPut = this.tileInputter.sideToPut;
this.lastSlotToPut = this.tileInputter.slotToPut;
this.lastSideToPull = this.tileInputter.sideToPull;
this.lastSlotToPull = this.tileInputter.slotToPull;
this.lastPlaceToPullSlotAmount = this.tileInputter.placeToPullSlotAmount;
this.lastPlaceToPutSlotAmount = this.tileInputter.placeToPutSlotAmount;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.tileInputter.sideToPut = par2;
if(par1 == 1) this.tileInputter.slotToPut = par2;
if(par1 == 2) this.tileInputter.sideToPull = par2;
if(par1 == 3) this.tileInputter.slotToPull = par2;
if(par1 == 4) this.tileInputter.placeToPullSlotAmount = par2;
if(par1 == 5) this.tileInputter.placeToPutSlotAmount = par2;
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.tileInputter.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
return null;
}
}

View file

@ -58,7 +58,7 @@ public class GuiFeeder extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.animals.desc")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.enoughToBreed.desc") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.tooMany.desc") : StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.notEnough.desc")))};
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.tooMany") : StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.notEnough")))};
this.func_146283_a(Arrays.asList(array), x, y);
}
}

View file

@ -18,15 +18,15 @@ public class GuiGiantChest extends GuiContainer{
super(new ContainerGiantChest(inventory, tile));
this.xSize = 242;
this.ySize = 244+86;
this.ySize = 172+86;
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 244);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 190);
this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+244, 0, 0, 176, 86);
this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+172, 0, 0, 176, 86);
}
}

View file

@ -31,6 +31,9 @@ public class GuiHandler implements IGuiHandler{
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace);
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputter);
default:
return null;
}
@ -56,6 +59,9 @@ public class GuiHandler implements IGuiHandler{
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace);
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world);
default:
return null;
}
@ -67,6 +73,7 @@ public class GuiHandler implements IGuiHandler{
public static final int GRINDER_ID = 3;
public static final int GRINDER_DOUBLE_ID = 4;
public static final int FURNACE_DOUBLE_ID = 5;
public static final int INPUTTER_ID = 6;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -0,0 +1,150 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.network.PacketInputterButton;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiInputter extends GuiContainer{
private static final ResourceLocation resLoc = Util.getGuiLocation("guiInputter");
private TileEntityInputter tileInputter;
private int x;
private int y;
private int z;
private World world;
private SmallerButton buttonSlotPutP;
private SmallerButton buttonSlotPullP;
private SmallerButton buttonSlotPutM;
private SmallerButton buttonSlotPullM;
public static final String[] sideString = new String[]{
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.disabled"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.up"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.down"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.north"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.east"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.south"),
StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.west")};
public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerInputter(inventory, tile));
this.tileInputter = (TileEntityInputter)tile;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.xSize = 176;
this.ySize = 93+86;
}
@SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43, ">");
SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43, "<");
buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64, "+");
buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64, "-");
SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43, ">");
SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43, "<");
buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64, "+");
buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64, "-");
this.buttonList.add(buttonSidePutP);
this.buttonList.add(buttonSlotPutP);
this.buttonList.add(buttonSidePullP);
this.buttonList.add(buttonSlotPullP);
this.buttonList.add(buttonSidePutM);
this.buttonList.add(buttonSlotPutM);
this.buttonList.add(buttonSidePullM);
this.buttonList.add(buttonSlotPullM);
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32, 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 3, guiTop + 45 + 1, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24, guiTop + 66 + 1, 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 3, guiTop + 45 + 1, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109, guiTop + 66 + 1, 4210752);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
this.buttonSlotPullP.enabled = this.tileInputter.placeToPullSlotAmount > 0;
this.buttonSlotPullM.enabled = this.tileInputter.placeToPullSlotAmount > 0;
this.buttonSlotPutP.enabled = this.tileInputter.placeToPutSlotAmount > 0;
this.buttonSlotPutM.enabled = this.tileInputter.placeToPutSlotAmount > 0;
}
@Override
public void actionPerformed(GuiButton button){
PacketHandler.theNetwork.sendToServer(new PacketInputterButton(x, y, z, world, button.id));
}
public class SmallerButton extends GuiButton{
private final ResourceLocation resLoc = Util.getGuiLocation("guiInputter");
public SmallerButton(int id, int x, int y, String display){
super(id, x, y, 16, 16, display);
}
@Override
public void drawButton(Minecraft mc, int x, int y){
if (this.visible){
FontRenderer renderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(resLoc);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 176, k*16, 16, 16);
this.mouseDragged(mc, x, y);
int color = 14737632;
if (packedFGColour != 0) color = packedFGColour;
else if (!this.enabled) color = 10526880;
else if (this.field_146123_n) color = 16777120;
this.drawCenteredString(renderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height-3) / 2, color);
}
}
}
}

View file

@ -3,8 +3,11 @@ package ellpeck.actuallyadditions.items;
import ellpeck.actuallyadditions.items.tools.*;
import ellpeck.actuallyadditions.material.InitItemMaterials;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class InitItems{
@ -52,18 +55,18 @@ public class InitItems{
itemSpecialDrop = new ItemSpecialDrop();
Util.register(itemSpecialDrop);
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, "itemPickaxeEmerald", EnumRarity.rare);
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, "itemAxeEmerald", EnumRarity.rare);
itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, "itemShovelEmerald", EnumRarity.rare);
itemSwordEmerald = new ItemSwordAA(InitItemMaterials.toolMaterialEmerald, "itemSwordEmerald", EnumRarity.rare);
itemHoeEmerald = new ItemHoeAA(InitItemMaterials.toolMaterialEmerald, "itemHoeEmerald", EnumRarity.rare);
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare);
itemSwordEmerald = new ItemSwordAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemSwordEmerald", EnumRarity.rare);
itemHoeEmerald = new ItemHoeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemHoeEmerald", EnumRarity.rare);
Util.registerItems(new Item[]{itemPickaxeEmerald, itemAxeEmerald, itemShovelEmerald, itemSwordEmerald, itemHoeEmerald});
itemPickaxeObsidian = new ItemPickaxeAA(InitItemMaterials.toolMaterialObsidian, "itemPickaxeObsidian", EnumRarity.uncommon);
itemAxeObsidian = new ItemAxeAA(InitItemMaterials.toolMaterialObsidian, "itemAxeObsidian", EnumRarity.uncommon);
itemShovelObsidian = new ItemShovelAA(InitItemMaterials.toolMaterialObsidian, "itemShovelObsidian", EnumRarity.uncommon);
itemSwordObsidian = new ItemSwordAA(InitItemMaterials.toolMaterialObsidian, "itemSwordObsidian", EnumRarity.uncommon);
itemHoeObsidian = new ItemHoeAA(InitItemMaterials.toolMaterialObsidian, "itemHoeObsidian", EnumRarity.uncommon);
itemPickaxeObsidian = new ItemPickaxeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemPickaxeObsidian", EnumRarity.uncommon);
itemAxeObsidian = new ItemAxeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemAxeObsidian", EnumRarity.uncommon);
itemShovelObsidian = new ItemShovelAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemShovelObsidian", EnumRarity.uncommon);
itemSwordObsidian = new ItemSwordAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemSwordObsidian", EnumRarity.uncommon);
itemHoeObsidian = new ItemHoeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemHoeObsidian", EnumRarity.uncommon);
Util.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian});
}

View file

@ -30,6 +30,11 @@ public class ItemKnife extends Item implements IName{
return theStack;
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;

View file

@ -18,11 +18,13 @@ public class ItemAxeAA extends ItemAxe implements IName{
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
public ItemAxeAA(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
public ItemAxeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.rarity = rarity;
this.repairItem = repairItem;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
}
@ -36,6 +38,11 @@ public class ItemAxeAA extends ItemAxe implements IName{
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;

View file

@ -18,11 +18,13 @@ public class ItemHoeAA extends ItemHoe implements IName{
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
public ItemHoeAA(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
public ItemHoeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.rarity = rarity;
this.repairItem = repairItem;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
}
@ -36,6 +38,11 @@ public class ItemHoeAA extends ItemHoe implements IName{
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;

View file

@ -18,11 +18,13 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
public ItemPickaxeAA(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
public ItemPickaxeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.rarity = rarity;
this.repairItem = repairItem;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
}
@ -36,6 +38,11 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;

View file

@ -18,11 +18,13 @@ public class ItemShovelAA extends ItemSpade implements IName{
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
public ItemShovelAA(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
public ItemShovelAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.rarity = rarity;
this.repairItem = repairItem;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
}
@ -36,6 +38,11 @@ public class ItemShovelAA extends ItemSpade implements IName{
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;

View file

@ -18,11 +18,13 @@ public class ItemSwordAA extends ItemSword implements IName{
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
public ItemSwordAA(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
public ItemSwordAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.rarity = rarity;
this.repairItem = repairItem;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
}
@ -36,6 +38,11 @@ public class ItemSwordAA extends ItemSword implements IName{
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;

View file

@ -13,6 +13,6 @@ public class PacketHandler{
theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(Util.MOD_ID + "Channel");
theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT);
theNetwork.registerMessage(PacketInputterButton.Handler.class, PacketInputterButton.class, 1, Side.SERVER);
}
}

View file

@ -0,0 +1,66 @@
package ellpeck.actuallyadditions.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
public class PacketInputterButton implements IMessage{
private int tileX;
private int tileY;
private int tileZ;
private int worldID;
private int buttonID;
@SuppressWarnings("unused")
public PacketInputterButton(){
}
public PacketInputterButton(int x, int y, int z, World world, int buttonID){
this.tileX = x;
this.tileY = y;
this.tileZ = z;
this.worldID = world.provider.dimensionId;
this.buttonID = buttonID;
}
@Override
public void fromBytes(ByteBuf buf){
this.tileX = buf.readInt();
this.tileY = buf.readInt();
this.tileZ = buf.readInt();
this.worldID = buf.readInt();
this.buttonID = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf){
buf.writeInt(this.tileX);
buf.writeInt(this.tileY);
buf.writeInt(this.tileZ);
buf.writeInt(this.worldID);
buf.writeInt(this.buttonID);
}
public static class Handler implements IMessageHandler<PacketInputterButton, IMessage>{
@Override
public IMessage onMessage(PacketInputterButton message, MessageContext ctx){
World world = DimensionManager.getWorld(message.worldID);
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
if(tile instanceof TileEntityInputter){
TileEntityInputter inputter = (TileEntityInputter)tile;
inputter.onButtonPressed(message.buttonID);
}
return null;
}
}
}

View file

@ -4,6 +4,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.GuiFeeder;
import ellpeck.actuallyadditions.tile.TileEntityFeeder;
import io.netty.buffer.ByteBuf;
@ -50,6 +52,7 @@ public class PacketTileEntityFeeder implements IMessage{
public static class Handler implements IMessageHandler<PacketTileEntityFeeder, IMessage>{
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(PacketTileEntityFeeder message, MessageContext ctx){
World world = FMLClientHandler.instance().getClient().theWorld;
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);

View file

@ -33,7 +33,7 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityGiantChest.class, Util.MOD_ID_LOWER + ":tileEntityGiantChest");
GameRegistry.registerTileEntity(TileEntityGrinder.class, Util.MOD_ID_LOWER + ":tileEntityGrinder");
GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, Util.MOD_ID_LOWER + ":tileEntityFurnaceDouble");
GameRegistry.registerTileEntity(TileEntityPackager.class, Util.MOD_ID_LOWER + ":tileEntityPackager");
GameRegistry.registerTileEntity(TileEntityInputter.class, Util.MOD_ID_LOWER + ":tileEntityInputter");
}
@Override

View file

@ -22,6 +22,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
@Override
public void updateEntity(){
if(!worldObj.isRemote){
boolean theFlag = this.conversionTime > 0;
if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){
this.conversionTime++;
if(this.conversionTime >= this.conversionTimeNeeded){
@ -29,6 +30,9 @@ public class TileEntityCompost extends TileEntityInventoryBase{
this.conversionTime = 0;
}
}
if(theFlag != this.conversionTime > 0){
this.markDirty();
}
}
}

View file

@ -31,21 +31,25 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean theFlag = this.currentTimer > 0;
List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.getBoundingBox(this.xCoord - reach, this.yCoord - reach, this.zCoord - reach, this.xCoord + reach, this.yCoord + reach, this.zCoord + reach));
if(animals != null){
this.currentAnimalAmount = animals.size();
if(this.currentAnimalAmount >= 2){
if(this.currentAnimalAmount < this.animalThreshold){
if(this.currentTimer >= this.timerGoal && this.slots[0] != null){
if(this.currentTimer >= this.timerGoal){
this.currentTimer = 0;
EntityAnimal randomAnimal = animals.get(new Random().nextInt(this.currentAnimalAmount));
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){
if(this.slots[0] != null){
EntityAnimal randomAnimal = animals.get(new Random().nextInt(this.currentAnimalAmount));
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){
PacketHandler.theNetwork.sendToAllAround(new PacketTileEntityFeeder(this, randomAnimal.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 80));
this.feedAnimal(randomAnimal);
PacketHandler.theNetwork.sendToAllAround(new PacketTileEntityFeeder(this, randomAnimal.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 80));
this.feedAnimal(randomAnimal);
this.slots[0].stackSize--;
if(this.slots[0].stackSize == 0) this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
this.slots[0].stackSize--;
if(this.slots[0].stackSize == 0)
this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
}
else this.currentTimer++;
@ -54,6 +58,10 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
}
else this.currentTimer = 0;
}
if(theFlag != this.currentTimer > 0){
this.markDirty();
}
}
}

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
@ -76,6 +77,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase{
if(theFlag != this.coalTimeLeft > 0){
int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? metaBefore+4 : metaBefore-4), 2);
this.markDirty();
}
}
@ -149,6 +151,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase{
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
}
}

View file

@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
public class TileEntityGiantChest extends TileEntityInventoryBase{
public TileEntityGiantChest(){
super(169, "tileEntityGiantChest");
super(9*13, "tileEntityGiantChest");
}
@Override

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
@ -90,6 +91,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase{
if(theFlag != this.coalTimeLeft > 0){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2);
this.markDirty();
}
}
}
@ -181,6 +183,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase{
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
}
}

View file

@ -0,0 +1,198 @@
package ellpeck.actuallyadditions.tile;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityInputter extends TileEntityInventoryBase{
public int sideToPut = -1;
public int slotToPut = -1;
public int placeToPutSlotAmount;
public TileEntity placeToPut;
public int sideToPull = -1;
public int slotToPull = -1;
public int placeToPullSlotAmount;
public TileEntity placeToPull;
public TileEntityInputter(){
super(1, "tileEntityInputter");
}
@Override
public void updateEntity(){
if(!worldObj.isRemote){
this.initVars();
if(!(this.sideToPull == this.sideToPut && this.slotToPull == this.slotToPut)){
if(sideToPull != -1) this.pull();
if(sideToPut != -1) this.put();
}
}
}
public void pull(){
if(this.placeToPullSlotAmount > 0){
IInventory theInventory = (IInventory)placeToPull;
int theSlotToPull = this.slotToPull;
ItemStack theStack = null;
if(theSlotToPull != -1) theStack = theInventory.getStackInSlot(theSlotToPull);
else{
for(int i = 0; i < this.placeToPullSlotAmount; i++){
ItemStack tempStack = theInventory.getStackInSlot(i);
if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < this.getInventoryStackLimit()))){
theStack = tempStack;
theSlotToPull = i;
break;
}
}
}
if(theSlotToPull != -1 && theStack != null){
if(this.slots[0] != null){
if(theStack.isItemEqual(this.slots[0])){
if(theStack.stackSize <= this.getInventoryStackLimit() - this.slots[0].stackSize){
this.slots[0].stackSize += theStack.stackSize;
theInventory.setInventorySlotContents(theSlotToPull, null);
}
else if(theStack.stackSize > this.getInventoryStackLimit() - this.slots[0].stackSize){
theStack.stackSize -= (this.getInventoryStackLimit() - this.slots[0].stackSize);
this.slots[0].stackSize = this.getInventoryStackLimit();
}
}
}
else{
this.setInventorySlotContents(0, theStack.copy());
theInventory.setInventorySlotContents(theSlotToPull, null);
}
}
}
}
public void put(){
if(this.placeToPutSlotAmount > 0){
IInventory theInventory = (IInventory)placeToPut;
int theSlotToPut = this.slotToPut;
if(this.slots[0] != null){
ItemStack theStack = null;
if(theSlotToPut != -1) theStack = theInventory.getStackInSlot(theSlotToPut);
else{
for(int i = 0; i < this.placeToPutSlotAmount; i++){
ItemStack tempStack = theInventory.getStackInSlot(i);
if(tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < theInventory.getInventoryStackLimit())){
theStack = tempStack;
theSlotToPut = i;
break;
}
}
}
if(theSlotToPut != -1 && theInventory.isItemValidForSlot(theSlotToPut, this.slots[0])){
if(theStack != null){
if(theStack.isItemEqual(this.slots[0])){
if(this.slots[0].stackSize <= theInventory.getInventoryStackLimit() - theStack.stackSize){
theStack.stackSize += this.slots[0].stackSize;
this.slots[0] = null;
}
else if(this.slots[0].stackSize > theInventory.getInventoryStackLimit() - theStack.stackSize){
this.slots[0].stackSize -= (theInventory.getInventoryStackLimit() - theStack.stackSize);
theStack.stackSize = theInventory.getInventoryStackLimit();
}
}
}
else{
theInventory.setInventorySlotContents(theSlotToPut, this.slots[0].copy());
this.slots[0] = null;
}
}
}
}
}
public void initVars(){
this.placeToPull = this.getTileEntityFromSide(this.sideToPull);
this.placeToPut = this.getTileEntityFromSide(this.sideToPut);
if(this.placeToPull != null && this.placeToPull instanceof IInventory){
this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory();
}
else{
this.placeToPullSlotAmount = 0;
this.slotToPull = -1;
}
if(this.placeToPut != null && this.placeToPut instanceof IInventory){
this.placeToPutSlotAmount = ((IInventory)this.placeToPut).getSizeInventory();
}
else{
this.placeToPutSlotAmount = 0;
this.slotToPut = -1;
}
}
public TileEntity getTileEntityFromSide(int side){
if(side == 0) return worldObj.getTileEntity(xCoord, yCoord+1, zCoord);
if(side == 1) return worldObj.getTileEntity(xCoord, yCoord-1, zCoord);
if(side == 2) return worldObj.getTileEntity(xCoord, yCoord, zCoord-1);
if(side == 3) return worldObj.getTileEntity(xCoord-1, yCoord, zCoord);
if(side == 4) return worldObj.getTileEntity(xCoord, yCoord, zCoord+1);
if(side == 5) return worldObj.getTileEntity(xCoord+1, yCoord, zCoord);
else return null;
}
public void onButtonPressed(int buttonID){
if(buttonID == 0) this.sideToPut++;
if(buttonID == 1) this.sideToPut--;
if(buttonID == 2) this.slotToPut++;
if(buttonID == 3) this.slotToPut--;
if(buttonID == 4) this.sideToPull++;
if(buttonID == 5) this.sideToPull--;
if(buttonID == 6) this.slotToPull++;
if(buttonID == 7) this.slotToPull--;
if(this.sideToPut >= 6) this.sideToPut = -1;
else if(this.sideToPut < -1) this.sideToPut = 5;
else if(this.sideToPull >= 6) this.sideToPull = -1;
else if(this.sideToPull < -1) this.sideToPull = 5;
else if(this.slotToPut >= this.placeToPutSlotAmount) this.slotToPut = -1;
else if(this.slotToPut < -1) this.slotToPut = this.placeToPutSlotAmount-1;
else if(this.slotToPull >= this.placeToPullSlotAmount) this.slotToPull = -1;
else if(this.slotToPull < -1) this.slotToPull = this.placeToPullSlotAmount-1;
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("SideToPut", this.sideToPut);
compound.setInteger("SlotToPut", this.slotToPut);
compound.setInteger("SideToPull", this.sideToPull);
compound.setInteger("SlotToPull", this.slotToPull);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.sideToPut = compound.getInteger("SideToPut");
this.slotToPut = compound.getInteger("SlotToPut");
this.sideToPull = compound.getInteger("SideToPull");
this.slotToPull = compound.getInteger("SlotToPull");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return true;
}
}

View file

@ -1,115 +0,0 @@
package ellpeck.actuallyadditions.tile;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityPackager extends TileEntityInventoryBase{
public static final int SLOT_INPUT = 0;
public static final int SLOT_OUTPUT = 1;
public int currentWaitTime;
public final int waitTime = 30;
public boolean isTwoByTwo = false;
public TileEntityPackager(){
super(2, "tileEntityPackager");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
if(this.canBeConverted(this.slots[SLOT_INPUT])){
ItemStack output = findMatchingRecipe(this.slots[SLOT_INPUT]);
if(this.slots[SLOT_OUTPUT] == null || (this.slots[SLOT_OUTPUT].isItemEqual(output) && this.slots[SLOT_OUTPUT].stackSize <= this.slots[SLOT_OUTPUT].getMaxStackSize()-output.stackSize)){
if(this.currentWaitTime >= this.waitTime){
this.currentWaitTime = 0;
if (this.slots[SLOT_OUTPUT] == null) this.slots[SLOT_OUTPUT] = output.copy();
else if(this.slots[SLOT_OUTPUT].getItem() == output.getItem()) this.slots[SLOT_OUTPUT].stackSize += output.stackSize;
this.slots[SLOT_INPUT].stackSize--;
if (this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null;
}
else this.currentWaitTime++;
}
}
}
}
public boolean canBeConverted(ItemStack stack){
return findMatchingRecipe(stack) != null;
}
public ItemStack findMatchingRecipe(ItemStack stack){
int k = this.isTwoByTwo ? 2 : 3;
TheInventoryCrafting craftMatrix = new TheInventoryCrafting(null, k, k);
for(int i = 0; i < craftMatrix.getSizeInventory(); i++){
craftMatrix.setInventorySlotContents(i, stack.copy());
}
return CraftingManager.getInstance().findMatchingRecipe(craftMatrix, this.worldObj);
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("CurrentWaitTime", this.currentWaitTime);
compound.setBoolean("EnabledSlots", this.isTwoByTwo);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.currentWaitTime = compound.getInteger("CurrentWaitTime");
this.isTwoByTwo = compound.getBoolean("EnabledSlots");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT;
}
public static class TheInventoryCrafting extends InventoryCrafting{
private ItemStack[] stackList;
public TheInventoryCrafting(Container container, int x, int y){
super(container, x, y);
this.stackList = new ItemStack[x*y];
}
@Override
public void setInventorySlotContents(int index, ItemStack stack){
this.stackList[index] = stack;
}
@Override
public ItemStack getStackInSlot(int position){
return this.stackList[position];
}
@Override
public int getSizeInventory(){
return this.stackList.length;
}
}
}

View file

@ -18,7 +18,7 @@ import org.lwjgl.input.Keyboard;
@SuppressWarnings("unused")
public class Util{
public static final String VERSION = "1.7.10-0.0.1.3";
public static final String VERSION = "1.7.10-0.0.1.4";
public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions";
@ -48,6 +48,8 @@ public class Util{
public static final String BOLD = (char)167 + "l";
public static final String UNDERLINE = (char)167 + "n";
public static final String ITALIC = (char)167 + "o";
public static final String OBFUSCATED = (char) 167 + "k";
public static final String RESET = (char) 167 + "r";
public static final String[] ROMAN_NUMERALS = new String[]{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};

View file

@ -9,7 +9,7 @@ tile.actuallyadditions.blockMiscBlackQuartzPillar.name=Schwarzquartzsäule
tile.actuallyadditions.blockFeeder.name=Fütterungsanlage
tile.actuallyadditions.blockGiantChest.name=Riesenkiste
tile.actuallyadditions.blockGrinder.name=Zerkleinerer
tile.actuallyadditions.blockGrinderDouble.name=Zerkleinerte Mk2
tile.actuallyadditions.blockGrinderDouble.name=Zerkleinerer Mk2
tile.actuallyadditions.blockFurnaceDouble.name=Ofen Mk2
item.actuallyadditions.itemMiscMashedFood.name=Brei
@ -168,6 +168,6 @@ achievement.actuallyadditions.craftKnife=Noch schärfer? Definitiv Phillips!
achievement.actuallyadditions.craftKnife.desc=Baue ein Messer.
info.actuallyadditions.feeder.animals.desc=Tiere
info.actuallyadditions.feeder.enoughToBreed.desc=Nicht genug zur Züchtung!
info.actuallyadditions.feeder.enoughToBreed.desc=Genug zur Züchtung!
info.actuallyadditions.feeder.tooMany.desc=Zu viele zur Züchtung!
info.actuallyadditions.feeder.notEnough.desc=Nicht genug zur Züchtung!

View file

@ -12,6 +12,20 @@ tile.actuallyadditions.blockGrinder.name=Crusher
tile.actuallyadditions.blockGrinderDouble.name=Double Crusher
tile.actuallyadditions.blockFurnaceDouble.name=Double Furnace
tile.actuallyadditions.blockInputter.0.name=ESD (Ellpeck's Slot Device)
tile.actuallyadditions.blockInputter.1.name=ESD (Energetic Solo Dancer)
tile.actuallyadditions.blockInputter.2.name=ESD (Ethereal System Dude)
tile.actuallyadditions.blockInputter.3.name=ESD (Energy Stuff Distributor)
tile.actuallyadditions.blockInputter.4.name=ESD (Existing Stuff Donator)
tile.actuallyadditions.blockInputter.5.name=ESD (ExtraUtils Stealing Device)
tile.actuallyadditions.blockInputter.6.name=ESD (Experienced Sauce Deriver)
tile.actuallyadditions.blockInputter.7.name=ESD (Excellent Spaghetti Dessert)
tile.actuallyadditions.blockInputter.8.name=ESD (Extraordinary Sample Deliverer)
tile.actuallyadditions.blockInputter.9.name=ESD (Express Sending Doughnut)
tile.actuallyadditions.blockInputter.10.name=ESD (Expelling Sugar Dagger)
tile.actuallyadditions.blockInputter.11.name=ESD (Extra-Long Solidifying Dissociation)
tile.actuallyadditions.blockInputter.12.name=ESD (Extravagant Supreme Dirt)
item.actuallyadditions.itemMiscMashedFood.name=Mashed Food
item.actuallyadditions.itemFertilizer.name=Fertilizer
item.actuallyadditions.itemMiscDough.name=Dough
@ -86,7 +100,11 @@ tooltip.actuallyadditions.blockGrinder.desc.4=build the Double Crusher!
tooltip.actuallyadditions.blockGrinderDouble.desc.1=Crushes Ores into Dusts!
tooltip.actuallyadditions.blockGrinderDouble.desc.2=You get two Dusts per Ore and Extras!
tooltip.actuallyadditions.blockGrinderDouble.desc.3=Can crush two Ores simultaneously!
tooltip.actuallyadditions.blockFurnaceDouble.desc=Smelts two Things simultaneously!
tooltip.actuallyadditions.blockInputter.desc.1=Its real name is %sObfuscated%s!
tooltip.actuallyadditions.blockInputter.desc.2=Acts like a more advanced Hopper
tooltip.actuallyadditions.blockInputter.desc.3=Configurable:
tooltip.actuallyadditions.blockInputter.desc.4=-Side to Output to and Input from
tooltip.actuallyadditions.blockInputter.desc.5=-Slot in the other Inventory to Output to and Input from
tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost.
@ -167,7 +185,18 @@ achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade
achievement.actuallyadditions.craftKnife=Sharper! Even sharper!
achievement.actuallyadditions.craftKnife.desc=Craft a Knife
info.actuallyadditions.feeder.animals.desc=Animals
info.actuallyadditions.feeder.enoughToBreed.desc=Enough to breed!
info.actuallyadditions.feeder.tooMany.desc=Too many to breed!
info.actuallyadditions.feeder.notEnough.desc=Not enough to breed!
info.actuallyadditions.gui.animals=Animals
info.actuallyadditions.gui.enoughToBreed=Enough to breed!
info.actuallyadditions.gui.tooMany=Too many to breed!
info.actuallyadditions.gui.notEnough=Not enough to breed!
info.actuallyadditions.gui.disabled=Disabled
info.actuallyadditions.gui.up=Up
info.actuallyadditions.gui.down=Down
info.actuallyadditions.gui.north=North
info.actuallyadditions.gui.east=East
info.actuallyadditions.gui.south=South
info.actuallyadditions.gui.west=West
info.actuallyadditions.gui.all=All
info.actuallyadditions.gui.slot=Slot
info.actuallyadditions.gui.put=Put
info.actuallyadditions.gui.pull=Pull

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View file

@ -3,7 +3,7 @@
"modid": "ActuallyAdditions",
"name": "Actually Additions",
"description": "A bunch of random stuff added to your Game to make it even more fun, exciting and add some more variety!",
"version": "0.0.1.3",
"version": "0.0.1.4",
"mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "",