From ec8bf102bbfa4621a574542633f6cef9ff1626d1 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Tue, 27 Oct 2015 13:25:56 -0400 Subject: [PATCH] Working on a few handy things! --- .../criss_cross/Blocks/BlockCropomator.java | 46 ++-- .../Blocks/BlockElectroextractor.java | 46 ++-- .../criss_cross/Blocks/BlockMachineBase.java | 70 +++--- .../criss_cross/Blocks/BlockWoodchipper.java | 46 ++-- .../criss_cross/Blocks/CCBlocks.java | 4 +- .../Container/ContainerCropomator.java | 137 ++++++------ .../Container/ContainerElectroextractor.java | 137 ++++++------ .../Container/ContainerWoodchipper.java | 135 ++++++------ .../Container/MachineOutputSlot.java | 16 +- .../oitsjustjose/criss_cross/CrissCross.java | 8 +- .../criss_cross/GUI/GUICropomator.java | 12 +- .../criss_cross/GUI/GUIElectroextractor.java | 12 +- .../criss_cross/GUI/GUIFactory.java | 8 +- .../criss_cross/GUI/GUIHandler.java | 34 +-- .../criss_cross/GUI/GUIWoodchipper.java | 12 +- .../criss_cross/Items/CCItems.java | 4 +- .../criss_cross/Items/ItemDust.java | 37 ++-- .../criss_cross/Items/ItemEverfulBucket.java | 134 ++++++++++++ .../NEI/CropomatorFuelHandler.java | 34 +-- .../NEI/CropomatorRecipeHandler.java | 58 ++--- .../NEI/ElectroextractorFuelHandler.java | 34 +-- .../NEI/ElectroextractorRecipeHandler.java | 58 ++--- .../criss_cross/NEI/NEICrissCrossConfig.java | 6 +- .../NEI/WoodchipperFuelHandler.java | 34 +-- .../NEI/WoodchipperRecipeHandler.java | 58 ++--- .../Recipes/CCCraftingRecipes.java | 53 +++-- .../criss_cross/Recipes/CCMachineRecipes.java | 111 +++++----- .../Recipes/CropomatorRecipes.java | 22 +- .../Recipes/ElectroextractorRecipes.java | 20 +- .../Recipes/WoodchipperRecipes.java | 20 +- .../TileEntity/TileEntityCropomator.java | 190 +++++++++-------- .../TileEntityElectroextractor.java | 188 ++++++++-------- .../TileEntity/TileEntityWoodchipper.java | 200 +++++++++--------- .../oitsjustjose/criss_cross/Util/CCLog.java | 12 +- .../oitsjustjose/criss_cross/Util/CCTab.java | 4 +- .../criss_cross/Util/ClientProxy.java | 6 +- .../criss_cross/Util/CommonProxy.java | 2 +- .../criss_cross/Util/ConfigHandler.java | 71 ++++--- .../criss_cross/Util/ItemHelper.java | 93 ++++---- .../criss_cross/Util/OreDictionaryAdder.java | 4 +- .../assets/crisscross/lang/en_US.lang | 3 + .../textures/items/everfulBucket.png | Bin 0 -> 1130 bytes .../textures/items/everfulBucket.png.mcmeta | 5 + .../crisscross/textures/items/voidBucket.png | Bin 0 -> 387 bytes 44 files changed, 1161 insertions(+), 1023 deletions(-) create mode 100644 src/main/java/com/oitsjustjose/criss_cross/Items/ItemEverfulBucket.java create mode 100644 src/main/resources/assets/crisscross/textures/items/everfulBucket.png create mode 100755 src/main/resources/assets/crisscross/textures/items/everfulBucket.png.mcmeta create mode 100644 src/main/resources/assets/crisscross/textures/items/voidBucket.png diff --git a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockCropomator.java b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockCropomator.java index 8bd05cc..54320b0 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockCropomator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockCropomator.java @@ -23,14 +23,14 @@ import net.minecraft.world.World; public class BlockCropomator extends BlockMachineBase { private static String unlocName = "Cropomator"; - + public BlockCropomator() { super(unlocName); GameRegistry.registerTileEntity(TileEntityCropomator.class, unlocName); GameRegistry.registerBlock(this, unlocName); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) @@ -40,45 +40,45 @@ public class BlockCropomator extends BlockMachineBase blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { Random random = new Random(); TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(x, y, z); - - if (tile != null) + + if(tile != null) { - for (int i = 0; i < tile.getSizeInventory(); ++i) + for(int i = 0; i < tile.getSizeInventory(); ++i) { ItemStack itemstack = tile.getStackInSlot(i); - - if (itemstack != null) + + if(itemstack != null) { float f = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F; float f2 = random.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) + + while(itemstack.stackSize > 0) { int j = random.nextInt(21) + 10; - - if (j > itemstack.stackSize) + + if(j > itemstack.stackSize) { j = itemstack.stackSize; } - + itemstack.stackSize -= j; EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) + + if(itemstack.hasTagCompound()) { entityitem.getEntityItem() .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } - + float f3 = 0.05F; entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); @@ -87,32 +87,32 @@ public class BlockCropomator extends BlockMachineBase } } } - + world.func_147453_f(x, y, z, block); - + } - + super.breakBlock(world, x, y, z, block, meta); } - + @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCropomator(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if (world.isRemote) + if(world.isRemote) { return true; } else { TileEntityCropomator tilecropomator = (TileEntityCropomator) world.getTileEntity(x, y, z); - if (tilecropomator != null) + if(tilecropomator != null) player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z); return true; } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockElectroextractor.java b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockElectroextractor.java index af77d58..3735129 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockElectroextractor.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockElectroextractor.java @@ -23,14 +23,14 @@ import net.minecraft.world.World; public class BlockElectroextractor extends BlockMachineBase { private static String unlocName = "ElectroExtractor"; - + public BlockElectroextractor() { super(unlocName); GameRegistry.registerTileEntity(TileEntityElectroextractor.class, unlocName); GameRegistry.registerBlock(this, unlocName); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) @@ -40,51 +40,51 @@ public class BlockElectroextractor extends BlockMachineBase blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); } - + @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityElectroextractor(); } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { Random random = new Random(); TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(x, y, z); - - if (tile != null) + + if(tile != null) { - for (int i = 0; i < tile.getSizeInventory(); ++i) + for(int i = 0; i < tile.getSizeInventory(); ++i) { ItemStack itemstack = tile.getStackInSlot(i); - - if (itemstack != null) + + if(itemstack != null) { float f = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F; float f2 = random.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) + + while(itemstack.stackSize > 0) { int j = random.nextInt(21) + 10; - - if (j > itemstack.stackSize) + + if(j > itemstack.stackSize) { j = itemstack.stackSize; } - + itemstack.stackSize -= j; EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) + + if(itemstack.hasTagCompound()) { entityitem.getEntityItem() .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } - + float f3 = 0.05F; entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); @@ -93,26 +93,26 @@ public class BlockElectroextractor extends BlockMachineBase } } } - + world.func_147453_f(x, y, z, block); - + } - + super.breakBlock(world, x, y, z, block, meta); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if (world.isRemote) + if(world.isRemote) { return true; } else { TileEntityElectroextractor tileext = (TileEntityElectroextractor) world.getTileEntity(x, y, z); - if (tileext != null) + if(tileext != null) player.openGui(CrissCross.instance, GUIHandler.Electroextractor, world, x, y, z); return true; } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockMachineBase.java b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockMachineBase.java index f12641a..992c30b 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockMachineBase.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockMachineBase.java @@ -23,7 +23,7 @@ public class BlockMachineBase extends BlockContainer IIcon[] blockTextures = new IIcon[4]; private static String unlocalizedName; private static boolean isActive = false; - + public BlockMachineBase(String unlocName) { super(Material.rock); // 0 - Top @@ -32,111 +32,111 @@ public class BlockMachineBase extends BlockContainer this.setStepSound(soundTypeMetal); // 4 - Sides this.setBlockName(Reference.modid + "." + unlocName); this.setCreativeTab(CrissCross.CCTab); - + this.unlocalizedName = unlocName; } - + // Used for the ItemStack vs. In-world Rendering @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - if (side == 0) + if(side == 0) return blockTextures[0]; - if (side == 1) + if(side == 1) return blockTextures[1]; - if (side == 3) + if(side == 3) return blockTextures[2]; - + return blockTextures[3]; } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) { - if (side == 0) + if(side == 0) return blockTextures[0]; - if (side == 1) + if(side == 1) return blockTextures[1]; - if (side == access.getBlockMetadata(x, y, z)) + if(side == access.getBlockMetadata(x, y, z)) return blockTextures[2]; - + return blockTextures[3]; } - + @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); setMetadataForFront(world, x, y, z); } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) { int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (l == 0) + + if(l == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } - - if (l == 1) + + if(l == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - - if (l == 2) + + if(l == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - - if (l == 3) + + if(l == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } } - + private void setMetadataForFront(World world, int x, int y, int z) { - if (!world.isRemote) + if(!world.isRemote) { Block block = world.getBlock(x, y, z - 1); Block block1 = world.getBlock(x, y, z + 1); Block block2 = world.getBlock(x - 1, y, z); Block block3 = world.getBlock(x + 1, y, z); byte b0 = 3; - - if (block.func_149730_j() && !block1.func_149730_j()) + + if(block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } - - if (block1.func_149730_j() && !block.func_149730_j()) + + if(block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } - - if (block2.func_149730_j() && !block3.func_149730_j()) + + if(block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } - - if (block3.func_149730_j() && !block2.func_149730_j()) + + if(block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } - + world.setBlockMetadataWithNotify(x, y, z, b0, 2); } } - + public static void updateBlockState(boolean active, World world, int x, int y, int z) { isActive = active; } - + @Override public TileEntity createNewTileEntity(World world, int meta) { diff --git a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockWoodchipper.java b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockWoodchipper.java index 1efba26..64b8df1 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockWoodchipper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Blocks/BlockWoodchipper.java @@ -22,14 +22,14 @@ import net.minecraft.world.World; public class BlockWoodchipper extends BlockMachineBase { private static String unlocName = "WoodChipper"; - + public BlockWoodchipper() { super(unlocName); GameRegistry.registerTileEntity(TileEntityWoodchipper.class, unlocName); GameRegistry.registerBlock(this, unlocName); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) @@ -39,51 +39,51 @@ public class BlockWoodchipper extends BlockMachineBase blockTextures[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); } - + @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityWoodchipper(); } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { Random random = new Random(); TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(x, y, z); - - if (tile != null) + + if(tile != null) { - for (int i = 0; i < tile.getSizeInventory(); ++i) + for(int i = 0; i < tile.getSizeInventory(); ++i) { ItemStack itemstack = tile.getStackInSlot(i); - - if (itemstack != null) + + if(itemstack != null) { float f = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F; float f2 = random.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) + + while(itemstack.stackSize > 0) { int j = random.nextInt(21) + 10; - - if (j > itemstack.stackSize) + + if(j > itemstack.stackSize) { j = itemstack.stackSize; } - + itemstack.stackSize -= j; EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) + + if(itemstack.hasTagCompound()) { entityitem.getEntityItem() .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } - + float f3 = 0.05F; entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); @@ -92,26 +92,26 @@ public class BlockWoodchipper extends BlockMachineBase } } } - + world.func_147453_f(x, y, z, block); - + } - + super.breakBlock(world, x, y, z, block, meta); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if (world.isRemote) + if(world.isRemote) { return true; } else { TileEntityWoodchipper tileext = (TileEntityWoodchipper) world.getTileEntity(x, y, z); - if (tileext != null) + if(tileext != null) player.openGui(CrissCross.instance, GUIHandler.Woodchipper, world, x, y, z); return true; } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Blocks/CCBlocks.java b/src/main/java/com/oitsjustjose/criss_cross/Blocks/CCBlocks.java index 9ea20ac..0762bb4 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Blocks/CCBlocks.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Blocks/CCBlocks.java @@ -22,13 +22,13 @@ public class CCBlocks public static Block cropomator; public static Block electroextractor; public static Block woodchipper; - + public static void init() { cropomator = new BlockCropomator(); electroextractor = new BlockElectroextractor(); woodchipper = new BlockWoodchipper(); - + NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler()); } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerCropomator.java b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerCropomator.java index 5e07189..a938b48 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerCropomator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerCropomator.java @@ -17,45 +17,45 @@ public class ContainerCropomator extends Container { TileEntityCropomator cropomator; EntityPlayer player; - + private int lastUseTime; private int lastProcessTime; private int lastCatalystInUseTime; - + public ContainerCropomator(EntityPlayer player, TileEntityCropomator cropomator) { this.player = player; this.cropomator = cropomator; - + lastUseTime = 0; lastProcessTime = 0; lastCatalystInUseTime = 0; - + this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); // input this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); // catalyst this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35)); this.addInventorySlots(); } - + @SideOnly(Side.CLIENT) public void updateProgressBar(int timeType1, int timeType2) { - if (timeType1 == 0) + if(timeType1 == 0) { this.cropomator.processTime = timeType2; } - - if (timeType1 == 1) + + if(timeType1 == 1) { this.cropomator.catalystTime = timeType2; } - - if (timeType1 == 2) + + if(timeType1 == 2) { this.cropomator.catalystInUseTime = timeType2; } } - + @Override public void addCraftingToCrafters(ICrafting crafting) { @@ -64,86 +64,81 @@ public class ContainerCropomator extends Container crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime); crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime); } - + @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) + for(int i = 0; i < this.crafters.size(); ++i) { ICrafting crafting = (ICrafting) this.crafters.get(i); - - if (this.lastUseTime != this.cropomator.processTime) + + if(this.lastUseTime != this.cropomator.processTime) crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime); - if (this.lastProcessTime != this.cropomator.catalystTime) + if(this.lastProcessTime != this.cropomator.catalystTime) crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime); - if (this.lastCatalystInUseTime != this.cropomator.catalystInUseTime) + if(this.lastCatalystInUseTime != this.cropomator.catalystInUseTime) crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime); } this.lastUseTime = this.cropomator.processTime; this.lastProcessTime = this.cropomator.catalystTime; this.lastCatalystInUseTime = this.cropomator.catalystInUseTime; } - + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(slotID); - - if (slot != null && slot.getHasStack()) + + if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - - if (slotID == 2) + + if(slotID == 2) { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) + if(!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } - + slot.onSlotChange(itemstack1, itemstack); } - else - if (slotID != 1 && slotID != 0) + else if(slotID != 1 && slotID != 0) + { + if(TileEntityCropomator.isValid(itemstack1)) { - if (TileEntityCropomator.isValid(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { - return null; - } - } - else - if (TileEntityCropomator.isItemCatalyst(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { - return null; - } - } - else - if (slotID >= 3 && slotID < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { - return null; - } - } - else - if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { - return null; - } - } - else - if (!this.mergeItemStack(itemstack1, 3, 39, false)) + if(!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - - if (itemstack1.stackSize == 0) + } + else if(TileEntityCropomator.isItemCatalyst(itemstack1)) + { + if(!this.mergeItemStack(itemstack1, 1, 2, false)) + { + return null; + } + } + else if(slotID >= 3 && slotID < 30) + { + if(!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if(slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if(!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if(itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } @@ -151,38 +146,38 @@ public class ContainerCropomator extends Container { slot.onSlotChanged(); } - - if (itemstack1.stackSize == itemstack.stackSize) + + if(itemstack1.stackSize == itemstack.stackSize) { return null; } - + slot.onPickupFromSlot(player, itemstack1); } - + return itemstack; } - + @Override public boolean canInteractWith(EntityPlayer player) { return this.cropomator.isUseableByPlayer(this.player); } - + public final void addInventorySlots() { this.addInventorySlots(8, 84, 142); } - + public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) { InventoryPlayer inventory = this.player.inventory; - - for (int i = 0; i < 3; ++i) - for (int j = 0; j < 9; ++j) + + for(int i = 0; i < 3; ++i) + for(int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); - - for (int i = 0; i < 9; ++i) + + for(int i = 0; i < 9; ++i) this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar)); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerElectroextractor.java b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerElectroextractor.java index 05da943..59b432a 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerElectroextractor.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerElectroextractor.java @@ -15,45 +15,45 @@ public class ContainerElectroextractor extends Container { TileEntityElectroextractor electroextractor; EntityPlayer player; - + private int lastUseTime; private int lastCrushTime; private int lastFuelTime; - + public ContainerElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor) { this.player = player; this.electroextractor = electroextractor; - + lastUseTime = 0; lastCrushTime = 0; lastFuelTime = 0; - + this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); // input this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); // fuelitem this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35)); this.addInventorySlots(); } - + @SideOnly(Side.CLIENT) public void updateProgressBar(int timeType1, int timeType2) { - if (timeType1 == 0) + if(timeType1 == 0) { this.electroextractor.crushTime = timeType2; } - - if (timeType1 == 1) + + if(timeType1 == 1) { this.electroextractor.fuelTime = timeType2; } - - if (timeType1 == 2) + + if(timeType1 == 2) { this.electroextractor.fuelInUseTime = timeType2; } } - + @Override public void addCraftingToCrafters(ICrafting crafting) { @@ -62,86 +62,81 @@ public class ContainerElectroextractor extends Container crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime); crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime); } - + @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) + for(int i = 0; i < this.crafters.size(); ++i) { ICrafting crafting = (ICrafting) this.crafters.get(i); - - if (this.lastUseTime != this.electroextractor.crushTime) + + if(this.lastUseTime != this.electroextractor.crushTime) crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime); - if (this.lastCrushTime != this.electroextractor.fuelTime) + if(this.lastCrushTime != this.electroextractor.fuelTime) crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime); - if (this.lastFuelTime != this.electroextractor.fuelInUseTime) + if(this.lastFuelTime != this.electroextractor.fuelInUseTime) crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime); } this.lastUseTime = this.electroextractor.crushTime; this.lastCrushTime = this.electroextractor.fuelTime; this.lastFuelTime = this.electroextractor.fuelInUseTime; } - + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(slotID); - - if (slot != null && slot.getHasStack()) + + if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - - if (slotID == 2) + + if(slotID == 2) { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) + if(!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } - + slot.onSlotChange(itemstack1, itemstack); } - else - if (slotID != 1 && slotID != 0) + else if(slotID != 1 && slotID != 0) + { + if(TileEntityElectroextractor.isValid(itemstack1)) { - if (TileEntityElectroextractor.isValid(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { - return null; - } - } - else - if (TileEntityElectroextractor.isItemEnergetic(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { - return null; - } - } - else - if (slotID >= 3 && slotID < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { - return null; - } - } - else - if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { - return null; - } - } - else - if (!this.mergeItemStack(itemstack1, 3, 39, false)) + if(!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - - if (itemstack1.stackSize == 0) + } + else if(TileEntityElectroextractor.isItemEnergetic(itemstack1)) + { + if(!this.mergeItemStack(itemstack1, 1, 2, false)) + { + return null; + } + } + else if(slotID >= 3 && slotID < 30) + { + if(!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if(slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if(!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if(itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } @@ -149,38 +144,38 @@ public class ContainerElectroextractor extends Container { slot.onSlotChanged(); } - - if (itemstack1.stackSize == itemstack.stackSize) + + if(itemstack1.stackSize == itemstack.stackSize) { return null; } - + slot.onPickupFromSlot(player, itemstack1); } - + return itemstack; } - + @Override public boolean canInteractWith(EntityPlayer player) { return this.electroextractor.isUseableByPlayer(this.player); } - + public final void addInventorySlots() { this.addInventorySlots(8, 84, 142); } - + public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) { InventoryPlayer inventory = this.player.inventory; - - for (int i = 0; i < 3; ++i) - for (int j = 0; j < 9; ++j) + + for(int i = 0; i < 3; ++i) + for(int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); - - for (int i = 0; i < 9; ++i) + + for(int i = 0; i < 9; ++i) this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar)); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerWoodchipper.java b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerWoodchipper.java index e8b319b..b8f5233 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerWoodchipper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Container/ContainerWoodchipper.java @@ -15,43 +15,43 @@ public class ContainerWoodchipper extends Container { TileEntityWoodchipper woodchipper; EntityPlayer player; - + private int lastUseTime; private int lastChopTime; private int lastFuelTime; - + public ContainerWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper) { this.player = player; this.woodchipper = woodchipper; - + lastUseTime = 0; lastChopTime = 0; lastFuelTime = 0; - + this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); // input this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); // catalyst this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35)); this.addInventorySlots(); } - + @SideOnly(Side.CLIENT) public void updateProgressBar(int timeType1, int timeType2) { - switch (timeType1) + switch(timeType1) { case 0: - this.woodchipper.processTime = timeType2; + this.woodchipper.processTime = timeType2; break; case 1: - this.woodchipper.fuelTime = timeType2; + this.woodchipper.fuelTime = timeType2; break; case 2: - this.woodchipper.fuelUsetime = timeType2; + this.woodchipper.fuelUsetime = timeType2; break; } } - + @Override public void addCraftingToCrafters(ICrafting crafting) { @@ -60,86 +60,81 @@ public class ContainerWoodchipper extends Container crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime); crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime); } - + @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) + for(int i = 0; i < this.crafters.size(); ++i) { ICrafting crafting = (ICrafting) this.crafters.get(i); - - if (this.lastUseTime != this.woodchipper.processTime) + + if(this.lastUseTime != this.woodchipper.processTime) crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime); - if (this.lastChopTime != this.woodchipper.fuelTime) + if(this.lastChopTime != this.woodchipper.fuelTime) crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime); - if (this.lastFuelTime != this.woodchipper.fuelUsetime) + if(this.lastFuelTime != this.woodchipper.fuelUsetime) crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime); } this.lastUseTime = this.woodchipper.processTime; this.lastChopTime = this.woodchipper.fuelTime; this.lastFuelTime = this.woodchipper.fuelUsetime; } - + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(slotID); - - if (slot != null && slot.getHasStack()) + + if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - - if (slotID == 2) + + if(slotID == 2) { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) + if(!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } - + slot.onSlotChange(itemstack1, itemstack); } - else - if (slotID != 1 && slotID != 0) + else if(slotID != 1 && slotID != 0) + { + if(TileEntityWoodchipper.isValidForWoodchipper(itemstack1)) { - if (TileEntityWoodchipper.isValidForWoodchipper(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { - return null; - } - } - else - if (TileEntityWoodchipper.isItemFuel(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { - return null; - } - } - else - if (slotID >= 3 && slotID < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { - return null; - } - } - else - if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { - return null; - } - } - else - if (!this.mergeItemStack(itemstack1, 3, 39, false)) + if(!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - - if (itemstack1.stackSize == 0) + } + else if(TileEntityWoodchipper.isItemFuel(itemstack1)) + { + if(!this.mergeItemStack(itemstack1, 1, 2, false)) + { + return null; + } + } + else if(slotID >= 3 && slotID < 30) + { + if(!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if(slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if(!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if(itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } @@ -147,38 +142,38 @@ public class ContainerWoodchipper extends Container { slot.onSlotChanged(); } - - if (itemstack1.stackSize == itemstack.stackSize) + + if(itemstack1.stackSize == itemstack.stackSize) { return null; } - + slot.onPickupFromSlot(player, itemstack1); } - + return itemstack; } - + @Override public boolean canInteractWith(EntityPlayer player) { return this.woodchipper.isUseableByPlayer(this.player); } - + public final void addInventorySlots() { this.addInventorySlots(8, 84, 142); } - + public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) { InventoryPlayer inventory = this.player.inventory; - - for (int i = 0; i < 3; ++i) - for (int j = 0; j < 9; ++j) + + for(int i = 0; i < 3; ++i) + for(int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); - - for (int i = 0; i < 9; ++i) + + for(int i = 0; i < 9; ++i) this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar)); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Container/MachineOutputSlot.java b/src/main/java/com/oitsjustjose/criss_cross/Container/MachineOutputSlot.java index 9198e4d..49c8822 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Container/MachineOutputSlot.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Container/MachineOutputSlot.java @@ -16,44 +16,44 @@ public class MachineOutputSlot extends Slot /** The player that is using the GUI where this slot resides. */ private EntityPlayer thePlayer; private int temp; - + public MachineOutputSlot(EntityPlayer player, IInventory inventory, int x, int y, int z) { super(inventory, x, y, z); this.thePlayer = player; } - + @Override public boolean isItemValid(ItemStack stack) { return false; } - + @Override public ItemStack decrStackSize(int slot) { - if (this.getHasStack()) + if(this.getHasStack()) { this.temp += Math.min(slot, this.getStack().stackSize); } - + return super.decrStackSize(slot); } - + @Override public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack) { this.onCrafting(itemstack); super.onPickupFromSlot(player, itemstack); } - + @Override protected void onCrafting(ItemStack itemstack, int slot) { this.temp += slot; this.onCrafting(itemstack); } - + @Override protected void onCrafting(ItemStack stack) { diff --git a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java index c691133..4898d3a 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java +++ b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java @@ -24,13 +24,13 @@ import net.minecraft.creativetab.CreativeTabs; public class CrissCross { public static CreativeTabs CCTab; - + @Instance(Reference.modid) public static CrissCross instance; - + @SidedProxy(clientSide = "com.oitsjustjose.criss_cross.Util.ClientProxy", serverSide = "com.oitsjustjose.criss_cross.Util.CommonProxy") public static CommonProxy proxy; - + @EventHandler public static void preInit(FMLPreInitializationEvent event) { @@ -39,7 +39,7 @@ public class CrissCross CCTab = new CCTab(); proxy.preInit(); } - + @EventHandler public static void init(FMLInitializationEvent event) { diff --git a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUICropomator.java b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUICropomator.java index 42a326c..5a9641d 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUICropomator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUICropomator.java @@ -15,22 +15,22 @@ import net.minecraft.util.StatCollector; public class GUICropomator extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cropomator.png"); - + private TileEntityCropomator cropomator; - + public GUICropomator(EntityPlayer player, TileEntityCropomator cropomator) { super(new ContainerCropomator(player, cropomator)); this.cropomator = cropomator; } - + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); } - + protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -38,8 +38,8 @@ public class GUICropomator extends GuiContainer int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - if (this.cropomator.isUsingFuel()) + + if(this.cropomator.isUsingFuel()) { int i1 = this.cropomator.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); diff --git a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIElectroextractor.java b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIElectroextractor.java index 2751cd1..86a345b 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIElectroextractor.java +++ b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIElectroextractor.java @@ -14,22 +14,22 @@ public class GUIElectroextractor extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/electroextractor.png"); - + private TileEntityElectroextractor electroextractor; - + public GUIElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor) { super(new ContainerElectroextractor(player, electroextractor)); this.electroextractor = electroextractor; } - + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); } - + protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -37,8 +37,8 @@ public class GUIElectroextractor extends GuiContainer int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - if (this.electroextractor.isUsingFuel()) + + if(this.electroextractor.isUsingFuel()) { int i1 = this.electroextractor.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); diff --git a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIFactory.java b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIFactory.java index 7cfa0d8..86694a9 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIFactory.java +++ b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIFactory.java @@ -11,21 +11,21 @@ public class GUIFactory implements IModGuiFactory @Override public void initialize(Minecraft minecraftInstance) { - + } - + @Override public Class mainConfigGuiClass() { return ModGUIConfig.class; } - + @Override public Set runtimeGuiCategories() { return null; } - + @Override public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { diff --git a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIHandler.java b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIHandler.java index 2847ad2..c34df9c 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIHandler.java @@ -17,55 +17,55 @@ public class GUIHandler implements IGuiHandler public static final int Cropomator = 1; public static final int Electroextractor = 2; public static final int Woodchipper = 3; - + @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); - - if (tile instanceof TileEntityCropomator) + + if(tile instanceof TileEntityCropomator) { TileEntityCropomator TE = (TileEntityCropomator) tile; - + return new ContainerCropomator(player, TE); } - if (tile instanceof TileEntityElectroextractor) + if(tile instanceof TileEntityElectroextractor) { TileEntityElectroextractor TE = (TileEntityElectroextractor) tile; - + return new ContainerElectroextractor(player, TE); } - if (tile instanceof TileEntityWoodchipper) + if(tile instanceof TileEntityWoodchipper) { TileEntityWoodchipper TE = (TileEntityWoodchipper) tile; - + return new ContainerWoodchipper(player, TE); } return null; } - + @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile = world.getTileEntity(x, y, z); - - if (tile instanceof TileEntityCropomator) + + if(tile instanceof TileEntityCropomator) { TileEntityCropomator TE = (TileEntityCropomator) tile; - + return new GUICropomator(player, TE); } - - if (tile instanceof TileEntityElectroextractor) + + if(tile instanceof TileEntityElectroextractor) { TileEntityElectroextractor TE = (TileEntityElectroextractor) tile; - + return new GUIElectroextractor(player, TE); } - if (tile instanceof TileEntityWoodchipper) + if(tile instanceof TileEntityWoodchipper) { TileEntityWoodchipper TE = (TileEntityWoodchipper) tile; - + return new GUIWoodchipper(player, TE); } return null; diff --git a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIWoodchipper.java b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIWoodchipper.java index 5bae2c7..135fa77 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIWoodchipper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/GUI/GUIWoodchipper.java @@ -13,22 +13,22 @@ import net.minecraft.util.StatCollector; public class GUIWoodchipper extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/woodchipper.png"); - + private TileEntityWoodchipper woodchipper; - + public GUIWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper) { super(new ContainerWoodchipper(player, woodchipper)); this.woodchipper = woodchipper; } - + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); } - + protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -36,8 +36,8 @@ public class GUIWoodchipper extends GuiContainer int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - if (this.woodchipper.isUsingFuel()) + + if(this.woodchipper.isUsingFuel()) { int i1 = this.woodchipper.getBurnTimeRemainingScaled(13); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); diff --git a/src/main/java/com/oitsjustjose/criss_cross/Items/CCItems.java b/src/main/java/com/oitsjustjose/criss_cross/Items/CCItems.java index b038c40..8c3cb1f 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Items/CCItems.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Items/CCItems.java @@ -5,9 +5,11 @@ import net.minecraft.item.Item; public class CCItems { public static Item dusts; - + public static Item everfulBucket; + public static void init() { dusts = new ItemDust(); + everfulBucket = new ItemEverfulBucket(); } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java index d368f1d..3dd1351 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java @@ -16,61 +16,64 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraftforge.oredict.OreDictionary; public class ItemDust extends Item { private static ArrayList dustNames = new ArrayList(); private static ArrayList colors = new ArrayList(); + @SideOnly(Side.CLIENT) public static IIcon overlay; + @SideOnly(Side.CLIENT) public static IIcon base; - + public ItemDust() { this.setHasSubtypes(true); this.setCreativeTab(CrissCross.CCTab); - GameRegistry.registerItem(this, this.getUnlocalizedName()); + GameRegistry.registerItem(this, "itemDust"); } - + public static ArrayList getDusts() { return dustNames; } - + public static void addDustType(String name, int color) { dustNames.add(name); colors.add(color); } - + public static String getName(int meta) { return dustNames.get(meta); } - + @Override public boolean requiresMultipleRenderPasses() { return true; } - + @Override public IIcon getIconFromDamageForRenderPass(int meta, int pass) { return pass == 0 ? base : overlay; } - + @Override public String getUnlocalizedName(ItemStack itemStack) { - if (itemStack.getItemDamage() >= colors.size() || itemStack.getItemDamage() >= dustNames.size()) + if(itemStack.getItemDamage() >= colors.size() || itemStack.getItemDamage() >= dustNames.size()) { - itemStack.setStackDisplayName("This is a bad item, please trash it."); - return ("item." + Reference.modid + ".trash"); + itemStack.setStackDisplayName(StatCollector.translateToLocal("item.CrissCross.trash.name")); + return("item." + Reference.modid + ".trash"); } return "item." + Reference.modid + "." + dustNames.get(itemStack.getItemDamage()); } - + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) @@ -78,26 +81,26 @@ public class ItemDust extends Item overlay = register.registerIcon(Reference.modid + ":dust_overlay"); base = register.registerIcon(Reference.modid + ":dust_base"); } - + @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass) { - if (pass == 1) + if(pass == 1) { - if (stack.getItemDamage() >= colors.size()) + if(stack.getItemDamage() >= colors.size()) return 0; return colors.get(stack.getItemDamage()); } else return 16777215; } - + @Override @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < dustNames.size(); i++) + for(int i = 0; i < dustNames.size(); i++) list.add(new ItemStack(item, 1, i)); } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Items/ItemEverfulBucket.java b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemEverfulBucket.java new file mode 100644 index 0000000..7c84864 --- /dev/null +++ b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemEverfulBucket.java @@ -0,0 +1,134 @@ +package com.oitsjustjose.criss_cross.Items; + +import java.util.List; + +import com.oitsjustjose.criss_cross.CrissCross; +import com.oitsjustjose.criss_cross.Util.Reference; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemEverfulBucket extends Item +{ + String[] types = new String[] + { "everfulBucket", "voidBucket" }; + @SideOnly(Side.CLIENT) + IIcon[] icons = new IIcon[types.length]; + + public ItemEverfulBucket() + { + this.setHasSubtypes(true); + this.maxStackSize = 1; + this.setCreativeTab(CrissCross.CCTab); + GameRegistry.registerItem(this, "magicBucket"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) + { + return icons[meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister register) + { + for(int i = 0; i < icons.length; i++) + icons[i] = register.registerIcon(Reference.modid + ":" + types[i]); + } + + @Override + public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, true); + + if(movingobjectposition == null) + { + return itemstack; + } + else + { + if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + int x = movingobjectposition.blockX; + int y = movingobjectposition.blockY; + int z = movingobjectposition.blockZ; + + if(!world.canMineBlock(player, x, y, z)) + return itemstack; + + if(!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, itemstack)) + return itemstack; + + if(itemstack.getItemDamage() == 1) + { + Material material = world.getBlock(x, y, z).getMaterial(); + int meta = world.getBlockMetadata(x, y, z); + + if(material == Material.water && meta == 0) + world.setBlockToAir(x, y, z); + + if(material == Material.lava && meta == 0) + world.setBlockToAir(x, y, z); + } + else + { + if(world.getBlock(x, y, z).getMaterial() == Material.lava || world.getBlock(x, y, z).getMaterial() == Material.water) + return itemstack; + + if(movingobjectposition.sideHit == 0) + --y; + + if(movingobjectposition.sideHit == 1) + ++y; + + if(movingobjectposition.sideHit == 2) + --z; + + if(movingobjectposition.sideHit == 3) + ++z; + + if(movingobjectposition.sideHit == 4) + --x; + + if(movingobjectposition.sideHit == 5) + ++x; + + if(!player.canPlayerEdit(x, y, z, movingobjectposition.sideHit, itemstack)) + return itemstack; + + if(itemstack.getItemDamage() == 0) + world.setBlock(x, y, z, Blocks.flowing_water); + } + } + } + + return itemstack; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return "item." + Reference.modid + "." + types[itemStack.getItemDamage()]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list) + { + for(int i = 0; i < types.length; i++) + list.add(new ItemStack(item, 1, i)); + } +} \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorFuelHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorFuelHandler.java index f67cff7..376e021 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorFuelHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorFuelHandler.java @@ -15,67 +15,67 @@ public class CropomatorFuelHandler extends CropomatorRecipeHandler public class CachedFuelRecipe extends CachedRecipe { public FuelPair fuel; - + public CachedFuelRecipe(FuelPair fuel) { this.fuel = fuel; } - + @Override public PositionedStack getIngredient() { return mCropomator.get(cycleticks / 48 % mCropomator.size()).ingred; } - + @Override public PositionedStack getResult() { return mCropomator.get(cycleticks / 48 % mCropomator.size()).result; } - + @Override public PositionedStack getOtherStack() { return fuel.stack; } } - + private ArrayList mCropomator = new ArrayList(); - + public CropomatorFuelHandler() { super(); loadAllRecipes(); } - + public String getRecipeName() { return StatCollector.translateToLocal("recipe.cropomatorfuel"); } - + private void loadAllRecipes() { Map recipes = CropomatorRecipes.getInstance().getRecipeList(); - - for (Entry recipe : recipes.entrySet()) + + for(Entry recipe : recipes.entrySet()) this.mCropomator.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("cropomatorfuel")) - for (FuelPair fuel : afuels) + if(outputId.equals("cropomatorfuel")) + for(FuelPair fuel : afuels) arecipes.add(new CachedFuelRecipe(fuel)); } - + public void loadUsageRecipes(ItemStack ingredient) { - for (FuelPair fuel : afuels) - if (fuel.stack.contains(ingredient)) + for(FuelPair fuel : afuels) + if(fuel.stack.contains(ingredient)) arecipes.add(new CachedFuelRecipe(fuel)); } - + public String getOverlayIdentifier() { return "cropomatorfuel"; diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorRecipeHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorRecipeHandler.java index f7db5c4..636544a 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorRecipeHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/CropomatorRecipeHandler.java @@ -32,26 +32,26 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler this.ingred = new PositionedStack(ingred, 51, 6); this.result = new PositionedStack(result, 111, 24); } - + public List getIngredients() { return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); } - + public PositionedStack getResult() { return result; } - + public PositionedStack getOtherStack() { return afuels.get((cycleticks / 48) % afuels.size()).stack; } - + PositionedStack ingred; PositionedStack result; } - + public static class FuelPair { public FuelPair(ItemStack ingred) @@ -59,80 +59,80 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler this.stack = new PositionedStack(ingred, 51, 42, false); this.burnTime = ConfigHandler.cropomatorProcessTime; } - + public PositionedStack stack; public int burnTime; } - + public static ArrayList afuels; public static HashSet efuels; - + @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "cropomatorfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "cropomator")); } - + @Override public Class getGuiClass() { return GUICropomator.class; } - + @Override public String getRecipeName() { return StatCollector.translateToLocal("recipe.cropomator"); } - + @Override public TemplateRecipeHandler newInstance() { - if (afuels == null || afuels.isEmpty()) + if(afuels == null || afuels.isEmpty()) findFuels(); return super.newInstance(); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class) + if(outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class) { Map recipes = (Map) CropomatorRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); } else super.loadCraftingRecipes(outputId, results); } - + @Override public void loadCraftingRecipes(ItemStack result) { Map recipes = (Map) CropomatorRecipes.getInstance().getRecipeList(); - for (Entry recipe : recipes.entrySet()) - if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) + for(Entry recipe : recipes.entrySet()) + if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)) arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadUsageRecipes(String inputId, Object... ingredients) { - if (inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class) + if(inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class) loadCraftingRecipes("cropomator"); else super.loadUsageRecipes(inputId, ingredients); } - + @Override public void loadUsageRecipes(ItemStack ingredient) { Map recipes = (Map) CropomatorRecipes.getInstance().getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) { - if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) + if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) { CropomatorPair arecipe = new CropomatorPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); @@ -140,30 +140,30 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler } } } - + @Override public String getGuiTexture() { return GUICropomator.texture.toString(); } - + @Override public void drawExtras(int recipe) { drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); } - + private static void findFuels() { afuels = new ArrayList(); - for (ItemStack item : ItemList.items) + for(ItemStack item : ItemList.items) { - if (TileEntityCropomator.isItemCatalyst(item)) + if(TileEntityCropomator.isItemCatalyst(item)) afuels.add(new FuelPair(item)); } } - + @Override public String getOverlayIdentifier() { diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorFuelHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorFuelHandler.java index 2b67fc3..930cb85 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorFuelHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorFuelHandler.java @@ -15,67 +15,67 @@ public class ElectroextractorFuelHandler extends ElectroextractorRecipeHandler public class CachedFuelRecipe extends CachedRecipe { public FuelPair fuel; - + public CachedFuelRecipe(FuelPair fuel) { this.fuel = fuel; } - + @Override public PositionedStack getIngredient() { return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).ingred; } - + @Override public PositionedStack getResult() { return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).result; } - + @Override public PositionedStack getOtherStack() { return fuel.stack; } } - + private ArrayList mElectroextractor = new ArrayList(); - + public ElectroextractorFuelHandler() { super(); loadAllRecipes(); } - + public String getRecipeName() { return StatCollector.translateToLocal("recipe.electroextractorfuel"); } - + private void loadAllRecipes() { Map recipes = ElectroextractorRecipes.getInstance().getRecipeList(); - - for (Entry recipe : recipes.entrySet()) + + for(Entry recipe : recipes.entrySet()) this.mElectroextractor.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("Electroextractorfuel")) - for (FuelPair fuel : afuels) + if(outputId.equals("Electroextractorfuel")) + for(FuelPair fuel : afuels) arecipes.add(new CachedFuelRecipe(fuel)); } - + public void loadUsageRecipes(ItemStack ingredient) { - for (FuelPair fuel : afuels) - if (fuel.stack.contains(ingredient)) + for(FuelPair fuel : afuels) + if(fuel.stack.contains(ingredient)) arecipes.add(new CachedFuelRecipe(fuel)); } - + public String getOverlayIdentifier() { return "electroextractorfuel"; diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorRecipeHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorRecipeHandler.java index 91dff4e..234d00b 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorRecipeHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/ElectroextractorRecipeHandler.java @@ -32,26 +32,26 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler this.ingred = new PositionedStack(ingred, 51, 6); this.result = new PositionedStack(result, 111, 24); } - + public List getIngredients() { return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); } - + public PositionedStack getResult() { return result; } - + public PositionedStack getOtherStack() { return afuels.get((cycleticks / 48) % afuels.size()).stack; } - + PositionedStack ingred; PositionedStack result; } - + public static class FuelPair { public FuelPair(ItemStack ingred) @@ -59,82 +59,82 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler this.stack = new PositionedStack(ingred, 51, 42, false); this.burnTime = ConfigHandler.electroextractorProcessTime; } - + public PositionedStack stack; public int burnTime; } - + public static ArrayList afuels; public static HashSet efuels; - + @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "Electroextractorfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "Electroextractor")); } - + @Override public Class getGuiClass() { return GUIElectroextractor.class; } - + @Override public String getRecipeName() { return StatCollector.translateToLocal("recipe.electroextractor"); } - + @Override public TemplateRecipeHandler newInstance() { - if (afuels == null || afuels.isEmpty()) + if(afuels == null || afuels.isEmpty()) findFuels(); return super.newInstance(); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class) + if(outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class) { Map recipes = (Map) ElectroextractorRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); } else super.loadCraftingRecipes(outputId, results); } - + @Override public void loadCraftingRecipes(ItemStack result) { Map recipes = (Map) ElectroextractorRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) - if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) + for(Entry recipe : recipes.entrySet()) + if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)) arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadUsageRecipes(String inputId, Object... ingredients) { - if (inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class) + if(inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class) loadCraftingRecipes("Electroextractor"); else super.loadUsageRecipes(inputId, ingredients); } - + @Override public void loadUsageRecipes(ItemStack ingredient) { Map recipes = (Map) ElectroextractorRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) { - if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) + if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) { ElectroextractorPair arecipe = new ElectroextractorPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); @@ -142,30 +142,30 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler } } } - + @Override public String getGuiTexture() { return GUIElectroextractor.texture.toString(); } - + @Override public void drawExtras(int recipe) { drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); } - + private static void findFuels() { afuels = new ArrayList(); - for (ItemStack item : ItemList.items) + for(ItemStack item : ItemList.items) { - if (TileEntityElectroextractor.isItemEnergetic(item)) + if(TileEntityElectroextractor.isItemEnergetic(item)) afuels.add(new FuelPair(item)); } } - + @Override public String getOverlayIdentifier() { diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/NEICrissCrossConfig.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/NEICrissCrossConfig.java index 54569a3..7dd0323 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/NEICrissCrossConfig.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/NEICrissCrossConfig.java @@ -24,19 +24,19 @@ public class NEICrissCrossConfig implements IConfigureNEI API.registerGuiOverlay(GUIElectroextractor.class, "electroextractor"); API.registerGuiOverlay(GUIWoodchipper.class, "woodchipper"); } - + @Override public String getName() { return Reference.modid; } - + @Override public String getVersion() { return Reference.version; } - + private static void registerHandler(TemplateRecipeHandler handler) { API.registerRecipeHandler(handler); diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperFuelHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperFuelHandler.java index 4c96e03..42fd83d 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperFuelHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperFuelHandler.java @@ -15,67 +15,67 @@ public class WoodchipperFuelHandler extends WoodchipperRecipeHandler public class CachedFuelRecipe extends CachedRecipe { public FuelPair fuel; - + public CachedFuelRecipe(FuelPair fuel) { this.fuel = fuel; } - + @Override public PositionedStack getIngredient() { return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).ingred; } - + @Override public PositionedStack getResult() { return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).result; } - + @Override public PositionedStack getOtherStack() { return fuel.stack; } } - + private ArrayList mWoodchipper = new ArrayList(); - + public WoodchipperFuelHandler() { super(); loadAllRecipes(); } - + public String getRecipeName() { return StatCollector.translateToLocal("recipe.woodchipperfuel"); } - + private void loadAllRecipes() { Map recipes = WoodchipperRecipes.getInstance().getRecipeList(); - - for (Entry recipe : recipes.entrySet()) + + for(Entry recipe : recipes.entrySet()) this.mWoodchipper.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("woodchipperfuel")) - for (FuelPair fuel : afuels) + if(outputId.equals("woodchipperfuel")) + for(FuelPair fuel : afuels) arecipes.add(new CachedFuelRecipe(fuel)); } - + public void loadUsageRecipes(ItemStack ingredient) { - for (FuelPair fuel : afuels) - if (fuel.stack.contains(ingredient)) + for(FuelPair fuel : afuels) + if(fuel.stack.contains(ingredient)) arecipes.add(new CachedFuelRecipe(fuel)); } - + public String getOverlayIdentifier() { return "woodchipperfuel"; diff --git a/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperRecipeHandler.java b/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperRecipeHandler.java index 1005b01..1cc281b 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperRecipeHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/NEI/WoodchipperRecipeHandler.java @@ -32,26 +32,26 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler this.ingred = new PositionedStack(ingred, 51, 6); this.result = new PositionedStack(result, 111, 24); } - + public List getIngredients() { return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); } - + public PositionedStack getResult() { return result; } - + public PositionedStack getOtherStack() { return afuels.get((cycleticks / 48) % afuels.size()).stack; } - + PositionedStack ingred; PositionedStack result; } - + public static class FuelPair { public FuelPair(ItemStack ingred) @@ -59,82 +59,82 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler this.stack = new PositionedStack(ingred, 51, 42, false); this.burnTime = ConfigHandler.woodchipperProcessTime; } - + public PositionedStack stack; public int burnTime; } - + public static ArrayList afuels; public static HashSet efuels; - + @Override public void loadTransferRects() { transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "woodchipperfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "woodchipper")); } - + @Override public Class getGuiClass() { return GUIWoodchipper.class; } - + @Override public String getRecipeName() { return StatCollector.translateToLocal("recipe.woodchipper"); } - + @Override public TemplateRecipeHandler newInstance() { - if (afuels == null || afuels.isEmpty()) + if(afuels == null || afuels.isEmpty()) findFuels(); return super.newInstance(); } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class) + if(outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class) { Map recipes = (Map) WoodchipperRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); } else super.loadCraftingRecipes(outputId, results); } - + @Override public void loadCraftingRecipes(ItemStack result) { Map recipes = (Map) WoodchipperRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) - if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) + for(Entry recipe : recipes.entrySet()) + if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)) arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); } - + @Override public void loadUsageRecipes(String inputId, Object... ingredients) { - if (inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class) + if(inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class) loadCraftingRecipes("woodchipper"); else super.loadUsageRecipes(inputId, ingredients); } - + @Override public void loadUsageRecipes(ItemStack ingredient) { Map recipes = (Map) WoodchipperRecipes.getInstance() .getRecipeList(); - for (Entry recipe : recipes.entrySet()) + for(Entry recipe : recipes.entrySet()) { - if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) + if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) { WoodchipperPair arecipe = new WoodchipperPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); @@ -142,30 +142,30 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler } } } - + @Override public String getGuiTexture() { return GUIWoodchipper.texture.toString(); } - + @Override public void drawExtras(int recipe) { drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); } - + private static void findFuels() { afuels = new ArrayList(); - for (ItemStack item : ItemList.items) + for(ItemStack item : ItemList.items) { - if (TileEntityWoodchipper.isItemFuel(item)) + if(TileEntityWoodchipper.isItemFuel(item)) afuels.add(new FuelPair(item)); } } - + @Override public String getOverlayIdentifier() { diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCCraftingRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCCraftingRecipes.java index c31cd18..39891e4 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCCraftingRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCCraftingRecipes.java @@ -21,18 +21,18 @@ public class CCCraftingRecipes electroextractorRecipe(); woodChipperRecipe(); } - + static void woodChipperRecipe() { String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":"); ItemStack centerItem = new ItemStack(Blocks.diamond_block); - - if (GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) + + if(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) { ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1); - if (unlocItem.length == 2) + if(unlocItem.length == 2) centerItem = newStack; - if (unlocItem.length == 3) + if(unlocItem.length == 3) centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); } else @@ -41,23 +41,22 @@ public class CCCraftingRecipes + "could not be added as part of the recipe of the Woodchipper."); CCLog.warn("Please confirm you have the name and formatting correct."); } - - GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), - new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', - Items.golden_axe, 'C', centerItem }); + + GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[] + { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem }); } - + static void electroextractorRecipe() { String[] unlocItem = ConfigHandler.electroextractorRecipeItem.split(":"); ItemStack centerItem = new ItemStack(Blocks.diamond_block); - - if (GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) + + if(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) { ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1); - if (unlocItem.length == 2) + if(unlocItem.length == 2) centerItem = newStack; - if (unlocItem.length == 3) + if(unlocItem.length == 3) centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); } else @@ -65,25 +64,24 @@ public class CCCraftingRecipes CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + " could not be added as part of the recipe of the electroextractor."); CCLog.warn("Please confirm you have the name and formatting correct."); - + } - - GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), - new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', - Items.golden_pickaxe, 'C', centerItem }); + + GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[] + { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem }); } - + static void cropomatorRecipe() { String[] unlocItem = ConfigHandler.cropomatorRecipeItem.split(":"); ItemStack centerItem = new ItemStack(Blocks.diamond_block); - - if (GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) + + if(GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1) != null) { ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1); - if (unlocItem.length == 2) + if(unlocItem.length == 2) centerItem = newStack; - if (unlocItem.length == 3) + if(unlocItem.length == 3) centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); } else @@ -92,9 +90,8 @@ public class CCCraftingRecipes + " could not be added as part of the recipe of the cropomator."); CCLog.warn("Please confirm you have the name and formatting correct."); } - - GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), - new Object[] { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, - 'C', centerItem }); + + GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[] + { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem }); } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCMachineRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCMachineRecipes.java index bd74d02..0a30a60 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCMachineRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CCMachineRecipes.java @@ -25,7 +25,7 @@ public class CCMachineRecipes public static int cropomatorQTY = ConfigHandler.cropomatorOutput; public static int electroQTY = ConfigHandler.electroextractorOutput; public static int woodchipperQTY = ConfigHandler.woodchipperOutput; - + public static void init() { initCropomatorRecipes(); @@ -34,7 +34,7 @@ public class CCMachineRecipes initElectroextractorOreDictionary(); initWoodchipperFuels(); initWoodchipperOreDictionary(); - + ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, electroQTY)); ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), @@ -42,17 +42,17 @@ public class CCMachineRecipes ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, electroQTY)); } - + public static void initCropomatorRecipes() { - for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++) + for(int i = 0; i < ConfigHandler.cropomatorInputs.length; i++) { try { String[] unlocStack = ConfigHandler.cropomatorInputs[i].split(":"); - if (unlocStack.length == 2) + if(unlocStack.length == 2) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) { ItemStack newStack = GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1); CropomatorRecipes.getInstance().addRecipe(newStack, @@ -63,12 +63,12 @@ public class CCMachineRecipes CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); CCLog.warn("Please confirm you have the name and formatting correct."); - + } } - if (unlocStack.length == 3) + if(unlocStack.length == 3) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) { ItemStack newStack = new ItemStack( GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, @@ -85,24 +85,24 @@ public class CCMachineRecipes } } } - catch (Exception e) + catch(Exception e) { CCLog.warn("[CrissCross]: Error reading itemstack for inputs from input file at item: " + (i + 1)); } - + } } - + public static void initCropomatorFuels() { - for (int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++) + for(int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++) { try { String[] unlocStack = ConfigHandler.cropomatorCatalysts[i].split(":"); - if (unlocStack.length == 2) + if(unlocStack.length == 2) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityCropomator.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); else { @@ -111,10 +111,10 @@ public class CCMachineRecipes CCLog.warn("Please confirm you have the name and formatting correct."); } } - - if (unlocStack.length == 3) + + if(unlocStack.length == 3) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) { ItemStack newStack = new ItemStack( GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, @@ -129,15 +129,16 @@ public class CCMachineRecipes } } } - catch (Exception e) + catch(Exception e) { CCLog.warn("Error reading itemstack for catalysts from input file at item: " + (i + 1)); } } } - //All Credit goes to TeamCoFH for the code. After so many algorithms attempted, I gave up and used one that worked: - + // All Credit goes to TeamCoFH for the code. After so many algorithms + // attempted, I gave up and used one that worked: + public static void initWoodchipperOreDictionary() { Container local1 = new Container() @@ -148,25 +149,25 @@ public class CCMachineRecipes } }; InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3); - for (int i = 0; i < 9; i++) + for(int i = 0; i < 9; i++) { localInventoryCrafting.setInventorySlotContents(i, null); } ArrayList localArrayList = OreDictionary.getOres("logWood"); - for (int j = 0; j < localArrayList.size(); j++) + for(int j = 0; j < localArrayList.size(); j++) { ItemStack localItemStack1 = (ItemStack) localArrayList.get(j); ItemStack localItemStack3; ItemStack localItemStack4; - if (ItemHelper.getItemDamage(localItemStack1) == 32767) + if(ItemHelper.getItemDamage(localItemStack1) == 32767) { - for (int k = 0; k < 16; k++) + for(int k = 0; k < 16; k++) { localItemStack3 = ItemHelper.cloneStack(localItemStack1, 1); localItemStack3.setItemDamage(k); localInventoryCrafting.setInventorySlotContents(0, localItemStack3); localItemStack4 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null); - if (localItemStack4 != null) + if(localItemStack4 != null) { ItemStack localItemStack5 = localItemStack4.copy(); ItemStack tmp129_127 = localItemStack5; @@ -180,7 +181,7 @@ public class CCMachineRecipes ItemStack localItemStack2 = localItemStack1.copy(); localInventoryCrafting.setInventorySlotContents(0, localItemStack2); localItemStack3 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null); - if (localItemStack3 != null) + if(localItemStack3 != null) { localItemStack4 = localItemStack3.copy(); ItemStack tmp201_199 = localItemStack4; @@ -190,17 +191,17 @@ public class CCMachineRecipes } } } - + public static void initWoodchipperFuels() { - for (int i = 0; i < ConfigHandler.woodchipperFuels.length; i++) + for(int i = 0; i < ConfigHandler.woodchipperFuels.length; i++) { try { String[] unlocStack = ConfigHandler.woodchipperFuels[i].split(":"); - if (unlocStack.length == 2) + if(unlocStack.length == 2) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); else { @@ -209,10 +210,10 @@ public class CCMachineRecipes CCLog.warn("Please confirm you have the name and formatting correct."); } } - - if (unlocStack.length == 3) + + if(unlocStack.length == 3) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) { ItemStack newStack = new ItemStack( GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, @@ -227,23 +228,23 @@ public class CCMachineRecipes } } } - catch (Exception e) + catch(Exception e) { CCLog.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1)); } } } - + static void initElectroextractorFuels() { - for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++) + for(int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++) { try { String[] unlocStack = ConfigHandler.electroextractorEnergySources[i].split(":"); - if (unlocStack.length == 2) + if(unlocStack.length == 2) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); else { @@ -252,10 +253,10 @@ public class CCMachineRecipes CCLog.warn("Please confirm you have the name and formatting correct."); } } - - if (unlocStack.length == 3) + + if(unlocStack.length == 3) { - if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) + if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) { ItemStack newStack = new ItemStack( GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, @@ -270,24 +271,24 @@ public class CCMachineRecipes } } } - catch (Exception e) + catch(Exception e) { CCLog.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1)); } } } - + static void initElectroextractorOreDictionary() { ArrayList dustNames = ItemDust.getDusts(); - for (int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++) + for(int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++) { String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":"); - if (OreDictionary.doesOreNameExist("ore" + entry[0]) && OreDictionary.doesOreNameExist("ingot" + entry[0])) + if(OreDictionary.doesOreNameExist("ore" + entry[0]) && OreDictionary.doesOreNameExist("ingot" + entry[0])) { ArrayList ores = OreDictionary.getOres("ore" + entry[0]); ItemDust.addDustType(entry[0], Integer.parseInt(entry[1])); - for (int j = 0; j < ores.size(); j++) + for(int j = 0; j < ores.size(); j++) ElectroextractorRecipes.getInstance().addRecipe(ores.get(j), new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1)); } @@ -295,22 +296,20 @@ public class CCMachineRecipes { CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] + " could not be registered."); - if (!OreDictionary.doesOreNameExist("ore" + entry[0])) + if(!OreDictionary.doesOreNameExist("ore" + entry[0])) CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0] + "."); - else - if (!OreDictionary.doesOreNameExist("ingot" + entry[0])) - CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] - + "."); + else if(!OreDictionary.doesOreNameExist("ingot" + entry[0])) + CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] + "."); } } - - for (int i = 0; i < dustNames.size(); i++) + + for(int i = 0; i < dustNames.size(); i++) { ItemStack ingot = null; - if (OreDictionary.doesOreNameExist("ingot" + dustNames.get(i))) + if(OreDictionary.doesOreNameExist("ingot" + dustNames.get(i))) ingot = OreDictionary.getOres("ingot" + dustNames.get(i)).get(0); - if (ingot != null) + if(ingot != null) GameRegistry.addSmelting(new ItemStack(CCItems.dusts, 1, i), ingot, 0.0F); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java index fc5e05e..d964a3a 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java @@ -14,44 +14,44 @@ public class CropomatorRecipes private static final CropomatorRecipes recipeBase = new CropomatorRecipes(); public static final ArrayList inputs = new ArrayList(); public static final ArrayList outputs = new ArrayList(); - + private Map recipes = Maps.newHashMap(); - + public static CropomatorRecipes getInstance() { return recipeBase; } - + public void addRecipe(ItemStack input, ItemStack stack) { this.recipes.put(input, stack); inputs.add(input); outputs.add(stack); } - + public ItemStack getResult(ItemStack stack) { Iterator iterator = this.recipes.entrySet().iterator(); Entry entry; - + do { - if (!iterator.hasNext()) + if(!iterator.hasNext()) return null; - + entry = (Entry) iterator.next(); } - while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); - + while(!this.compareItemStacks(stack, (ItemStack) entry.getKey())); + return (ItemStack) entry.getValue(); } - + private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); } - + public Map getRecipeList() { return this.recipes; diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java index 3867e57..ace7f92 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java @@ -16,40 +16,40 @@ public class ElectroextractorRecipes { private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes(); private Map recipes = Maps.newHashMap(); - + public static ElectroextractorRecipes getInstance() { return recipeBase; } - + public void addRecipe(ItemStack input, ItemStack stack) { this.recipes.put(input, stack); } - + public ItemStack getResult(ItemStack stack) { Iterator iterator = this.recipes.entrySet().iterator(); Entry entry; - + do { - if (!iterator.hasNext()) + if(!iterator.hasNext()) return null; - + entry = (Entry) iterator.next(); } - while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); - + while(!this.compareItemStacks(stack, (ItemStack) entry.getKey())); + return (ItemStack) entry.getValue(); } - + private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); } - + public Map getRecipeList() { return this.recipes; diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java index 3ba921c..452946e 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java @@ -16,40 +16,40 @@ public class WoodchipperRecipes { private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes(); private Map recipes = Maps.newHashMap(); - + public static WoodchipperRecipes getInstance() { return recipeBase; } - + public void addRecipe(ItemStack input, ItemStack stack) { this.recipes.put(input, stack); } - + public ItemStack getResult(ItemStack stack) { Iterator iterator = this.recipes.entrySet().iterator(); Entry entry; - + do { - if (!iterator.hasNext()) + if(!iterator.hasNext()) return null; - + entry = (Entry) iterator.next(); } - while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); - + while(!this.compareItemStacks(stack, (ItemStack) entry.getKey())); + return (ItemStack) entry.getValue(); } - + private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); } - + public Map getRecipeList() { return this.recipes; diff --git a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityCropomator.java b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityCropomator.java index 38a0469..9d2ec2d 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityCropomator.java +++ b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityCropomator.java @@ -20,42 +20,45 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory { private static int proTicks = ConfigHandler.cropomatorProcessTime; private static int qty = ConfigHandler.cropomatorOutput; - private static final int[] slotsTop = new int[] { 0 }; - private static final int[] slotsBottom = new int[] { 2, 1 }; - private static final int[] slotsSides = new int[] { 1 }; + private static final int[] slotsTop = new int[] + { 0 }; + private static final int[] slotsBottom = new int[] + { 2, 1 }; + private static final int[] slotsSides = new int[] + { 1 }; private static ArrayList fuelItems = new ArrayList(); - + private ItemStack[] ItemStacks = new ItemStack[3]; - + public int catalystTime; public int processTime; public int catalystInUseTime; - + public static ArrayList getFuels() { return fuelItems; } - + @Override public int getSizeInventory() { return this.ItemStacks.length; } - + @Override public ItemStack getStackInSlot(int slot) { return this.ItemStacks[slot]; } - + @Override public ItemStack decrStackSize(int slot, int qtyToDecr) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack; - - if (this.ItemStacks[slot].stackSize <= qtyToDecr) + + if(this.ItemStacks[slot].stackSize <= qtyToDecr) { itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -64,12 +67,12 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory else { itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); - - if (this.ItemStacks[slot].stackSize == 0) + + if(this.ItemStacks[slot].stackSize == 0) { this.ItemStacks[slot] = null; } - + return itemstack; } } @@ -78,11 +81,11 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory return null; } } - + @Override public ItemStack getStackInSlotOnClosing(int slot) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -93,53 +96,53 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory return null; } } - + @Override public void setInventorySlotContents(int slot, ItemStack itemstack) { this.ItemStacks[slot] = itemstack; - - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + + if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) { itemstack.stackSize = this.getInventoryStackLimit(); } } - + @Override public String getInventoryName() { return "container.cropomator"; } - + @Override public boolean hasCustomInventoryName() { return true; } - + @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); NBTTagList nbttaglist = tag.getTagList("Items", 10); this.ItemStacks = new ItemStack[this.getSizeInventory()]; - - for (int i = 0; i < nbttaglist.tagCount(); ++i) + + for(int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); - - if (b0 >= 0 && b0 < this.ItemStacks.length) + + if(b0 >= 0 && b0 < this.ItemStacks.length) { this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } - + this.catalystTime = tag.getShort("BonemealTime"); this.processTime = tag.getShort("ProcessTime"); this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]); } - + @Override public void writeToNBT(NBTTagCompound tag) { @@ -147,10 +150,10 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory tag.setShort("BonemealTime", (short) this.catalystTime); tag.setShort("ProcessTime", (short) this.processTime); NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.ItemStacks.length; ++i) + + for(int i = 0; i < this.ItemStacks.length; ++i) { - if (this.ItemStacks[i] != null) + if(this.ItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); @@ -158,77 +161,77 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory nbttaglist.appendTag(nbttagcompound1); } } - + tag.setTag("Items", nbttaglist); } - + @Override public int getInventoryStackLimit() { return 64; } - + @SideOnly(Side.CLIENT) public int getProgressScaled(int par1) { return this.processTime * par1 / proTicks; } - + @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(int par1) { - if (this.catalystInUseTime == 0) + if(this.catalystInUseTime == 0) { this.catalystInUseTime = proTicks; } - + return this.catalystTime * par1 / this.catalystInUseTime; } - + public boolean isUsingFuel() { return this.catalystTime > 0; } - + public void updateEntity() { boolean flag = this.catalystTime > 0; boolean flag1 = false; - - if (this.catalystTime > 0) + + if(this.catalystTime > 0) { --this.catalystTime; } - - if (!this.worldObj.isRemote) + + if(!this.worldObj.isRemote) { - if (this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) + if(this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) { - if (this.catalystTime == 0 && this.canProcess()) + if(this.catalystTime == 0 && this.canProcess()) { this.catalystInUseTime = this.catalystTime = getItemBurnTime(this.ItemStacks[1]); - - if (this.catalystTime > 0) + + if(this.catalystTime > 0) { flag1 = true; - - if (this.ItemStacks[1] != null) + + if(this.ItemStacks[1] != null) { --this.ItemStacks[1].stackSize; - - if (this.ItemStacks[1].stackSize == 0) + + if(this.ItemStacks[1].stackSize == 0) { this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); } } } } - - if (this.isUsingFuel() && this.canProcess()) + + if(this.isUsingFuel() && this.canProcess()) { ++this.processTime; - - if (this.processTime == proTicks) + + if(this.processTime == proTicks) { this.processTime = 0; this.processItem(); @@ -240,50 +243,50 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory this.processTime = 0; } } - - if (flag != this.catalystTime > 0) + + if(flag != this.catalystTime > 0) { flag1 = true; BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } - - if (flag1) + + if(flag1) { this.markDirty(); } } - + private boolean canProcess() { ItemStack input = this.ItemStacks[0]; - if (input != null) + if(input != null) { ItemStack output = CropomatorRecipes.getInstance().getResult(input); - if (output == null) + if(output == null) return false; ItemStack outputSlot = this.ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) return true; - if (!outputSlot.isItemEqual(output)) + if(!outputSlot.isItemEqual(output)) return false; int result = outputSlot.stackSize + output.stackSize; return result <= output.getMaxStackSize(); } return false; } - + public static void addFuel(ItemStack itemstack) { fuelItems.add(itemstack); } - + public static boolean removeFuel(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { - if (fuelItems.get(i) == itemstack) + if(fuelItems.get(i) == itemstack) { fuelItems.remove(i); return true; @@ -291,95 +294,94 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory } return false; } - + public static boolean isValid(ItemStack itemstack) { - if (CropomatorRecipes.getInstance().getResult(itemstack) != null) + if(CropomatorRecipes.getInstance().getResult(itemstack) != null) return true; return false; } - + public void processItem() { - if (this.canProcess()) + if(this.canProcess()) { - + ItemStack input = ItemStacks[0]; ItemStack output = CropomatorRecipes.getInstance().getResult(input); ItemStack outputSlot = ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) { ItemStacks[2] = output.copy(); } - else - if (outputSlot.isItemEqual(output)) - { - outputSlot.stackSize += output.stackSize; - } - + else if(outputSlot.isItemEqual(output)) + { + outputSlot.stackSize += output.stackSize; + } + --input.stackSize; - if (input.stackSize <= 0) + if(input.stackSize <= 0) { ItemStacks[0] = null; } } } - + public static int getItemBurnTime(ItemStack itemstack) { return isItemCatalyst(itemstack) ? proTicks : 0; } - + public static boolean isItemCatalyst(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { ItemStack temp = fuelItems.get(i); - if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) + if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) return true; } return false; } - + public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; } - + public void openInventory() { } - + public void closeInventory() { } - + @Override public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 2 ? false : (slot == 1 ? isItemCatalyst(itemstack) : true); } - + @Override public int[] getAccessibleSlotsFromSide(int slot) { return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); } - + @Override public boolean canInsertItem(int slot, ItemStack itemstack, int side) { return this.isItemValidForSlot(slot, itemstack); } - + @Override public boolean canExtractItem(int slot, ItemStack itemstack, int side) { return side != 0 || slot != 1; } - + @Override public void markDirty() { diff --git a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityElectroextractor.java b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityElectroextractor.java index f83c236..0517e76 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityElectroextractor.java +++ b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityElectroextractor.java @@ -22,37 +22,40 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve { private static int proTicks = ConfigHandler.electroextractorProcessTime; private static int qty = ConfigHandler.electroextractorOutput; - private static final int[] slotsTop = new int[] { 0 }; - private static final int[] slotsBottom = new int[] { 2, 1 }; - private static final int[] slotsSides = new int[] { 1 }; + private static final int[] slotsTop = new int[] + { 0 }; + private static final int[] slotsBottom = new int[] + { 2, 1 }; + private static final int[] slotsSides = new int[] + { 1 }; private static ArrayList fuelItems = new ArrayList(); - + private ItemStack[] ItemStacks = new ItemStack[3]; - + public int fuelTime; public int crushTime; public int fuelInUseTime; - + @Override public int getSizeInventory() { return this.ItemStacks.length; } - + @Override public ItemStack getStackInSlot(int slot) { return this.ItemStacks[slot]; } - + @Override public ItemStack decrStackSize(int slot, int qtyToDecr) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack; - - if (this.ItemStacks[slot].stackSize <= qtyToDecr) + + if(this.ItemStacks[slot].stackSize <= qtyToDecr) { itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -61,12 +64,12 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve else { itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); - - if (this.ItemStacks[slot].stackSize == 0) + + if(this.ItemStacks[slot].stackSize == 0) { this.ItemStacks[slot] = null; } - + return itemstack; } } @@ -75,11 +78,11 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve return null; } } - + @Override public ItemStack getStackInSlotOnClosing(int slot) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -90,53 +93,53 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve return null; } } - + @Override public void setInventorySlotContents(int slot, ItemStack itemstack) { this.ItemStacks[slot] = itemstack; - - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + + if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) { itemstack.stackSize = this.getInventoryStackLimit(); } } - + @Override public String getInventoryName() { return "container.electroextractor"; } - + @Override public boolean hasCustomInventoryName() { return true; } - + @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); NBTTagList nbttaglist = tag.getTagList("Items", 10); this.ItemStacks = new ItemStack[this.getSizeInventory()]; - - for (int i = 0; i < nbttaglist.tagCount(); ++i) + + for(int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); - - if (b0 >= 0 && b0 < this.ItemStacks.length) + + if(b0 >= 0 && b0 < this.ItemStacks.length) { this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } - + this.fuelTime = tag.getShort("Energy"); this.crushTime = tag.getShort("CrushTime"); this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]); } - + @Override public void writeToNBT(NBTTagCompound tag) { @@ -144,10 +147,10 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve tag.setShort("Energy", (short) this.fuelTime); tag.setShort("CrushTime", (short) this.crushTime); NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.ItemStacks.length; ++i) + + for(int i = 0; i < this.ItemStacks.length; ++i) { - if (this.ItemStacks[i] != null) + if(this.ItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); @@ -155,77 +158,77 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve nbttaglist.appendTag(nbttagcompound1); } } - + tag.setTag("Items", nbttaglist); } - + @Override public int getInventoryStackLimit() { return 64; } - + @SideOnly(Side.CLIENT) public int getProgressScaled(int par1) { return this.crushTime * par1 / proTicks; } - + @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(int par1) { - if (this.fuelInUseTime == 0) + if(this.fuelInUseTime == 0) { this.fuelInUseTime = proTicks; } - + return this.fuelTime * par1 / this.fuelInUseTime; } - + public boolean isUsingFuel() { return this.fuelTime > 0; } - + public void updateEntity() { boolean flag = this.fuelTime > 0; boolean flag1 = false; - - if (this.fuelTime > 0) + + if(this.fuelTime > 0) { --this.fuelTime; } - - if (!this.worldObj.isRemote) + + if(!this.worldObj.isRemote) { - if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) + if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) { - if (this.fuelTime == 0 && this.canProcess()) + if(this.fuelTime == 0 && this.canProcess()) { this.fuelInUseTime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]); - - if (this.fuelTime > 0) + + if(this.fuelTime > 0) { flag1 = true; - - if (this.ItemStacks[1] != null) + + if(this.ItemStacks[1] != null) { --this.ItemStacks[1].stackSize; - - if (this.ItemStacks[1].stackSize == 0) + + if(this.ItemStacks[1].stackSize == 0) { this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); } } } } - - if (this.isUsingFuel() && this.canProcess()) + + if(this.isUsingFuel() && this.canProcess()) { ++this.crushTime; - - if (this.crushTime == proTicks) + + if(this.crushTime == proTicks) { this.crushTime = 0; this.processItem(); @@ -237,50 +240,50 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve this.crushTime = 0; } } - - if (flag != this.fuelTime > 0) + + if(flag != this.fuelTime > 0) { flag1 = true; BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } - - if (flag1) + + if(flag1) { this.markDirty(); } } - + private boolean canProcess() { ItemStack input = this.ItemStacks[0]; - if (input != null) + if(input != null) { ItemStack output = ElectroextractorRecipes.getInstance().getResult(input); - if (output == null) + if(output == null) return false; ItemStack outputSlot = this.ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) return true; - if (!outputSlot.isItemEqual(output)) + if(!outputSlot.isItemEqual(output)) return false; int result = outputSlot.stackSize + output.stackSize; return result <= output.getMaxStackSize(); } return false; } - + public static void addFuel(ItemStack itemstack) { fuelItems.add(itemstack); } - + public static boolean removeFuel(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { - if (fuelItems.get(i) == itemstack) + if(fuelItems.get(i) == itemstack) { fuelItems.remove(i); return true; @@ -288,95 +291,94 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve } return false; } - + public static boolean isValid(ItemStack itemstack) { - if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null) + if(ElectroextractorRecipes.getInstance().getResult(itemstack) != null) return true; return false; } - + public void processItem() { - if (this.canProcess()) + if(this.canProcess()) { - + ItemStack input = ItemStacks[0]; ItemStack output = ElectroextractorRecipes.getInstance().getResult(input); ItemStack outputSlot = ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) { ItemStacks[2] = output.copy(); } - else - if (outputSlot.isItemEqual(output)) - { - outputSlot.stackSize += output.stackSize; - } - + else if(outputSlot.isItemEqual(output)) + { + outputSlot.stackSize += output.stackSize; + } + --input.stackSize; - if (input.stackSize <= 0) + if(input.stackSize <= 0) { ItemStacks[0] = null; } } } - + public static int getItemBurnTime(ItemStack itemstack) { return isItemEnergetic(itemstack) ? proTicks : 0; } - + public static boolean isItemEnergetic(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { ItemStack temp = fuelItems.get(i); - if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) + if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) return true; } return false; } - + public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; } - + public void openInventory() { } - + public void closeInventory() { } - + @Override public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 2 ? false : (slot == 1 ? isItemEnergetic(itemstack) : true); } - + @Override public int[] getAccessibleSlotsFromSide(int slot) { return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); } - + @Override public boolean canInsertItem(int slot, ItemStack itemstack, int side) { return this.isItemValidForSlot(slot, itemstack); } - + @Override public boolean canExtractItem(int slot, ItemStack itemstack, int side) { return side != 0 || slot != 1; } - + @Override public void markDirty() { diff --git a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityWoodchipper.java b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityWoodchipper.java index f2fd31a..77038e7 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityWoodchipper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/TileEntity/TileEntityWoodchipper.java @@ -19,42 +19,45 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory { private static int proTicks = ConfigHandler.woodchipperProcessTime; private static int qty = ConfigHandler.woodchipperOutput; - private static final int[] slotsTop = new int[] { 0 }; - private static final int[] slotsBottom = new int[] { 2, 1 }; - private static final int[] slotsSides = new int[] { 1 }; + private static final int[] slotsTop = new int[] + { 0 }; + private static final int[] slotsBottom = new int[] + { 2, 1 }; + private static final int[] slotsSides = new int[] + { 1 }; private static ArrayList fuelItems = new ArrayList(); - + private ItemStack[] ItemStacks = new ItemStack[3]; - + public int fuelTime; public int processTime; public int fuelUsetime; - + public static ArrayList getFuels() { return fuelItems; } - + @Override public int getSizeInventory() { return this.ItemStacks.length; } - + @Override public ItemStack getStackInSlot(int slot) { return this.ItemStacks[slot]; } - + @Override public ItemStack decrStackSize(int slot, int qtyToDecr) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack; - - if (this.ItemStacks[slot].stackSize <= qtyToDecr) + + if(this.ItemStacks[slot].stackSize <= qtyToDecr) { itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -63,12 +66,12 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory else { itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); - - if (this.ItemStacks[slot].stackSize == 0) + + if(this.ItemStacks[slot].stackSize == 0) { this.ItemStacks[slot] = null; } - + return itemstack; } } @@ -77,11 +80,11 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory return null; } } - + @Override public ItemStack getStackInSlotOnClosing(int slot) { - if (this.ItemStacks[slot] != null) + if(this.ItemStacks[slot] != null) { ItemStack itemstack = this.ItemStacks[slot]; this.ItemStacks[slot] = null; @@ -92,53 +95,53 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory return null; } } - + @Override public void setInventorySlotContents(int slot, ItemStack itemstack) { this.ItemStacks[slot] = itemstack; - - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + + if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) { itemstack.stackSize = this.getInventoryStackLimit(); } } - + @Override public String getInventoryName() { return "container.woodchipper"; } - + @Override public boolean hasCustomInventoryName() { return true; } - + @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); NBTTagList nbttaglist = tag.getTagList("Items", 10); this.ItemStacks = new ItemStack[this.getSizeInventory()]; - - for (int i = 0; i < nbttaglist.tagCount(); ++i) + + for(int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); - - if (b0 >= 0 && b0 < this.ItemStacks.length) + + if(b0 >= 0 && b0 < this.ItemStacks.length) { this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } - + this.fuelTime = tag.getShort("FuelTime"); this.processTime = tag.getShort("WorkTime"); this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]); } - + @Override public void writeToNBT(NBTTagCompound tag) { @@ -146,10 +149,10 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory tag.setShort("FuelTime", (short) this.fuelTime); tag.setShort("WorkTime", (short) this.processTime); NBTTagList nbttaglist = new NBTTagList(); - - for (int i = 0; i < this.ItemStacks.length; ++i) + + for(int i = 0; i < this.ItemStacks.length; ++i) { - if (this.ItemStacks[i] != null) + if(this.ItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); @@ -157,77 +160,77 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory nbttaglist.appendTag(nbttagcompound1); } } - + tag.setTag("Items", nbttaglist); } - + @Override public int getInventoryStackLimit() { return 64; } - + @SideOnly(Side.CLIENT) public int getProgressScaled(int par1) { return this.processTime * par1 / proTicks; } - + @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(int par1) { - if (this.fuelUsetime == 0) + if(this.fuelUsetime == 0) { this.fuelUsetime = proTicks; } - + return this.fuelTime * par1 / this.fuelUsetime; } - + public boolean isUsingFuel() { return this.fuelTime > 0; } - + public void updateEntity() { boolean flag = this.fuelTime > 0; boolean flag1 = false; - - if (this.fuelTime > 0) + + if(this.fuelTime > 0) { --this.fuelTime; } - - if (!this.worldObj.isRemote) + + if(!this.worldObj.isRemote) { - if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) + if(this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null) { - if (this.fuelTime == 0 && this.canProcess()) + if(this.fuelTime == 0 && this.canProcess()) { this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]); - - if (this.fuelTime > 0) + + if(this.fuelTime > 0) { flag1 = true; - - if (this.ItemStacks[1] != null) + + if(this.ItemStacks[1] != null) { --this.ItemStacks[1].stackSize; - - if (this.ItemStacks[1].stackSize == 0) + + if(this.ItemStacks[1].stackSize == 0) { this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]); } } } } - - if (this.isUsingFuel() && this.canProcess()) + + if(this.isUsingFuel() && this.canProcess()) { ++this.processTime; - - if (this.processTime == proTicks) + + if(this.processTime == proTicks) { this.processTime = 0; this.processItem(); @@ -239,50 +242,50 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory this.processTime = 0; } } - - if (flag != this.fuelTime > 0) + + if(flag != this.fuelTime > 0) { flag1 = true; BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } - - if (flag1) + + if(flag1) { this.markDirty(); } } - + private boolean canProcess() { ItemStack input = this.ItemStacks[0]; - if (input != null) + if(input != null) { ItemStack output = WoodchipperRecipes.getInstance().getResult(input); - if (output == null) + if(output == null) return false; ItemStack outputSlot = this.ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) return true; - if (!outputSlot.isItemEqual(output)) + if(!outputSlot.isItemEqual(output)) return false; int result = outputSlot.stackSize + output.stackSize; return result <= output.getMaxStackSize(); } return false; } - + public static void addFuel(ItemStack itemstack) { fuelItems.add(itemstack); } - + public static boolean removeFuel(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { - if (fuelItems.get(i) == itemstack) + if(fuelItems.get(i) == itemstack) { fuelItems.remove(i); return true; @@ -290,119 +293,118 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory } return false; } - + public static boolean isValidForWoodchipper(ItemStack itemstack) { - if (WoodchipperRecipes.getInstance().getResult(itemstack) != null) + if(WoodchipperRecipes.getInstance().getResult(itemstack) != null) return true; return false; } - + public void processItem() { - if (this.canProcess()) + if(this.canProcess()) { - + ItemStack input = ItemStacks[0]; ItemStack output = WoodchipperRecipes.getInstance().getResult(input); ItemStack outputSlot = ItemStacks[2]; - if (outputSlot == null) + if(outputSlot == null) { ItemStacks[2] = output.copy(); } - else - if (outputSlot.isItemEqual(output)) - { - outputSlot.stackSize += output.stackSize; - } - + else if(outputSlot.isItemEqual(output)) + { + outputSlot.stackSize += output.stackSize; + } + --input.stackSize; - if (input.stackSize <= 0) + if(input.stackSize <= 0) { ItemStacks[0] = null; } } } - + public static int getItemBurnTime(ItemStack itemstack) { return isItemFuel(itemstack) ? proTicks : 0; } - + public static boolean isItemFuel(ItemStack itemstack) { - for (int i = 0; i < fuelItems.size(); i++) + for(int i = 0; i < fuelItems.size(); i++) { ItemStack temp = fuelItems.get(i); - if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) + if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) return true; } return false; } - + public boolean isUseableByPlayer(EntityPlayer player) { - + return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; } - + public void openInventory() { } - + public void closeInventory() { } - + @Override public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true); } - + @Override public int[] getAccessibleSlotsFromSide(int slot) { return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); } - + @Override public boolean canInsertItem(int slot, ItemStack itemstack, int side) { return this.isItemValidForSlot(slot, itemstack); } - + @Override public boolean canExtractItem(int slot, ItemStack itemstack, int side) { return side != 0 || slot != 1; } - + @Override public void markDirty() { } - + public static class WoodchipperRecipe { public final int time; public final ItemStack input; public final ItemStack result; - + public WoodchipperRecipe(ItemStack input, ItemStack result) { this.time = ConfigHandler.woodchipperProcessTime; this.input = input; this.result = result; } - + public boolean matches(ItemStack input) { return ItemStack.areItemStacksEqual(this.input, input); } - + public ItemStack getResult() { return result.copy(); diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/CCLog.java b/src/main/java/com/oitsjustjose/criss_cross/Util/CCLog.java index 8721ff6..f650cbf 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/CCLog.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/CCLog.java @@ -6,27 +6,27 @@ import org.apache.logging.log4j.Logger; public class CCLog { private static Logger LOGGER = LogManager.getLogger(Reference.modid); - + public CCLog() { - + } - + public static void warn(String msg) { LOGGER.warn(msg); } - + public static void error(String msg) { LOGGER.error(msg); } - + public static void info(String msg) { LOGGER.info(msg); } - + public static void debug(String msg) { LOGGER.debug(msg); diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/CCTab.java b/src/main/java/com/oitsjustjose/criss_cross/Util/CCTab.java index 49953bc..93ff38e 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/CCTab.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/CCTab.java @@ -11,11 +11,11 @@ public class CCTab extends CreativeTabs { super(CreativeTabs.getNextID(), "tab" + Reference.modid); } - + @Override public Item getTabIconItem() { return Item.getItemFromBlock(CCBlocks.electroextractor); } - + } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/ClientProxy.java b/src/main/java/com/oitsjustjose/criss_cross/Util/ClientProxy.java index 90b18c0..9979c5b 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/ClientProxy.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/ClientProxy.java @@ -5,12 +5,12 @@ public class ClientProxy extends CommonProxy @Override public void preInit() { - + } - + @Override public void init() { - + } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/CommonProxy.java b/src/main/java/com/oitsjustjose/criss_cross/Util/CommonProxy.java index 831ad34..f480f00 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/CommonProxy.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/CommonProxy.java @@ -5,7 +5,7 @@ public class CommonProxy public void preInit() { }; - + public void init() { }; diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/ConfigHandler.java b/src/main/java/com/oitsjustjose/criss_cross/Util/ConfigHandler.java index 89b5b0c..daaba02 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/ConfigHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/ConfigHandler.java @@ -15,39 +15,44 @@ public class ConfigHandler public static String cropomatorRecipeItem; public static String[] cropomatorInputs; public static String[] cropomatorCatalysts; - public static String[] defaultCropomatorInputs = new String[] { "minecraft:apple", "minecraft:reeds", - "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus", "minecraft:potato", "minecraft:sapling:0", - "minecraft:sapling:1", "minecraft:sapling:2", "minecraft:sapling:3", "minecraft:sapling:4", - "minecraft:sapling:5", "minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom", - "minecraft:cocoa", "minecraft:pumpkin", "minecraft:wheat", "minecraft:wheat_seeds" }; - public static String[] defaultCropomatorCatalystItems = new String[] { "minecraft:dye:15" }; - + public static String[] defaultCropomatorInputs = new String[] + { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus", + "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2", + "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon", + "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:cocoa", "minecraft:pumpkin", + "minecraft:wheat", "minecraft:wheat_seeds" }; + public static String[] defaultCropomatorCatalystItems = new String[] + { "minecraft:dye:15" }; + public static int electroextractorProcessTime; public static int electroextractorOutput; public static String electroextractorRecipeItem; public static String[] electroextractorEnergySources; public static String[] electroextractorOreDictInputs; - public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:15400704", - "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", - "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" }; - public static String[] defaultElectroextractorEnergySources = new String[] { "minecraft:redstone_block" }; - + public static String[] defaultElectroextractorOreDictInputs = new String[] + { "Iron:12428902", "Gold:15400704", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", + "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", + "Nickel:16580553" }; + public static String[] defaultElectroextractorEnergySources = new String[] + { "minecraft:redstone_block" }; + public static int woodchipperProcessTime; public static int woodchipperOutput; public static String woodchipperRecipeItem; public static String[] woodchipperFuels; - public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0" }; - + public static String[] defaultWoodchipperFuels = new String[] + { "minecraft:water_bucket", "minecraft:potion:0" }; + public static void init(File configFile) { // Create the configuration object from the given configuration file - if (config == null) + if(config == null) { config = new Configuration(configFile); loadConfiguration(); } } - + private static void loadConfiguration() { // Cropomator Configs @@ -55,40 +60,40 @@ public class ConfigHandler .get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs, "A list of items to be added to the Cropomator's recipe list. Formatted as: :: or :.") .getStringList(); - + cropomatorCatalysts = config .get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems, "A list of items to be added to the Cropomator's catalyst list. Formatted as: :: or :.") .getStringList(); - + cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1, Short.MAX_VALUE, "Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200."); - + cropomatorOutput = config.getInt("Cropomator Output Quantity", config.CATEGORY_GENERAL, 3, 0, 64, "Control how many of the input item you get as the output item. Default is 3."); - + cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: :: or :."); - + // Electroextractor's Configs electroextractorEnergySources = config .get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources, "A list of items to be added as the Electroextractor's energy sources. Formatted as: :: or :.") .getStringList(); - + electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0, Short.MAX_VALUE, "Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200."); - + electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64, "Control how many dusts you get as the output. Default is 2."); - + electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: :: or :."); - + electroextractorOreDictInputs = config .get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.", defaultElectroextractorOreDictInputs, @@ -97,32 +102,32 @@ public class ConfigHandler + "\n" + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.") .getStringList(); - + // Woodchipper's Configs woodchipperFuels = config .get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels, "A list of items to be added as the Woodchipper's 'fuels'. Formatted as: :: or :.") .getStringList(); - + woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0, Short.MAX_VALUE, "Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200."); - + woodchipperOutput = config.getInt("Woodchipper Output Quantity", config.CATEGORY_GENERAL, 6, 0, 64, "Control how many planks are yielded from processing a log. Default is 6."); - + woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: :: or :."); - - if (config.hasChanged()) + + if(config.hasChanged()) config.save(); } - + @SubscribeEvent public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { - if (event.modID.equalsIgnoreCase(Reference.modid)) + if(event.modID.equalsIgnoreCase(Reference.modid)) loadConfiguration(); } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/ItemHelper.java b/src/main/java/com/oitsjustjose/criss_cross/Util/ItemHelper.java index 380d0af..6ef2339 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/ItemHelper.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/ItemHelper.java @@ -11,77 +11,77 @@ import net.minecraft.world.World; /** * - * @author TeamCoFH - * All credit goes to TeamCoFH, this was required for proper woodchipper recipes :) - * + * @author TeamCoFH All credit goes to TeamCoFH, this was required for proper + * woodchipper recipes :) + * */ public class ItemHelper { public static ItemStack cloneStack(Item item, int stackSize) { - - if (item == null) + + if(item == null) { return null; } ItemStack stack = new ItemStack(item, stackSize); - + return stack; } - + public static ItemStack cloneStack(Block item, int stackSize) { - - if (item == null) + + if(item == null) { return null; } ItemStack stack = new ItemStack(item, stackSize); - + return stack; } - + public static ItemStack cloneStack(ItemStack stack, int stackSize) { - - if (stack == null) + + if(stack == null) { return null; } ItemStack retStack = stack.copy(); retStack.stackSize = stackSize; - + return retStack; } - + public static ItemStack cloneStack(ItemStack stack) { - - if (stack == null) + + if(stack == null) { return null; } ItemStack retStack = stack.copy(); - + return retStack; } - + public static int getItemDamage(ItemStack stack) { - + return Items.diamond.getDamage(stack); } - + public static ItemStack findMatchingRecipe(InventoryCrafting inv, World world) { - + ItemStack[] dmgItems = new ItemStack[2]; - for (int i = 0; i < inv.getSizeInventory(); i++) + for(int i = 0; i < inv.getSizeInventory(); i++) { - if (inv.getStackInSlot(i) != null) + if(inv.getStackInSlot(i) != null) { - if (dmgItems[0] == null) + if(dmgItems[0] == null) { dmgItems[0] = inv.getStackInSlot(i); } @@ -92,35 +92,34 @@ public class ItemHelper } } } - if (dmgItems[0] == null || dmgItems[0].getItem() == null) + if(dmgItems[0] == null || dmgItems[0].getItem() == null) { return null; } + else if(dmgItems[1] != null && dmgItems[0].getItem() == dmgItems[1].getItem() && dmgItems[0].stackSize == 1 + && dmgItems[1].stackSize == 1 && dmgItems[0].getItem().isRepairable()) + { + Item theItem = dmgItems[0].getItem(); + int var13 = theItem.getMaxDamage() - dmgItems[0].getItemDamageForDisplay(); + int var8 = theItem.getMaxDamage() - dmgItems[1].getItemDamageForDisplay(); + int var9 = var13 + var8 + theItem.getMaxDamage() * 5 / 100; + int var10 = Math.max(0, theItem.getMaxDamage() - var9); + + return new ItemStack(dmgItems[0].getItem(), 1, var10); + } else - if (dmgItems[1] != null && dmgItems[0].getItem() == dmgItems[1].getItem() && dmgItems[0].stackSize == 1 - && dmgItems[1].stackSize == 1 && dmgItems[0].getItem().isRepairable()) + { + IRecipe recipe; + for(int i = 0; i < CraftingManager.getInstance().getRecipeList().size(); i++) { - Item theItem = dmgItems[0].getItem(); - int var13 = theItem.getMaxDamage() - dmgItems[0].getItemDamageForDisplay(); - int var8 = theItem.getMaxDamage() - dmgItems[1].getItemDamageForDisplay(); - int var9 = var13 + var8 + theItem.getMaxDamage() * 5 / 100; - int var10 = Math.max(0, theItem.getMaxDamage() - var9); - - return new ItemStack(dmgItems[0].getItem(), 1, var10); - } - else - { - IRecipe recipe; - for (int i = 0; i < CraftingManager.getInstance().getRecipeList().size(); i++) + recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i); + + if(recipe.matches(inv, world)) { - recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i); - - if (recipe.matches(inv, world)) - { - return recipe.getCraftingResult(inv); - } + return recipe.getCraftingResult(inv); } - return null; } + return null; + } } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/Util/OreDictionaryAdder.java b/src/main/java/com/oitsjustjose/criss_cross/Util/OreDictionaryAdder.java index b4a1f59..dc358a9 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Util/OreDictionaryAdder.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Util/OreDictionaryAdder.java @@ -13,8 +13,8 @@ public class OreDictionaryAdder public static void init() { ArrayList dustNames = ItemDust.getDusts(); - - for (int i = 0; i < dustNames.size(); i++) + + for(int i = 0; i < dustNames.size(); i++) OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(CCItems.dusts, 1, i)); } } \ No newline at end of file diff --git a/src/main/resources/assets/crisscross/lang/en_US.lang b/src/main/resources/assets/crisscross/lang/en_US.lang index 0b8f254..b299952 100644 --- a/src/main/resources/assets/crisscross/lang/en_US.lang +++ b/src/main/resources/assets/crisscross/lang/en_US.lang @@ -18,6 +18,9 @@ item.CrissCross.Mithril.name=Electrolytic Mithril Dust item.CrissCross.Nickel.name=Electrolytic Nickel Dust item.CrissCross.trash.name=This is a bad item, please trash it. +item.CrissCross.everfulBucket.name=Everful Bucket +item.CrissCross.voidBucket.name=Insatiable Bucket + #Containers container.cropomator=Cropomator container.electroextractor=ElectroExtractor diff --git a/src/main/resources/assets/crisscross/textures/items/everfulBucket.png b/src/main/resources/assets/crisscross/textures/items/everfulBucket.png new file mode 100644 index 0000000000000000000000000000000000000000..4053edc23a43c9903909b13b6689a23aa40ee8c3 GIT binary patch literal 1130 zcmV-w1eN=VP)KLZ*U+R`sCEkzKl)gj5&q@hY_5?)@_euSf22N!q0z{yc?Q2YY_Kym8e z5Fvwu2%hQO!{u_psMvL#(bD64NQRTZj^-}DnS22ry9f-;mW=gZvQj}U-ZdMsK&I8^7~DvX`q=i45eFZ$AE82hgVc6;*bv6F3Zsla(aP+iw-#o=@3HkIW%{@yWD&E z*CN#XAn-1{_j|wl-S78#-$yv-n8xNXrA3@UE|&vi3;>{Mnj4m)DDGs&7zsKc-dAuI zUVlmvjotK3ynp8ke$;XUjw0U0k%w=k;od8pMX2jK@#R2K6r3Eaxs$t{U!hL+)-`bw z-`8}U9IT=Jr5L(!Z(YNUrJe93Iz}l402GUUCy!t0NFHrrw+*=i08mvGlu~?dskq&# z0RWnRhSULLjI6%Np);=vlW18Met*g$v8)qmA(^HLRaNoi0s6ZakUZKNtrBBBb7=K# zzZ4Wwzan|1QgNRR!+>qu0Dx+>3g`PvU!h*FyJKgu$VgZ>dV9fZ!QBA>oO5u_kAj-l2#sf;}P#&byX>k%e^Qw>srBVq1u-je&&=`#ehGDq>i8@lsgP*a& z01v)>U7d~x*SgK~twf&#=QW%tg4Sp>pzAvE0!7M$SkHuQ+d`bpcrfF^#qdC;4;&s? zmL&&DtY?Puz&YZ+Uw!QZ%E(_`g8%^e{{R4h=l}px2mk>USO5SzmjD14Z`WEM zkN^My2}wjjRCwB~Q=x9dFc5t=Rg2UX6|I`dHefIk5|~d3$Y7?|WPmcepYpLqbGcOp=6U2_d+ywPw(uoH!xk z#;AM5Y&siFdVYDr*Zz%(hQ5hAb^Cb_0EiZTxewFVZ|r*yfJQqILSVi;FnG7$c}dor z)#W8Br7&L}&_y5K#`R`}G)?_WbV&dp%QAGwpL(9>003)km;eBzlu$~cX&SDzZ5#H1 z)|!f<2>!XX7FAWDu4@V!$ruAECE_>^PQQs0M+ELOj4@~6-|{aiD9iHC