Working on a few handy things!

This commit is contained in:
oitsjustjose 2015-10-27 13:25:56 -04:00
commit ec8bf102bb
44 changed files with 1152 additions and 1014 deletions

View file

@ -23,14 +23,14 @@ import net.minecraft.world.World;
public class BlockCropomator extends BlockMachineBase public class BlockCropomator extends BlockMachineBase
{ {
private static String unlocName = "Cropomator"; private static String unlocName = "Cropomator";
public BlockCropomator() public BlockCropomator()
{ {
super(unlocName); super(unlocName);
GameRegistry.registerTileEntity(TileEntityCropomator.class, unlocName); GameRegistry.registerTileEntity(TileEntityCropomator.class, unlocName);
GameRegistry.registerBlock(this, unlocName); GameRegistry.registerBlock(this, unlocName);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) 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[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(x, y, z); 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); ItemStack itemstack = tile.getStackInSlot(i);
if (itemstack != null) if(itemstack != null)
{ {
float f = random.nextFloat() * 0.8F + 0.1F; float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F;
float f2 = 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; int j = random.nextInt(21) + 10;
if (j > itemstack.stackSize) if(j > itemstack.stackSize)
{ {
j = itemstack.stackSize; j = itemstack.stackSize;
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2), (double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if(itemstack.hasTagCompound())
{ {
entityitem.getEntityItem() entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); 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); world.func_147453_f(x, y, z, block);
} }
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TileEntityCropomator(); return new TileEntityCropomator();
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) float hitY, float hitZ)
{ {
if (world.isRemote) if(world.isRemote)
{ {
return true; return true;
} }
else else
{ {
TileEntityCropomator tilecropomator = (TileEntityCropomator) world.getTileEntity(x, y, z); TileEntityCropomator tilecropomator = (TileEntityCropomator) world.getTileEntity(x, y, z);
if (tilecropomator != null) if(tilecropomator != null)
player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z); player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z);
return true; return true;
} }

View file

@ -23,14 +23,14 @@ import net.minecraft.world.World;
public class BlockElectroextractor extends BlockMachineBase public class BlockElectroextractor extends BlockMachineBase
{ {
private static String unlocName = "ElectroExtractor"; private static String unlocName = "ElectroExtractor";
public BlockElectroextractor() public BlockElectroextractor()
{ {
super(unlocName); super(unlocName);
GameRegistry.registerTileEntity(TileEntityElectroextractor.class, unlocName); GameRegistry.registerTileEntity(TileEntityElectroextractor.class, unlocName);
GameRegistry.registerBlock(this, unlocName); GameRegistry.registerBlock(this, unlocName);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) 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[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TileEntityElectroextractor(); return new TileEntityElectroextractor();
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(x, y, z); 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); ItemStack itemstack = tile.getStackInSlot(i);
if (itemstack != null) if(itemstack != null)
{ {
float f = random.nextFloat() * 0.8F + 0.1F; float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F;
float f2 = 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; int j = random.nextInt(21) + 10;
if (j > itemstack.stackSize) if(j > itemstack.stackSize)
{ {
j = itemstack.stackSize; j = itemstack.stackSize;
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2), (double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if(itemstack.hasTagCompound())
{ {
entityitem.getEntityItem() entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); 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); world.func_147453_f(x, y, z, block);
} }
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) float hitY, float hitZ)
{ {
if (world.isRemote) if(world.isRemote)
{ {
return true; return true;
} }
else else
{ {
TileEntityElectroextractor tileext = (TileEntityElectroextractor) world.getTileEntity(x, y, z); TileEntityElectroextractor tileext = (TileEntityElectroextractor) world.getTileEntity(x, y, z);
if (tileext != null) if(tileext != null)
player.openGui(CrissCross.instance, GUIHandler.Electroextractor, world, x, y, z); player.openGui(CrissCross.instance, GUIHandler.Electroextractor, world, x, y, z);
return true; return true;
} }

View file

@ -23,7 +23,7 @@ public class BlockMachineBase extends BlockContainer
IIcon[] blockTextures = new IIcon[4]; IIcon[] blockTextures = new IIcon[4];
private static String unlocalizedName; private static String unlocalizedName;
private static boolean isActive = false; private static boolean isActive = false;
public BlockMachineBase(String unlocName) public BlockMachineBase(String unlocName)
{ {
super(Material.rock); // 0 - Top super(Material.rock); // 0 - Top
@ -32,111 +32,111 @@ public class BlockMachineBase extends BlockContainer
this.setStepSound(soundTypeMetal); // 4 - Sides this.setStepSound(soundTypeMetal); // 4 - Sides
this.setBlockName(Reference.modid + "." + unlocName); this.setBlockName(Reference.modid + "." + unlocName);
this.setCreativeTab(CrissCross.CCTab); this.setCreativeTab(CrissCross.CCTab);
this.unlocalizedName = unlocName; this.unlocalizedName = unlocName;
} }
// Used for the ItemStack vs. In-world Rendering // Used for the ItemStack vs. In-world Rendering
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) public IIcon getIcon(int side, int meta)
{ {
if (side == 0) if(side == 0)
return blockTextures[0]; return blockTextures[0];
if (side == 1) if(side == 1)
return blockTextures[1]; return blockTextures[1];
if (side == 3) if(side == 3)
return blockTextures[2]; return blockTextures[2];
return blockTextures[3]; return blockTextures[3];
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side)
{ {
if (side == 0) if(side == 0)
return blockTextures[0]; return blockTextures[0];
if (side == 1) if(side == 1)
return blockTextures[1]; return blockTextures[1];
if (side == access.getBlockMetadata(x, y, z)) if(side == access.getBlockMetadata(x, y, z))
return blockTextures[2]; return blockTextures[2];
return blockTextures[3]; return blockTextures[3];
} }
@Override @Override
public void onBlockAdded(World world, int x, int y, int z) public void onBlockAdded(World world, int x, int y, int z)
{ {
super.onBlockAdded(world, x, y, z); super.onBlockAdded(world, x, y, z);
setMetadataForFront(world, x, y, z); setMetadataForFront(world, x, y, z);
} }
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) 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; 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); world.setBlockMetadataWithNotify(x, y, z, 2, 2);
} }
if (l == 1) if(l == 1)
{ {
world.setBlockMetadataWithNotify(x, y, z, 5, 2); world.setBlockMetadataWithNotify(x, y, z, 5, 2);
} }
if (l == 2) if(l == 2)
{ {
world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 3, 2);
} }
if (l == 3) if(l == 3)
{ {
world.setBlockMetadataWithNotify(x, y, z, 4, 2); world.setBlockMetadataWithNotify(x, y, z, 4, 2);
} }
} }
private void setMetadataForFront(World world, int x, int y, int z) 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 block = world.getBlock(x, y, z - 1);
Block block1 = world.getBlock(x, y, z + 1); Block block1 = world.getBlock(x, y, z + 1);
Block block2 = world.getBlock(x - 1, y, z); Block block2 = world.getBlock(x - 1, y, z);
Block block3 = world.getBlock(x + 1, y, z); Block block3 = world.getBlock(x + 1, y, z);
byte b0 = 3; byte b0 = 3;
if (block.func_149730_j() && !block1.func_149730_j()) if(block.func_149730_j() && !block1.func_149730_j())
{ {
b0 = 3; b0 = 3;
} }
if (block1.func_149730_j() && !block.func_149730_j()) if(block1.func_149730_j() && !block.func_149730_j())
{ {
b0 = 2; b0 = 2;
} }
if (block2.func_149730_j() && !block3.func_149730_j()) if(block2.func_149730_j() && !block3.func_149730_j())
{ {
b0 = 5; b0 = 5;
} }
if (block3.func_149730_j() && !block2.func_149730_j()) if(block3.func_149730_j() && !block2.func_149730_j())
{ {
b0 = 4; b0 = 4;
} }
world.setBlockMetadataWithNotify(x, y, z, b0, 2); world.setBlockMetadataWithNotify(x, y, z, b0, 2);
} }
} }
public static void updateBlockState(boolean active, World world, int x, int y, int z) public static void updateBlockState(boolean active, World world, int x, int y, int z)
{ {
isActive = active; isActive = active;
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {

View file

@ -22,14 +22,14 @@ import net.minecraft.world.World;
public class BlockWoodchipper extends BlockMachineBase public class BlockWoodchipper extends BlockMachineBase
{ {
private static String unlocName = "WoodChipper"; private static String unlocName = "WoodChipper";
public BlockWoodchipper() public BlockWoodchipper()
{ {
super(unlocName); super(unlocName);
GameRegistry.registerTileEntity(TileEntityWoodchipper.class, unlocName); GameRegistry.registerTileEntity(TileEntityWoodchipper.class, unlocName);
GameRegistry.registerBlock(this, unlocName); GameRegistry.registerBlock(this, unlocName);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) 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[2] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Front");
blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides"); blockTextures[3] = register.registerIcon(Reference.modid + ":" + this.unlocName + "/" + unlocName + "_Sides");
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) public TileEntity createNewTileEntity(World world, int meta)
{ {
return new TileEntityWoodchipper(); return new TileEntityWoodchipper();
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(x, y, z); 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); ItemStack itemstack = tile.getStackInSlot(i);
if (itemstack != null) if(itemstack != null)
{ {
float f = random.nextFloat() * 0.8F + 0.1F; float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F; float f1 = random.nextFloat() * 0.8F + 0.1F;
float f2 = 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; int j = random.nextInt(21) + 10;
if (j > itemstack.stackSize) if(j > itemstack.stackSize)
{ {
j = itemstack.stackSize; j = itemstack.stackSize;
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2), (double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if(itemstack.hasTagCompound())
{ {
entityitem.getEntityItem() entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double) ((float) random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F); 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); world.func_147453_f(x, y, z, block);
} }
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) float hitY, float hitZ)
{ {
if (world.isRemote) if(world.isRemote)
{ {
return true; return true;
} }
else else
{ {
TileEntityWoodchipper tileext = (TileEntityWoodchipper) world.getTileEntity(x, y, z); TileEntityWoodchipper tileext = (TileEntityWoodchipper) world.getTileEntity(x, y, z);
if (tileext != null) if(tileext != null)
player.openGui(CrissCross.instance, GUIHandler.Woodchipper, world, x, y, z); player.openGui(CrissCross.instance, GUIHandler.Woodchipper, world, x, y, z);
return true; return true;
} }

View file

@ -22,13 +22,13 @@ public class CCBlocks
public static Block cropomator; public static Block cropomator;
public static Block electroextractor; public static Block electroextractor;
public static Block woodchipper; public static Block woodchipper;
public static void init() public static void init()
{ {
cropomator = new BlockCropomator(); cropomator = new BlockCropomator();
electroextractor = new BlockElectroextractor(); electroextractor = new BlockElectroextractor();
woodchipper = new BlockWoodchipper(); woodchipper = new BlockWoodchipper();
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
} }
} }

View file

@ -17,45 +17,45 @@ public class ContainerCropomator extends Container
{ {
TileEntityCropomator cropomator; TileEntityCropomator cropomator;
EntityPlayer player; EntityPlayer player;
private int lastUseTime; private int lastUseTime;
private int lastProcessTime; private int lastProcessTime;
private int lastCatalystInUseTime; private int lastCatalystInUseTime;
public ContainerCropomator(EntityPlayer player, TileEntityCropomator cropomator) public ContainerCropomator(EntityPlayer player, TileEntityCropomator cropomator)
{ {
this.player = player; this.player = player;
this.cropomator = cropomator; this.cropomator = cropomator;
lastUseTime = 0; lastUseTime = 0;
lastProcessTime = 0; lastProcessTime = 0;
lastCatalystInUseTime = 0; lastCatalystInUseTime = 0;
this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); // input this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); // catalyst this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); // catalyst
this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
if (timeType1 == 0) if(timeType1 == 0)
{ {
this.cropomator.processTime = timeType2; this.cropomator.processTime = timeType2;
} }
if (timeType1 == 1) if(timeType1 == 1)
{ {
this.cropomator.catalystTime = timeType2; this.cropomator.catalystTime = timeType2;
} }
if (timeType1 == 2) if(timeType1 == 2)
{ {
this.cropomator.catalystInUseTime = timeType2; this.cropomator.catalystInUseTime = timeType2;
} }
} }
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) public void addCraftingToCrafters(ICrafting crafting)
{ {
@ -64,86 +64,81 @@ public class ContainerCropomator extends Container
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime); crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime); crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
} }
@Override @Override
public void detectAndSendChanges() public void detectAndSendChanges()
{ {
super.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); 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); 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); 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); crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
} }
this.lastUseTime = this.cropomator.processTime; this.lastUseTime = this.cropomator.processTime;
this.lastProcessTime = this.cropomator.catalystTime; this.lastProcessTime = this.cropomator.catalystTime;
this.lastCatalystInUseTime = this.cropomator.catalystInUseTime; this.lastCatalystInUseTime = this.cropomator.catalystInUseTime;
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if(slot != null && slot.getHasStack())
{ {
ItemStack itemstack1 = slot.getStack(); ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy(); 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; return null;
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
else else if(slotID != 1 && slotID != 0)
if (slotID != 1 && slotID != 0) {
if(TileEntityCropomator.isValid(itemstack1))
{ {
if (TileEntityCropomator.isValid(itemstack1)) if(!this.mergeItemStack(itemstack1, 0, 1, false))
{
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))
{ {
return null; 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); slot.putStack((ItemStack) null);
} }
@ -151,38 +146,38 @@ public class ContainerCropomator extends Container
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }
return itemstack; return itemstack;
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player)
{ {
return this.cropomator.isUseableByPlayer(this.player); return this.cropomator.isUseableByPlayer(this.player);
} }
public final void addInventorySlots() public final void addInventorySlots()
{ {
this.addInventorySlots(8, 84, 142); this.addInventorySlots(8, 84, 142);
} }
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
{ {
InventoryPlayer inventory = this.player.inventory; InventoryPlayer inventory = this.player.inventory;
for (int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
for (int j = 0; j < 9; ++j) for(int j = 0; j < 9; ++j)
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); 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)); this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
} }
} }

View file

@ -15,45 +15,45 @@ public class ContainerElectroextractor extends Container
{ {
TileEntityElectroextractor electroextractor; TileEntityElectroextractor electroextractor;
EntityPlayer player; EntityPlayer player;
private int lastUseTime; private int lastUseTime;
private int lastCrushTime; private int lastCrushTime;
private int lastFuelTime; private int lastFuelTime;
public ContainerElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor) public ContainerElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor)
{ {
this.player = player; this.player = player;
this.electroextractor = electroextractor; this.electroextractor = electroextractor;
lastUseTime = 0; lastUseTime = 0;
lastCrushTime = 0; lastCrushTime = 0;
lastFuelTime = 0; lastFuelTime = 0;
this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); // input this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); // fuelitem this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); // fuelitem
this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
if (timeType1 == 0) if(timeType1 == 0)
{ {
this.electroextractor.crushTime = timeType2; this.electroextractor.crushTime = timeType2;
} }
if (timeType1 == 1) if(timeType1 == 1)
{ {
this.electroextractor.fuelTime = timeType2; this.electroextractor.fuelTime = timeType2;
} }
if (timeType1 == 2) if(timeType1 == 2)
{ {
this.electroextractor.fuelInUseTime = timeType2; this.electroextractor.fuelInUseTime = timeType2;
} }
} }
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) public void addCraftingToCrafters(ICrafting crafting)
{ {
@ -62,86 +62,81 @@ public class ContainerElectroextractor extends Container
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime); crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime); crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
} }
@Override @Override
public void detectAndSendChanges() public void detectAndSendChanges()
{ {
super.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); 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); 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); 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); crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
} }
this.lastUseTime = this.electroextractor.crushTime; this.lastUseTime = this.electroextractor.crushTime;
this.lastCrushTime = this.electroextractor.fuelTime; this.lastCrushTime = this.electroextractor.fuelTime;
this.lastFuelTime = this.electroextractor.fuelInUseTime; this.lastFuelTime = this.electroextractor.fuelInUseTime;
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if(slot != null && slot.getHasStack())
{ {
ItemStack itemstack1 = slot.getStack(); ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy(); 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; return null;
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
else else if(slotID != 1 && slotID != 0)
if (slotID != 1 && slotID != 0) {
if(TileEntityElectroextractor.isValid(itemstack1))
{ {
if (TileEntityElectroextractor.isValid(itemstack1)) if(!this.mergeItemStack(itemstack1, 0, 1, false))
{
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))
{ {
return null; 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); slot.putStack((ItemStack) null);
} }
@ -149,38 +144,38 @@ public class ContainerElectroextractor extends Container
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }
return itemstack; return itemstack;
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player)
{ {
return this.electroextractor.isUseableByPlayer(this.player); return this.electroextractor.isUseableByPlayer(this.player);
} }
public final void addInventorySlots() public final void addInventorySlots()
{ {
this.addInventorySlots(8, 84, 142); this.addInventorySlots(8, 84, 142);
} }
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
{ {
InventoryPlayer inventory = this.player.inventory; InventoryPlayer inventory = this.player.inventory;
for (int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
for (int j = 0; j < 9; ++j) for(int j = 0; j < 9; ++j)
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); 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)); this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
} }
} }

View file

@ -15,43 +15,43 @@ public class ContainerWoodchipper extends Container
{ {
TileEntityWoodchipper woodchipper; TileEntityWoodchipper woodchipper;
EntityPlayer player; EntityPlayer player;
private int lastUseTime; private int lastUseTime;
private int lastChopTime; private int lastChopTime;
private int lastFuelTime; private int lastFuelTime;
public ContainerWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper) public ContainerWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper)
{ {
this.player = player; this.player = player;
this.woodchipper = woodchipper; this.woodchipper = woodchipper;
lastUseTime = 0; lastUseTime = 0;
lastChopTime = 0; lastChopTime = 0;
lastFuelTime = 0; lastFuelTime = 0;
this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); // input this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); // catalyst this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); // catalyst
this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int timeType1, int timeType2) public void updateProgressBar(int timeType1, int timeType2)
{ {
switch (timeType1) switch(timeType1)
{ {
case 0: case 0:
this.woodchipper.processTime = timeType2; this.woodchipper.processTime = timeType2;
break; break;
case 1: case 1:
this.woodchipper.fuelTime = timeType2; this.woodchipper.fuelTime = timeType2;
break; break;
case 2: case 2:
this.woodchipper.fuelUsetime = timeType2; this.woodchipper.fuelUsetime = timeType2;
break; break;
} }
} }
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) public void addCraftingToCrafters(ICrafting crafting)
{ {
@ -60,86 +60,81 @@ public class ContainerWoodchipper extends Container
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime); crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime); crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
} }
@Override @Override
public void detectAndSendChanges() public void detectAndSendChanges()
{ {
super.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); 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); 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); 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); crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
} }
this.lastUseTime = this.woodchipper.processTime; this.lastUseTime = this.woodchipper.processTime;
this.lastChopTime = this.woodchipper.fuelTime; this.lastChopTime = this.woodchipper.fuelTime;
this.lastFuelTime = this.woodchipper.fuelUsetime; this.lastFuelTime = this.woodchipper.fuelUsetime;
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if(slot != null && slot.getHasStack())
{ {
ItemStack itemstack1 = slot.getStack(); ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy(); 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; return null;
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} }
else else if(slotID != 1 && slotID != 0)
if (slotID != 1 && slotID != 0) {
if(TileEntityWoodchipper.isValidForWoodchipper(itemstack1))
{ {
if (TileEntityWoodchipper.isValidForWoodchipper(itemstack1)) if(!this.mergeItemStack(itemstack1, 0, 1, false))
{
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))
{ {
return null; 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); slot.putStack((ItemStack) null);
} }
@ -147,38 +142,38 @@ public class ContainerWoodchipper extends Container
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
slot.onPickupFromSlot(player, itemstack1); slot.onPickupFromSlot(player, itemstack1);
} }
return itemstack; return itemstack;
} }
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player)
{ {
return this.woodchipper.isUseableByPlayer(this.player); return this.woodchipper.isUseableByPlayer(this.player);
} }
public final void addInventorySlots() public final void addInventorySlots()
{ {
this.addInventorySlots(8, 84, 142); this.addInventorySlots(8, 84, 142);
} }
public final void addInventorySlots(int xOffset, int yOffset, int yHotbar) public final void addInventorySlots(int xOffset, int yOffset, int yHotbar)
{ {
InventoryPlayer inventory = this.player.inventory; InventoryPlayer inventory = this.player.inventory;
for (int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
for (int j = 0; j < 9; ++j) for(int j = 0; j < 9; ++j)
this.addSlotToContainer(new Slot(inventory, 9 + j + i * 9, xOffset + j * 18, yOffset + i * 18)); 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)); this.addSlotToContainer(new Slot(inventory, i, xOffset + i * 18, yHotbar));
} }
} }

View file

@ -16,44 +16,44 @@ public class MachineOutputSlot extends Slot
/** The player that is using the GUI where this slot resides. */ /** The player that is using the GUI where this slot resides. */
private EntityPlayer thePlayer; private EntityPlayer thePlayer;
private int temp; private int temp;
public MachineOutputSlot(EntityPlayer player, IInventory inventory, int x, int y, int z) public MachineOutputSlot(EntityPlayer player, IInventory inventory, int x, int y, int z)
{ {
super(inventory, x, y, z); super(inventory, x, y, z);
this.thePlayer = player; this.thePlayer = player;
} }
@Override @Override
public boolean isItemValid(ItemStack stack) public boolean isItemValid(ItemStack stack)
{ {
return false; return false;
} }
@Override @Override
public ItemStack decrStackSize(int slot) public ItemStack decrStackSize(int slot)
{ {
if (this.getHasStack()) if(this.getHasStack())
{ {
this.temp += Math.min(slot, this.getStack().stackSize); this.temp += Math.min(slot, this.getStack().stackSize);
} }
return super.decrStackSize(slot); return super.decrStackSize(slot);
} }
@Override @Override
public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack) public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack)
{ {
this.onCrafting(itemstack); this.onCrafting(itemstack);
super.onPickupFromSlot(player, itemstack); super.onPickupFromSlot(player, itemstack);
} }
@Override @Override
protected void onCrafting(ItemStack itemstack, int slot) protected void onCrafting(ItemStack itemstack, int slot)
{ {
this.temp += slot; this.temp += slot;
this.onCrafting(itemstack); this.onCrafting(itemstack);
} }
@Override @Override
protected void onCrafting(ItemStack stack) protected void onCrafting(ItemStack stack)
{ {

View file

@ -24,13 +24,13 @@ import net.minecraft.creativetab.CreativeTabs;
public class CrissCross public class CrissCross
{ {
public static CreativeTabs CCTab; public static CreativeTabs CCTab;
@Instance(Reference.modid) @Instance(Reference.modid)
public static CrissCross instance; public static CrissCross instance;
@SidedProxy(clientSide = "com.oitsjustjose.criss_cross.Util.ClientProxy", serverSide = "com.oitsjustjose.criss_cross.Util.CommonProxy") @SidedProxy(clientSide = "com.oitsjustjose.criss_cross.Util.ClientProxy", serverSide = "com.oitsjustjose.criss_cross.Util.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
@EventHandler @EventHandler
public static void preInit(FMLPreInitializationEvent event) public static void preInit(FMLPreInitializationEvent event)
{ {
@ -39,7 +39,7 @@ public class CrissCross
CCTab = new CCTab(); CCTab = new CCTab();
proxy.preInit(); proxy.preInit();
} }
@EventHandler @EventHandler
public static void init(FMLInitializationEvent event) public static void init(FMLInitializationEvent event)
{ {

View file

@ -15,22 +15,22 @@ import net.minecraft.util.StatCollector;
public class GUICropomator extends GuiContainer public class GUICropomator extends GuiContainer
{ {
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cropomator.png"); public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/cropomator.png");
private TileEntityCropomator cropomator; private TileEntityCropomator cropomator;
public GUICropomator(EntityPlayer player, TileEntityCropomator cropomator) public GUICropomator(EntityPlayer player, TileEntityCropomator cropomator)
{ {
super(new ContainerCropomator(player, cropomator)); super(new ContainerCropomator(player, cropomator));
this.cropomator = cropomator; this.cropomator = cropomator;
} }
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752); 4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 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 k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (this.cropomator.isUsingFuel()) if(this.cropomator.isUsingFuel())
{ {
int i1 = this.cropomator.getBurnTimeRemainingScaled(13); int i1 = this.cropomator.getBurnTimeRemainingScaled(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);

View file

@ -14,22 +14,22 @@ public class GUIElectroextractor extends GuiContainer
{ {
public static final ResourceLocation texture = new ResourceLocation("crisscross", public static final ResourceLocation texture = new ResourceLocation("crisscross",
"textures/gui/electroextractor.png"); "textures/gui/electroextractor.png");
private TileEntityElectroextractor electroextractor; private TileEntityElectroextractor electroextractor;
public GUIElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor) public GUIElectroextractor(EntityPlayer player, TileEntityElectroextractor electroextractor)
{ {
super(new ContainerElectroextractor(player, electroextractor)); super(new ContainerElectroextractor(player, electroextractor));
this.electroextractor = electroextractor; this.electroextractor = electroextractor;
} }
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752); 4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 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 k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (this.electroextractor.isUsingFuel()) if(this.electroextractor.isUsingFuel())
{ {
int i1 = this.electroextractor.getBurnTimeRemainingScaled(13); int i1 = this.electroextractor.getBurnTimeRemainingScaled(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);

View file

@ -11,21 +11,21 @@ public class GUIFactory implements IModGuiFactory
@Override @Override
public void initialize(Minecraft minecraftInstance) public void initialize(Minecraft minecraftInstance)
{ {
} }
@Override @Override
public Class<? extends GuiScreen> mainConfigGuiClass() public Class<? extends GuiScreen> mainConfigGuiClass()
{ {
return ModGUIConfig.class; return ModGUIConfig.class;
} }
@Override @Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
{ {
return null; return null;
} }
@Override @Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
{ {

View file

@ -17,55 +17,55 @@ public class GUIHandler implements IGuiHandler
public static final int Cropomator = 1; public static final int Cropomator = 1;
public static final int Electroextractor = 2; public static final int Electroextractor = 2;
public static final int Woodchipper = 3; public static final int Woodchipper = 3;
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityCropomator) if(tile instanceof TileEntityCropomator)
{ {
TileEntityCropomator TE = (TileEntityCropomator) tile; TileEntityCropomator TE = (TileEntityCropomator) tile;
return new ContainerCropomator(player, TE); return new ContainerCropomator(player, TE);
} }
if (tile instanceof TileEntityElectroextractor) if(tile instanceof TileEntityElectroextractor)
{ {
TileEntityElectroextractor TE = (TileEntityElectroextractor) tile; TileEntityElectroextractor TE = (TileEntityElectroextractor) tile;
return new ContainerElectroextractor(player, TE); return new ContainerElectroextractor(player, TE);
} }
if (tile instanceof TileEntityWoodchipper) if(tile instanceof TileEntityWoodchipper)
{ {
TileEntityWoodchipper TE = (TileEntityWoodchipper) tile; TileEntityWoodchipper TE = (TileEntityWoodchipper) tile;
return new ContainerWoodchipper(player, TE); return new ContainerWoodchipper(player, TE);
} }
return null; return null;
} }
@Override @Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{ {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityCropomator) if(tile instanceof TileEntityCropomator)
{ {
TileEntityCropomator TE = (TileEntityCropomator) tile; TileEntityCropomator TE = (TileEntityCropomator) tile;
return new GUICropomator(player, TE); return new GUICropomator(player, TE);
} }
if (tile instanceof TileEntityElectroextractor) if(tile instanceof TileEntityElectroextractor)
{ {
TileEntityElectroextractor TE = (TileEntityElectroextractor) tile; TileEntityElectroextractor TE = (TileEntityElectroextractor) tile;
return new GUIElectroextractor(player, TE); return new GUIElectroextractor(player, TE);
} }
if (tile instanceof TileEntityWoodchipper) if(tile instanceof TileEntityWoodchipper)
{ {
TileEntityWoodchipper TE = (TileEntityWoodchipper) tile; TileEntityWoodchipper TE = (TileEntityWoodchipper) tile;
return new GUIWoodchipper(player, TE); return new GUIWoodchipper(player, TE);
} }
return null; return null;

View file

@ -13,22 +13,22 @@ import net.minecraft.util.StatCollector;
public class GUIWoodchipper extends GuiContainer public class GUIWoodchipper extends GuiContainer
{ {
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/woodchipper.png"); public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/woodchipper.png");
private TileEntityWoodchipper woodchipper; private TileEntityWoodchipper woodchipper;
public GUIWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper) public GUIWoodchipper(EntityPlayer player, TileEntityWoodchipper woodchipper)
{ {
super(new ContainerWoodchipper(player, woodchipper)); super(new ContainerWoodchipper(player, woodchipper));
this.woodchipper = woodchipper; this.woodchipper = woodchipper;
} }
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752); 4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 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 k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (this.woodchipper.isUsingFuel()) if(this.woodchipper.isUsingFuel())
{ {
int i1 = this.woodchipper.getBurnTimeRemainingScaled(13); int i1 = this.woodchipper.getBurnTimeRemainingScaled(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);

View file

@ -5,9 +5,11 @@ import net.minecraft.item.Item;
public class CCItems public class CCItems
{ {
public static Item dusts; public static Item dusts;
public static Item everfulBucket;
public static void init() public static void init()
{ {
dusts = new ItemDust(); dusts = new ItemDust();
everfulBucket = new ItemEverfulBucket();
} }
} }

View file

@ -16,61 +16,64 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class ItemDust extends Item public class ItemDust extends Item
{ {
private static ArrayList<String> dustNames = new ArrayList<String>(); private static ArrayList<String> dustNames = new ArrayList<String>();
private static ArrayList<Integer> colors = new ArrayList<Integer>(); private static ArrayList<Integer> colors = new ArrayList<Integer>();
@SideOnly(Side.CLIENT)
public static IIcon overlay; public static IIcon overlay;
@SideOnly(Side.CLIENT)
public static IIcon base; public static IIcon base;
public ItemDust() public ItemDust()
{ {
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setCreativeTab(CrissCross.CCTab); this.setCreativeTab(CrissCross.CCTab);
GameRegistry.registerItem(this, this.getUnlocalizedName()); GameRegistry.registerItem(this, "itemDust");
} }
public static ArrayList<String> getDusts() public static ArrayList<String> getDusts()
{ {
return dustNames; return dustNames;
} }
public static void addDustType(String name, int color) public static void addDustType(String name, int color)
{ {
dustNames.add(name); dustNames.add(name);
colors.add(color); colors.add(color);
} }
public static String getName(int meta) public static String getName(int meta)
{ {
return dustNames.get(meta); return dustNames.get(meta);
} }
@Override @Override
public boolean requiresMultipleRenderPasses() public boolean requiresMultipleRenderPasses()
{ {
return true; return true;
} }
@Override @Override
public IIcon getIconFromDamageForRenderPass(int meta, int pass) public IIcon getIconFromDamageForRenderPass(int meta, int pass)
{ {
return pass == 0 ? base : overlay; return pass == 0 ? base : overlay;
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) 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."); itemStack.setStackDisplayName(StatCollector.translateToLocal("item.CrissCross.trash.name"));
return ("item." + Reference.modid + ".trash"); return("item." + Reference.modid + ".trash");
} }
return "item." + Reference.modid + "." + dustNames.get(itemStack.getItemDamage()); return "item." + Reference.modid + "." + dustNames.get(itemStack.getItemDamage());
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) public void registerIcons(IIconRegister register)
@ -78,26 +81,26 @@ public class ItemDust extends Item
overlay = register.registerIcon(Reference.modid + ":dust_overlay"); overlay = register.registerIcon(Reference.modid + ":dust_overlay");
base = register.registerIcon(Reference.modid + ":dust_base"); base = register.registerIcon(Reference.modid + ":dust_base");
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) 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 0;
return colors.get(stack.getItemDamage()); return colors.get(stack.getItemDamage());
} }
else else
return 16777215; return 16777215;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) 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)); list.add(new ItemStack(item, 1, i));
} }
} }

View file

@ -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));
}
}

View file

@ -15,67 +15,67 @@ public class CropomatorFuelHandler extends CropomatorRecipeHandler
public class CachedFuelRecipe extends CachedRecipe public class CachedFuelRecipe extends CachedRecipe
{ {
public FuelPair fuel; public FuelPair fuel;
public CachedFuelRecipe(FuelPair fuel) public CachedFuelRecipe(FuelPair fuel)
{ {
this.fuel = fuel; this.fuel = fuel;
} }
@Override @Override
public PositionedStack getIngredient() public PositionedStack getIngredient()
{ {
return mCropomator.get(cycleticks / 48 % mCropomator.size()).ingred; return mCropomator.get(cycleticks / 48 % mCropomator.size()).ingred;
} }
@Override @Override
public PositionedStack getResult() public PositionedStack getResult()
{ {
return mCropomator.get(cycleticks / 48 % mCropomator.size()).result; return mCropomator.get(cycleticks / 48 % mCropomator.size()).result;
} }
@Override @Override
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return fuel.stack; return fuel.stack;
} }
} }
private ArrayList<CropomatorPair> mCropomator = new ArrayList<CropomatorRecipeHandler.CropomatorPair>(); private ArrayList<CropomatorPair> mCropomator = new ArrayList<CropomatorRecipeHandler.CropomatorPair>();
public CropomatorFuelHandler() public CropomatorFuelHandler()
{ {
super(); super();
loadAllRecipes(); loadAllRecipes();
} }
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.cropomatorfuel"); return StatCollector.translateToLocal("recipe.cropomatorfuel");
} }
private void loadAllRecipes() private void loadAllRecipes()
{ {
Map<ItemStack, ItemStack> recipes = CropomatorRecipes.getInstance().getRecipeList(); Map<ItemStack, ItemStack> recipes = CropomatorRecipes.getInstance().getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
this.mCropomator.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); this.mCropomator.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("cropomatorfuel")) if(outputId.equals("cropomatorfuel"))
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
if (fuel.stack.contains(ingredient)) if(fuel.stack.contains(ingredient))
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {
return "cropomatorfuel"; return "cropomatorfuel";

View file

@ -32,26 +32,26 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
this.ingred = new PositionedStack(ingred, 51, 6); this.ingred = new PositionedStack(ingred, 51, 6);
this.result = new PositionedStack(result, 111, 24); this.result = new PositionedStack(result, 111, 24);
} }
public List<PositionedStack> getIngredients() public List<PositionedStack> getIngredients()
{ {
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
} }
public PositionedStack getResult() public PositionedStack getResult()
{ {
return result; return result;
} }
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return afuels.get((cycleticks / 48) % afuels.size()).stack; return afuels.get((cycleticks / 48) % afuels.size()).stack;
} }
PositionedStack ingred; PositionedStack ingred;
PositionedStack result; PositionedStack result;
} }
public static class FuelPair public static class FuelPair
{ {
public FuelPair(ItemStack ingred) public FuelPair(ItemStack ingred)
@ -59,80 +59,80 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
this.stack = new PositionedStack(ingred, 51, 42, false); this.stack = new PositionedStack(ingred, 51, 42, false);
this.burnTime = ConfigHandler.cropomatorProcessTime; this.burnTime = ConfigHandler.cropomatorProcessTime;
} }
public PositionedStack stack; public PositionedStack stack;
public int burnTime; public int burnTime;
} }
public static ArrayList<FuelPair> afuels; public static ArrayList<FuelPair> afuels;
public static HashSet<Block> efuels; public static HashSet<Block> efuels;
@Override @Override
public void loadTransferRects() public void loadTransferRects()
{ {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "cropomatorfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "cropomatorfuel"));
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "cropomator")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "cropomator"));
} }
@Override @Override
public Class<? extends GuiContainer> getGuiClass() public Class<? extends GuiContainer> getGuiClass()
{ {
return GUICropomator.class; return GUICropomator.class;
} }
@Override @Override
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.cropomator"); return StatCollector.translateToLocal("recipe.cropomator");
} }
@Override @Override
public TemplateRecipeHandler newInstance() public TemplateRecipeHandler newInstance()
{ {
if (afuels == null || afuels.isEmpty()) if(afuels == null || afuels.isEmpty())
findFuels(); findFuels();
return super.newInstance(); return super.newInstance();
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class) if(outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
} }
else else
super.loadCraftingRecipes(outputId, results); super.loadCraftingRecipes(outputId, results);
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result) public void loadCraftingRecipes(ItemStack result)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList(); Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue())); arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadUsageRecipes(String inputId, Object... ingredients) public void loadUsageRecipes(String inputId, Object... ingredients)
{ {
if (inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class) if(inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class)
loadCraftingRecipes("cropomator"); loadCraftingRecipes("cropomator");
else else
super.loadUsageRecipes(inputId, ingredients); super.loadUsageRecipes(inputId, ingredients);
} }
@Override @Override
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList(); Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
{ {
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
{ {
CropomatorPair arecipe = new CropomatorPair(recipe.getKey(), recipe.getValue()); CropomatorPair arecipe = new CropomatorPair(recipe.getKey(), recipe.getValue());
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
@ -140,30 +140,30 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
} }
} }
} }
@Override @Override
public String getGuiTexture() public String getGuiTexture()
{ {
return GUICropomator.texture.toString(); return GUICropomator.texture.toString();
} }
@Override @Override
public void drawExtras(int recipe) public void drawExtras(int recipe)
{ {
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
} }
private static void findFuels() private static void findFuels()
{ {
afuels = new ArrayList<FuelPair>(); afuels = new ArrayList<FuelPair>();
for (ItemStack item : ItemList.items) for(ItemStack item : ItemList.items)
{ {
if (TileEntityCropomator.isItemCatalyst(item)) if(TileEntityCropomator.isItemCatalyst(item))
afuels.add(new FuelPair(item)); afuels.add(new FuelPair(item));
} }
} }
@Override @Override
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {

View file

@ -15,67 +15,67 @@ public class ElectroextractorFuelHandler extends ElectroextractorRecipeHandler
public class CachedFuelRecipe extends CachedRecipe public class CachedFuelRecipe extends CachedRecipe
{ {
public FuelPair fuel; public FuelPair fuel;
public CachedFuelRecipe(FuelPair fuel) public CachedFuelRecipe(FuelPair fuel)
{ {
this.fuel = fuel; this.fuel = fuel;
} }
@Override @Override
public PositionedStack getIngredient() public PositionedStack getIngredient()
{ {
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).ingred; return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).ingred;
} }
@Override @Override
public PositionedStack getResult() public PositionedStack getResult()
{ {
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).result; return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).result;
} }
@Override @Override
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return fuel.stack; return fuel.stack;
} }
} }
private ArrayList<ElectroextractorPair> mElectroextractor = new ArrayList<ElectroextractorRecipeHandler.ElectroextractorPair>(); private ArrayList<ElectroextractorPair> mElectroextractor = new ArrayList<ElectroextractorRecipeHandler.ElectroextractorPair>();
public ElectroextractorFuelHandler() public ElectroextractorFuelHandler()
{ {
super(); super();
loadAllRecipes(); loadAllRecipes();
} }
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.electroextractorfuel"); return StatCollector.translateToLocal("recipe.electroextractorfuel");
} }
private void loadAllRecipes() private void loadAllRecipes()
{ {
Map<ItemStack, ItemStack> recipes = ElectroextractorRecipes.getInstance().getRecipeList(); Map<ItemStack, ItemStack> recipes = ElectroextractorRecipes.getInstance().getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
this.mElectroextractor.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); this.mElectroextractor.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("Electroextractorfuel")) if(outputId.equals("Electroextractorfuel"))
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
if (fuel.stack.contains(ingredient)) if(fuel.stack.contains(ingredient))
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {
return "electroextractorfuel"; return "electroextractorfuel";

View file

@ -32,26 +32,26 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
this.ingred = new PositionedStack(ingred, 51, 6); this.ingred = new PositionedStack(ingred, 51, 6);
this.result = new PositionedStack(result, 111, 24); this.result = new PositionedStack(result, 111, 24);
} }
public List<PositionedStack> getIngredients() public List<PositionedStack> getIngredients()
{ {
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
} }
public PositionedStack getResult() public PositionedStack getResult()
{ {
return result; return result;
} }
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return afuels.get((cycleticks / 48) % afuels.size()).stack; return afuels.get((cycleticks / 48) % afuels.size()).stack;
} }
PositionedStack ingred; PositionedStack ingred;
PositionedStack result; PositionedStack result;
} }
public static class FuelPair public static class FuelPair
{ {
public FuelPair(ItemStack ingred) public FuelPair(ItemStack ingred)
@ -59,82 +59,82 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
this.stack = new PositionedStack(ingred, 51, 42, false); this.stack = new PositionedStack(ingred, 51, 42, false);
this.burnTime = ConfigHandler.electroextractorProcessTime; this.burnTime = ConfigHandler.electroextractorProcessTime;
} }
public PositionedStack stack; public PositionedStack stack;
public int burnTime; public int burnTime;
} }
public static ArrayList<FuelPair> afuels; public static ArrayList<FuelPair> afuels;
public static HashSet<Block> efuels; public static HashSet<Block> efuels;
@Override @Override
public void loadTransferRects() public void loadTransferRects()
{ {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "Electroextractorfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "Electroextractorfuel"));
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "Electroextractor")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "Electroextractor"));
} }
@Override @Override
public Class<? extends GuiContainer> getGuiClass() public Class<? extends GuiContainer> getGuiClass()
{ {
return GUIElectroextractor.class; return GUIElectroextractor.class;
} }
@Override @Override
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.electroextractor"); return StatCollector.translateToLocal("recipe.electroextractor");
} }
@Override @Override
public TemplateRecipeHandler newInstance() public TemplateRecipeHandler newInstance()
{ {
if (afuels == null || afuels.isEmpty()) if(afuels == null || afuels.isEmpty())
findFuels(); findFuels();
return super.newInstance(); return super.newInstance();
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class) if(outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
} }
else else
super.loadCraftingRecipes(outputId, results); super.loadCraftingRecipes(outputId, results);
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result) public void loadCraftingRecipes(ItemStack result)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue())); arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadUsageRecipes(String inputId, Object... ingredients) public void loadUsageRecipes(String inputId, Object... ingredients)
{ {
if (inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class) if(inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class)
loadCraftingRecipes("Electroextractor"); loadCraftingRecipes("Electroextractor");
else else
super.loadUsageRecipes(inputId, ingredients); super.loadUsageRecipes(inputId, ingredients);
} }
@Override @Override
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
{ {
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
{ {
ElectroextractorPair arecipe = new ElectroextractorPair(recipe.getKey(), recipe.getValue()); ElectroextractorPair arecipe = new ElectroextractorPair(recipe.getKey(), recipe.getValue());
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
@ -142,30 +142,30 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
} }
} }
} }
@Override @Override
public String getGuiTexture() public String getGuiTexture()
{ {
return GUIElectroextractor.texture.toString(); return GUIElectroextractor.texture.toString();
} }
@Override @Override
public void drawExtras(int recipe) public void drawExtras(int recipe)
{ {
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
} }
private static void findFuels() private static void findFuels()
{ {
afuels = new ArrayList<FuelPair>(); afuels = new ArrayList<FuelPair>();
for (ItemStack item : ItemList.items) for(ItemStack item : ItemList.items)
{ {
if (TileEntityElectroextractor.isItemEnergetic(item)) if(TileEntityElectroextractor.isItemEnergetic(item))
afuels.add(new FuelPair(item)); afuels.add(new FuelPair(item));
} }
} }
@Override @Override
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {

View file

@ -24,19 +24,19 @@ public class NEICrissCrossConfig implements IConfigureNEI
API.registerGuiOverlay(GUIElectroextractor.class, "electroextractor"); API.registerGuiOverlay(GUIElectroextractor.class, "electroextractor");
API.registerGuiOverlay(GUIWoodchipper.class, "woodchipper"); API.registerGuiOverlay(GUIWoodchipper.class, "woodchipper");
} }
@Override @Override
public String getName() public String getName()
{ {
return Reference.modid; return Reference.modid;
} }
@Override @Override
public String getVersion() public String getVersion()
{ {
return Reference.version; return Reference.version;
} }
private static void registerHandler(TemplateRecipeHandler handler) private static void registerHandler(TemplateRecipeHandler handler)
{ {
API.registerRecipeHandler(handler); API.registerRecipeHandler(handler);

View file

@ -15,67 +15,67 @@ public class WoodchipperFuelHandler extends WoodchipperRecipeHandler
public class CachedFuelRecipe extends CachedRecipe public class CachedFuelRecipe extends CachedRecipe
{ {
public FuelPair fuel; public FuelPair fuel;
public CachedFuelRecipe(FuelPair fuel) public CachedFuelRecipe(FuelPair fuel)
{ {
this.fuel = fuel; this.fuel = fuel;
} }
@Override @Override
public PositionedStack getIngredient() public PositionedStack getIngredient()
{ {
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).ingred; return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).ingred;
} }
@Override @Override
public PositionedStack getResult() public PositionedStack getResult()
{ {
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).result; return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).result;
} }
@Override @Override
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return fuel.stack; return fuel.stack;
} }
} }
private ArrayList<WoodchipperPair> mWoodchipper = new ArrayList<WoodchipperRecipeHandler.WoodchipperPair>(); private ArrayList<WoodchipperPair> mWoodchipper = new ArrayList<WoodchipperRecipeHandler.WoodchipperPair>();
public WoodchipperFuelHandler() public WoodchipperFuelHandler()
{ {
super(); super();
loadAllRecipes(); loadAllRecipes();
} }
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.woodchipperfuel"); return StatCollector.translateToLocal("recipe.woodchipperfuel");
} }
private void loadAllRecipes() private void loadAllRecipes()
{ {
Map<ItemStack, ItemStack> recipes = WoodchipperRecipes.getInstance().getRecipeList(); Map<ItemStack, ItemStack> recipes = WoodchipperRecipes.getInstance().getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
this.mWoodchipper.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); this.mWoodchipper.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("woodchipperfuel")) if(outputId.equals("woodchipperfuel"))
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
for (FuelPair fuel : afuels) for(FuelPair fuel : afuels)
if (fuel.stack.contains(ingredient)) if(fuel.stack.contains(ingredient))
arecipes.add(new CachedFuelRecipe(fuel)); arecipes.add(new CachedFuelRecipe(fuel));
} }
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {
return "woodchipperfuel"; return "woodchipperfuel";

View file

@ -32,26 +32,26 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
this.ingred = new PositionedStack(ingred, 51, 6); this.ingred = new PositionedStack(ingred, 51, 6);
this.result = new PositionedStack(result, 111, 24); this.result = new PositionedStack(result, 111, 24);
} }
public List<PositionedStack> getIngredients() public List<PositionedStack> getIngredients()
{ {
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred)); return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
} }
public PositionedStack getResult() public PositionedStack getResult()
{ {
return result; return result;
} }
public PositionedStack getOtherStack() public PositionedStack getOtherStack()
{ {
return afuels.get((cycleticks / 48) % afuels.size()).stack; return afuels.get((cycleticks / 48) % afuels.size()).stack;
} }
PositionedStack ingred; PositionedStack ingred;
PositionedStack result; PositionedStack result;
} }
public static class FuelPair public static class FuelPair
{ {
public FuelPair(ItemStack ingred) public FuelPair(ItemStack ingred)
@ -59,82 +59,82 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
this.stack = new PositionedStack(ingred, 51, 42, false); this.stack = new PositionedStack(ingred, 51, 42, false);
this.burnTime = ConfigHandler.woodchipperProcessTime; this.burnTime = ConfigHandler.woodchipperProcessTime;
} }
public PositionedStack stack; public PositionedStack stack;
public int burnTime; public int burnTime;
} }
public static ArrayList<FuelPair> afuels; public static ArrayList<FuelPair> afuels;
public static HashSet<Block> efuels; public static HashSet<Block> efuels;
@Override @Override
public void loadTransferRects() public void loadTransferRects()
{ {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "woodchipperfuel")); transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "woodchipperfuel"));
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "woodchipper")); transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "woodchipper"));
} }
@Override @Override
public Class<? extends GuiContainer> getGuiClass() public Class<? extends GuiContainer> getGuiClass()
{ {
return GUIWoodchipper.class; return GUIWoodchipper.class;
} }
@Override @Override
public String getRecipeName() public String getRecipeName()
{ {
return StatCollector.translateToLocal("recipe.woodchipper"); return StatCollector.translateToLocal("recipe.woodchipper");
} }
@Override @Override
public TemplateRecipeHandler newInstance() public TemplateRecipeHandler newInstance()
{ {
if (afuels == null || afuels.isEmpty()) if(afuels == null || afuels.isEmpty())
findFuels(); findFuels();
return super.newInstance(); return super.newInstance();
} }
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) public void loadCraftingRecipes(String outputId, Object... results)
{ {
if (outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class) if(outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
} }
else else
super.loadCraftingRecipes(outputId, results); super.loadCraftingRecipes(outputId, results);
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result) public void loadCraftingRecipes(ItemStack result)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue())); arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
} }
@Override @Override
public void loadUsageRecipes(String inputId, Object... ingredients) public void loadUsageRecipes(String inputId, Object... ingredients)
{ {
if (inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class) if(inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class)
loadCraftingRecipes("woodchipper"); loadCraftingRecipes("woodchipper");
else else
super.loadUsageRecipes(inputId, ingredients); super.loadUsageRecipes(inputId, ingredients);
} }
@Override @Override
public void loadUsageRecipes(ItemStack ingredient) public void loadUsageRecipes(ItemStack ingredient)
{ {
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance() Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
.getRecipeList(); .getRecipeList();
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
{ {
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
{ {
WoodchipperPair arecipe = new WoodchipperPair(recipe.getKey(), recipe.getValue()); WoodchipperPair arecipe = new WoodchipperPair(recipe.getKey(), recipe.getValue());
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
@ -142,30 +142,30 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
} }
} }
} }
@Override @Override
public String getGuiTexture() public String getGuiTexture()
{ {
return GUIWoodchipper.texture.toString(); return GUIWoodchipper.texture.toString();
} }
@Override @Override
public void drawExtras(int recipe) public void drawExtras(int recipe)
{ {
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7); drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0); drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
} }
private static void findFuels() private static void findFuels()
{ {
afuels = new ArrayList<FuelPair>(); afuels = new ArrayList<FuelPair>();
for (ItemStack item : ItemList.items) for(ItemStack item : ItemList.items)
{ {
if (TileEntityWoodchipper.isItemFuel(item)) if(TileEntityWoodchipper.isItemFuel(item))
afuels.add(new FuelPair(item)); afuels.add(new FuelPair(item));
} }
} }
@Override @Override
public String getOverlayIdentifier() public String getOverlayIdentifier()
{ {

View file

@ -21,18 +21,18 @@ public class CCCraftingRecipes
electroextractorRecipe(); electroextractorRecipe();
woodChipperRecipe(); woodChipperRecipe();
} }
static void woodChipperRecipe() static void woodChipperRecipe()
{ {
String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":"); String[] unlocItem = ConfigHandler.woodchipperRecipeItem.split(":");
ItemStack centerItem = new ItemStack(Blocks.diamond_block); 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); ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
if (unlocItem.length == 2) if(unlocItem.length == 2)
centerItem = newStack; centerItem = newStack;
if (unlocItem.length == 3) if(unlocItem.length == 3)
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
} }
else else
@ -41,23 +41,22 @@ public class CCCraftingRecipes
+ "could not be added as part of the recipe of the Woodchipper."); + "could not be added as part of the recipe of the Woodchipper.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[]
new Object[] { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
Items.golden_axe, 'C', centerItem });
} }
static void electroextractorRecipe() static void electroextractorRecipe()
{ {
String[] unlocItem = ConfigHandler.electroextractorRecipeItem.split(":"); String[] unlocItem = ConfigHandler.electroextractorRecipeItem.split(":");
ItemStack centerItem = new ItemStack(Blocks.diamond_block); 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); ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
if (unlocItem.length == 2) if(unlocItem.length == 2)
centerItem = newStack; centerItem = newStack;
if (unlocItem.length == 3) if(unlocItem.length == 3)
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
} }
else else
@ -65,25 +64,24 @@ public class CCCraftingRecipes
CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem
+ " could not be added as part of the recipe of the electroextractor."); + " could not be added as part of the recipe of the electroextractor.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[]
new Object[] { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem });
Items.golden_pickaxe, 'C', centerItem });
} }
static void cropomatorRecipe() static void cropomatorRecipe()
{ {
String[] unlocItem = ConfigHandler.cropomatorRecipeItem.split(":"); String[] unlocItem = ConfigHandler.cropomatorRecipeItem.split(":");
ItemStack centerItem = new ItemStack(Blocks.diamond_block); 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); ItemStack newStack = GameRegistry.findItemStack(unlocItem[0], unlocItem[1], 1);
if (unlocItem.length == 2) if(unlocItem.length == 2)
centerItem = newStack; centerItem = newStack;
if (unlocItem.length == 3) if(unlocItem.length == 3)
centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2])); centerItem = new ItemStack(newStack.getItem(), 1, Integer.parseInt(unlocItem[2]));
} }
else else
@ -92,9 +90,8 @@ public class CCCraftingRecipes
+ " could not be added as part of the recipe of the cropomator."); + " could not be added as part of the recipe of the cropomator.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[]
new Object[] { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem });
'C', centerItem });
} }
} }

View file

@ -25,7 +25,7 @@ public class CCMachineRecipes
public static int cropomatorQTY = ConfigHandler.cropomatorOutput; public static int cropomatorQTY = ConfigHandler.cropomatorOutput;
public static int electroQTY = ConfigHandler.electroextractorOutput; public static int electroQTY = ConfigHandler.electroextractorOutput;
public static int woodchipperQTY = ConfigHandler.woodchipperOutput; public static int woodchipperQTY = ConfigHandler.woodchipperOutput;
public static void init() public static void init()
{ {
initCropomatorRecipes(); initCropomatorRecipes();
@ -34,7 +34,7 @@ public class CCMachineRecipes
initElectroextractorOreDictionary(); initElectroextractorOreDictionary();
initWoodchipperFuels(); initWoodchipperFuels();
initWoodchipperOreDictionary(); initWoodchipperOreDictionary();
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore),
new ItemStack(Items.diamond, electroQTY)); new ItemStack(Items.diamond, electroQTY));
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore),
@ -42,17 +42,17 @@ public class CCMachineRecipes
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore),
new ItemStack(Items.coal, electroQTY)); new ItemStack(Items.coal, electroQTY));
} }
public static void initCropomatorRecipes() public static void initCropomatorRecipes()
{ {
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++) for(int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
{ {
try try
{ {
String[] unlocStack = ConfigHandler.cropomatorInputs[i].split(":"); 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); ItemStack newStack = GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1);
CropomatorRecipes.getInstance().addRecipe(newStack, CropomatorRecipes.getInstance().addRecipe(newStack,
@ -63,12 +63,12 @@ public class CCMachineRecipes
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
+ " could not be added to the Cropomator's recipe list."); + " could not be added to the Cropomator's recipe list.");
CCLog.warn("Please confirm you have the name and formatting correct."); 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( ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, 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)); CCLog.warn("[CrissCross]: Error reading itemstack for inputs from input file at item: " + (i + 1));
} }
} }
} }
public static void initCropomatorFuels() public static void initCropomatorFuels()
{ {
for (int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++) for(int i = 0; i < ConfigHandler.cropomatorCatalysts.length; i++)
{ {
try try
{ {
String[] unlocStack = ConfigHandler.cropomatorCatalysts[i].split(":"); 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)); TileEntityCropomator.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
else else
{ {
@ -111,10 +111,10 @@ public class CCMachineRecipes
CCLog.warn("Please confirm you have the name and formatting correct."); 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( ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, 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)); 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() public static void initWoodchipperOreDictionary()
{ {
Container local1 = new Container() Container local1 = new Container()
@ -148,25 +149,25 @@ public class CCMachineRecipes
} }
}; };
InventoryCrafting localInventoryCrafting = new InventoryCrafting(local1, 3, 3); 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); localInventoryCrafting.setInventorySlotContents(i, null);
} }
ArrayList localArrayList = OreDictionary.getOres("logWood"); 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 localItemStack1 = (ItemStack) localArrayList.get(j);
ItemStack localItemStack3; ItemStack localItemStack3;
ItemStack localItemStack4; 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 = ItemHelper.cloneStack(localItemStack1, 1);
localItemStack3.setItemDamage(k); localItemStack3.setItemDamage(k);
localInventoryCrafting.setInventorySlotContents(0, localItemStack3); localInventoryCrafting.setInventorySlotContents(0, localItemStack3);
localItemStack4 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null); localItemStack4 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
if (localItemStack4 != null) if(localItemStack4 != null)
{ {
ItemStack localItemStack5 = localItemStack4.copy(); ItemStack localItemStack5 = localItemStack4.copy();
ItemStack tmp129_127 = localItemStack5; ItemStack tmp129_127 = localItemStack5;
@ -180,7 +181,7 @@ public class CCMachineRecipes
ItemStack localItemStack2 = localItemStack1.copy(); ItemStack localItemStack2 = localItemStack1.copy();
localInventoryCrafting.setInventorySlotContents(0, localItemStack2); localInventoryCrafting.setInventorySlotContents(0, localItemStack2);
localItemStack3 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null); localItemStack3 = ItemHelper.findMatchingRecipe(localInventoryCrafting, null);
if (localItemStack3 != null) if(localItemStack3 != null)
{ {
localItemStack4 = localItemStack3.copy(); localItemStack4 = localItemStack3.copy();
ItemStack tmp201_199 = localItemStack4; ItemStack tmp201_199 = localItemStack4;
@ -190,17 +191,17 @@ public class CCMachineRecipes
} }
} }
} }
public static void initWoodchipperFuels() public static void initWoodchipperFuels()
{ {
for (int i = 0; i < ConfigHandler.woodchipperFuels.length; i++) for(int i = 0; i < ConfigHandler.woodchipperFuels.length; i++)
{ {
try try
{ {
String[] unlocStack = ConfigHandler.woodchipperFuels[i].split(":"); 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)); TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
else else
{ {
@ -209,10 +210,10 @@ public class CCMachineRecipes
CCLog.warn("Please confirm you have the name and formatting correct."); 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( ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, 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)); CCLog.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1));
} }
} }
} }
static void initElectroextractorFuels() static void initElectroextractorFuels()
{ {
for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++) for(int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++)
{ {
try try
{ {
String[] unlocStack = ConfigHandler.electroextractorEnergySources[i].split(":"); 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)); TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
else else
{ {
@ -252,10 +253,10 @@ public class CCMachineRecipes
CCLog.warn("Please confirm you have the name and formatting correct."); 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( ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, 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)); CCLog.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1));
} }
} }
} }
static void initElectroextractorOreDictionary() static void initElectroextractorOreDictionary()
{ {
ArrayList<String> dustNames = ItemDust.getDusts(); ArrayList<String> 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(":"); 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<ItemStack> ores = OreDictionary.getOres("ore" + entry[0]); ArrayList<ItemStack> ores = OreDictionary.getOres("ore" + entry[0]);
ItemDust.addDustType(entry[0], Integer.parseInt(entry[1])); 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), ElectroextractorRecipes.getInstance().addRecipe(ores.get(j),
new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1)); new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1));
} }
@ -295,22 +296,20 @@ public class CCMachineRecipes
{ {
CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i]
+ " could not be registered."); + " 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] CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0]
+ "."); + ".");
else else if(!OreDictionary.doesOreNameExist("ingot" + entry[0]))
if (!OreDictionary.doesOreNameExist("ingot" + entry[0])) CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + 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; 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); 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); GameRegistry.addSmelting(new ItemStack(CCItems.dusts, 1, i), ingot, 0.0F);
} }
} }

View file

@ -14,44 +14,44 @@ public class CropomatorRecipes
private static final CropomatorRecipes recipeBase = new CropomatorRecipes(); private static final CropomatorRecipes recipeBase = new CropomatorRecipes();
public static final ArrayList<ItemStack> inputs = new ArrayList<ItemStack>(); public static final ArrayList<ItemStack> inputs = new ArrayList<ItemStack>();
public static final ArrayList<ItemStack> outputs = new ArrayList<ItemStack>(); public static final ArrayList<ItemStack> outputs = new ArrayList<ItemStack>();
private Map recipes = Maps.newHashMap(); private Map recipes = Maps.newHashMap();
public static CropomatorRecipes getInstance() public static CropomatorRecipes getInstance()
{ {
return recipeBase; return recipeBase;
} }
public void addRecipe(ItemStack input, ItemStack stack) public void addRecipe(ItemStack input, ItemStack stack)
{ {
this.recipes.put(input, stack); this.recipes.put(input, stack);
inputs.add(input); inputs.add(input);
outputs.add(stack); outputs.add(stack);
} }
public ItemStack getResult(ItemStack stack) public ItemStack getResult(ItemStack stack)
{ {
Iterator iterator = this.recipes.entrySet().iterator(); Iterator iterator = this.recipes.entrySet().iterator();
Entry entry; Entry entry;
do do
{ {
if (!iterator.hasNext()) if(!iterator.hasNext())
return null; return null;
entry = (Entry) iterator.next(); entry = (Entry) iterator.next();
} }
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
return (ItemStack) entry.getValue(); return (ItemStack) entry.getValue();
} }
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
{ {
return stack2.getItem() == stack1.getItem() return stack2.getItem() == stack1.getItem()
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
} }
public Map getRecipeList() public Map getRecipeList()
{ {
return this.recipes; return this.recipes;

View file

@ -16,40 +16,40 @@ public class ElectroextractorRecipes
{ {
private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes(); private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes();
private Map recipes = Maps.newHashMap(); private Map recipes = Maps.newHashMap();
public static ElectroextractorRecipes getInstance() public static ElectroextractorRecipes getInstance()
{ {
return recipeBase; return recipeBase;
} }
public void addRecipe(ItemStack input, ItemStack stack) public void addRecipe(ItemStack input, ItemStack stack)
{ {
this.recipes.put(input, stack); this.recipes.put(input, stack);
} }
public ItemStack getResult(ItemStack stack) public ItemStack getResult(ItemStack stack)
{ {
Iterator iterator = this.recipes.entrySet().iterator(); Iterator iterator = this.recipes.entrySet().iterator();
Entry entry; Entry entry;
do do
{ {
if (!iterator.hasNext()) if(!iterator.hasNext())
return null; return null;
entry = (Entry) iterator.next(); entry = (Entry) iterator.next();
} }
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
return (ItemStack) entry.getValue(); return (ItemStack) entry.getValue();
} }
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
{ {
return stack2.getItem() == stack1.getItem() return stack2.getItem() == stack1.getItem()
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
} }
public Map getRecipeList() public Map getRecipeList()
{ {
return this.recipes; return this.recipes;

View file

@ -16,40 +16,40 @@ public class WoodchipperRecipes
{ {
private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes(); private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes();
private Map recipes = Maps.newHashMap(); private Map recipes = Maps.newHashMap();
public static WoodchipperRecipes getInstance() public static WoodchipperRecipes getInstance()
{ {
return recipeBase; return recipeBase;
} }
public void addRecipe(ItemStack input, ItemStack stack) public void addRecipe(ItemStack input, ItemStack stack)
{ {
this.recipes.put(input, stack); this.recipes.put(input, stack);
} }
public ItemStack getResult(ItemStack stack) public ItemStack getResult(ItemStack stack)
{ {
Iterator iterator = this.recipes.entrySet().iterator(); Iterator iterator = this.recipes.entrySet().iterator();
Entry entry; Entry entry;
do do
{ {
if (!iterator.hasNext()) if(!iterator.hasNext())
return null; return null;
entry = (Entry) iterator.next(); entry = (Entry) iterator.next();
} }
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey())); while(!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
return (ItemStack) entry.getValue(); return (ItemStack) entry.getValue();
} }
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
{ {
return stack2.getItem() == stack1.getItem() return stack2.getItem() == stack1.getItem()
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage()); && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
} }
public Map getRecipeList() public Map getRecipeList()
{ {
return this.recipes; return this.recipes;

View file

@ -20,42 +20,45 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
{ {
private static int proTicks = ConfigHandler.cropomatorProcessTime; private static int proTicks = ConfigHandler.cropomatorProcessTime;
private static int qty = ConfigHandler.cropomatorOutput; private static int qty = ConfigHandler.cropomatorOutput;
private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsTop = new int[]
private static final int[] slotsBottom = new int[] { 2, 1 }; { 0 };
private static final int[] slotsSides = new int[] { 1 }; private static final int[] slotsBottom = new int[]
{ 2, 1 };
private static final int[] slotsSides = new int[]
{ 1 };
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
private ItemStack[] ItemStacks = new ItemStack[3]; private ItemStack[] ItemStacks = new ItemStack[3];
public int catalystTime; public int catalystTime;
public int processTime; public int processTime;
public int catalystInUseTime; public int catalystInUseTime;
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
{ {
return fuelItems; return fuelItems;
} }
@Override @Override
public int getSizeInventory() public int getSizeInventory()
{ {
return this.ItemStacks.length; return this.ItemStacks.length;
} }
@Override @Override
public ItemStack getStackInSlot(int slot) public ItemStack getStackInSlot(int slot)
{ {
return this.ItemStacks[slot]; return this.ItemStacks[slot];
} }
@Override @Override
public ItemStack decrStackSize(int slot, int qtyToDecr) public ItemStack decrStackSize(int slot, int qtyToDecr)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack; ItemStack itemstack;
if (this.ItemStacks[slot].stackSize <= qtyToDecr) if(this.ItemStacks[slot].stackSize <= qtyToDecr)
{ {
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -64,12 +67,12 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
else else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if(this.ItemStacks[slot].stackSize == 0)
{ {
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
} }
return itemstack; return itemstack;
} }
} }
@ -78,11 +81,11 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
return null; return null;
} }
} }
@Override @Override
public ItemStack getStackInSlotOnClosing(int slot) public ItemStack getStackInSlotOnClosing(int slot)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -93,53 +96,53 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
return null; return null;
} }
} }
@Override @Override
public void setInventorySlotContents(int slot, ItemStack itemstack) public void setInventorySlotContents(int slot, ItemStack itemstack)
{ {
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{ {
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
} }
} }
@Override @Override
public String getInventoryName() public String getInventoryName()
{ {
return "container.cropomator"; return "container.cropomator";
} }
@Override @Override
public boolean hasCustomInventoryName() public boolean hasCustomInventoryName()
{ {
return true; return true;
} }
@Override @Override
public void readFromNBT(NBTTagCompound tag) public void readFromNBT(NBTTagCompound tag)
{ {
super.readFromNBT(tag); super.readFromNBT(tag);
NBTTagList nbttaglist = tag.getTagList("Items", 10); NBTTagList nbttaglist = tag.getTagList("Items", 10);
this.ItemStacks = new ItemStack[this.getSizeInventory()]; 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); NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
byte b0 = nbttagcompound1.getByte("Slot"); 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.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
} }
} }
this.catalystTime = tag.getShort("BonemealTime"); this.catalystTime = tag.getShort("BonemealTime");
this.processTime = tag.getShort("ProcessTime"); this.processTime = tag.getShort("ProcessTime");
this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]); this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]);
} }
@Override @Override
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
@ -147,10 +150,10 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
tag.setShort("BonemealTime", (short) this.catalystTime); tag.setShort("BonemealTime", (short) this.catalystTime);
tag.setShort("ProcessTime", (short) this.processTime); tag.setShort("ProcessTime", (short) this.processTime);
NBTTagList nbttaglist = new NBTTagList(); 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(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
@ -158,77 +161,77 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
} }
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@Override @Override
public int getInventoryStackLimit() public int getInventoryStackLimit()
{ {
return 64; return 64;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getProgressScaled(int par1) public int getProgressScaled(int par1)
{ {
return this.processTime * par1 / proTicks; return this.processTime * par1 / proTicks;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.catalystInUseTime == 0) if(this.catalystInUseTime == 0)
{ {
this.catalystInUseTime = proTicks; this.catalystInUseTime = proTicks;
} }
return this.catalystTime * par1 / this.catalystInUseTime; return this.catalystTime * par1 / this.catalystInUseTime;
} }
public boolean isUsingFuel() public boolean isUsingFuel()
{ {
return this.catalystTime > 0; return this.catalystTime > 0;
} }
public void updateEntity() public void updateEntity()
{ {
boolean flag = this.catalystTime > 0; boolean flag = this.catalystTime > 0;
boolean flag1 = false; boolean flag1 = false;
if (this.catalystTime > 0) if(this.catalystTime > 0)
{ {
--this.catalystTime; --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]); this.catalystInUseTime = this.catalystTime = getItemBurnTime(this.ItemStacks[1]);
if (this.catalystTime > 0) if(this.catalystTime > 0)
{ {
flag1 = true; flag1 = true;
if (this.ItemStacks[1] != null) if(this.ItemStacks[1] != null)
{ {
--this.ItemStacks[1].stackSize; --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]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
} }
} }
} }
} }
if (this.isUsingFuel() && this.canProcess()) if(this.isUsingFuel() && this.canProcess())
{ {
++this.processTime; ++this.processTime;
if (this.processTime == proTicks) if(this.processTime == proTicks)
{ {
this.processTime = 0; this.processTime = 0;
this.processItem(); this.processItem();
@ -240,50 +243,50 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
this.processTime = 0; this.processTime = 0;
} }
} }
if (flag != this.catalystTime > 0) if(flag != this.catalystTime > 0)
{ {
flag1 = true; flag1 = true;
BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.xCoord, this.yCoord, BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord); this.zCoord);
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
} }
private boolean canProcess() private boolean canProcess()
{ {
ItemStack input = this.ItemStacks[0]; ItemStack input = this.ItemStacks[0];
if (input != null) if(input != null)
{ {
ItemStack output = CropomatorRecipes.getInstance().getResult(input); ItemStack output = CropomatorRecipes.getInstance().getResult(input);
if (output == null) if(output == null)
return false; return false;
ItemStack outputSlot = this.ItemStacks[2]; ItemStack outputSlot = this.ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
return true; return true;
if (!outputSlot.isItemEqual(output)) if(!outputSlot.isItemEqual(output))
return false; return false;
int result = outputSlot.stackSize + output.stackSize; int result = outputSlot.stackSize + output.stackSize;
return result <= output.getMaxStackSize(); return result <= output.getMaxStackSize();
} }
return false; return false;
} }
public static void addFuel(ItemStack itemstack) public static void addFuel(ItemStack itemstack)
{ {
fuelItems.add(itemstack); fuelItems.add(itemstack);
} }
public static boolean removeFuel(ItemStack 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); fuelItems.remove(i);
return true; return true;
@ -291,95 +294,94 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
} }
return false; return false;
} }
public static boolean isValid(ItemStack itemstack) public static boolean isValid(ItemStack itemstack)
{ {
if (CropomatorRecipes.getInstance().getResult(itemstack) != null) if(CropomatorRecipes.getInstance().getResult(itemstack) != null)
return true; return true;
return false; return false;
} }
public void processItem() public void processItem()
{ {
if (this.canProcess()) if(this.canProcess())
{ {
ItemStack input = ItemStacks[0]; ItemStack input = ItemStacks[0];
ItemStack output = CropomatorRecipes.getInstance().getResult(input); ItemStack output = CropomatorRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
{ {
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
} }
else else if(outputSlot.isItemEqual(output))
if (outputSlot.isItemEqual(output)) {
{ outputSlot.stackSize += output.stackSize;
outputSlot.stackSize += output.stackSize; }
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if(input.stackSize <= 0)
{ {
ItemStacks[0] = null; ItemStacks[0] = null;
} }
} }
} }
public static int getItemBurnTime(ItemStack itemstack) public static int getItemBurnTime(ItemStack itemstack)
{ {
return isItemCatalyst(itemstack) ? proTicks : 0; return isItemCatalyst(itemstack) ? proTicks : 0;
} }
public static boolean isItemCatalyst(ItemStack itemstack) 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); 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 true;
} }
return false; return false;
} }
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D; (double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory() public void openInventory()
{ {
} }
public void closeInventory() public void closeInventory()
{ {
} }
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
{ {
return slot == 2 ? false : (slot == 1 ? isItemCatalyst(itemstack) : true); return slot == 2 ? false : (slot == 1 ? isItemCatalyst(itemstack) : true);
} }
@Override @Override
public int[] getAccessibleSlotsFromSide(int slot) public int[] getAccessibleSlotsFromSide(int slot)
{ {
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack itemstack, int side) public boolean canInsertItem(int slot, ItemStack itemstack, int side)
{ {
return this.isItemValidForSlot(slot, itemstack); return this.isItemValidForSlot(slot, itemstack);
} }
@Override @Override
public boolean canExtractItem(int slot, ItemStack itemstack, int side) public boolean canExtractItem(int slot, ItemStack itemstack, int side)
{ {
return side != 0 || slot != 1; return side != 0 || slot != 1;
} }
@Override @Override
public void markDirty() public void markDirty()
{ {

View file

@ -22,37 +22,40 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
{ {
private static int proTicks = ConfigHandler.electroextractorProcessTime; private static int proTicks = ConfigHandler.electroextractorProcessTime;
private static int qty = ConfigHandler.electroextractorOutput; private static int qty = ConfigHandler.electroextractorOutput;
private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsTop = new int[]
private static final int[] slotsBottom = new int[] { 2, 1 }; { 0 };
private static final int[] slotsSides = new int[] { 1 }; private static final int[] slotsBottom = new int[]
{ 2, 1 };
private static final int[] slotsSides = new int[]
{ 1 };
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
private ItemStack[] ItemStacks = new ItemStack[3]; private ItemStack[] ItemStacks = new ItemStack[3];
public int fuelTime; public int fuelTime;
public int crushTime; public int crushTime;
public int fuelInUseTime; public int fuelInUseTime;
@Override @Override
public int getSizeInventory() public int getSizeInventory()
{ {
return this.ItemStacks.length; return this.ItemStacks.length;
} }
@Override @Override
public ItemStack getStackInSlot(int slot) public ItemStack getStackInSlot(int slot)
{ {
return this.ItemStacks[slot]; return this.ItemStacks[slot];
} }
@Override @Override
public ItemStack decrStackSize(int slot, int qtyToDecr) public ItemStack decrStackSize(int slot, int qtyToDecr)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack; ItemStack itemstack;
if (this.ItemStacks[slot].stackSize <= qtyToDecr) if(this.ItemStacks[slot].stackSize <= qtyToDecr)
{ {
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -61,12 +64,12 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
else else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if(this.ItemStacks[slot].stackSize == 0)
{ {
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
} }
return itemstack; return itemstack;
} }
} }
@ -75,11 +78,11 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
return null; return null;
} }
} }
@Override @Override
public ItemStack getStackInSlotOnClosing(int slot) public ItemStack getStackInSlotOnClosing(int slot)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -90,53 +93,53 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
return null; return null;
} }
} }
@Override @Override
public void setInventorySlotContents(int slot, ItemStack itemstack) public void setInventorySlotContents(int slot, ItemStack itemstack)
{ {
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{ {
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
} }
} }
@Override @Override
public String getInventoryName() public String getInventoryName()
{ {
return "container.electroextractor"; return "container.electroextractor";
} }
@Override @Override
public boolean hasCustomInventoryName() public boolean hasCustomInventoryName()
{ {
return true; return true;
} }
@Override @Override
public void readFromNBT(NBTTagCompound tag) public void readFromNBT(NBTTagCompound tag)
{ {
super.readFromNBT(tag); super.readFromNBT(tag);
NBTTagList nbttaglist = tag.getTagList("Items", 10); NBTTagList nbttaglist = tag.getTagList("Items", 10);
this.ItemStacks = new ItemStack[this.getSizeInventory()]; 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); NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
byte b0 = nbttagcompound1.getByte("Slot"); 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.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
} }
} }
this.fuelTime = tag.getShort("Energy"); this.fuelTime = tag.getShort("Energy");
this.crushTime = tag.getShort("CrushTime"); this.crushTime = tag.getShort("CrushTime");
this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]); this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]);
} }
@Override @Override
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
@ -144,10 +147,10 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
tag.setShort("Energy", (short) this.fuelTime); tag.setShort("Energy", (short) this.fuelTime);
tag.setShort("CrushTime", (short) this.crushTime); tag.setShort("CrushTime", (short) this.crushTime);
NBTTagList nbttaglist = new NBTTagList(); 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(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
@ -155,77 +158,77 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
} }
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@Override @Override
public int getInventoryStackLimit() public int getInventoryStackLimit()
{ {
return 64; return 64;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getProgressScaled(int par1) public int getProgressScaled(int par1)
{ {
return this.crushTime * par1 / proTicks; return this.crushTime * par1 / proTicks;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelInUseTime == 0) if(this.fuelInUseTime == 0)
{ {
this.fuelInUseTime = proTicks; this.fuelInUseTime = proTicks;
} }
return this.fuelTime * par1 / this.fuelInUseTime; return this.fuelTime * par1 / this.fuelInUseTime;
} }
public boolean isUsingFuel() public boolean isUsingFuel()
{ {
return this.fuelTime > 0; return this.fuelTime > 0;
} }
public void updateEntity() public void updateEntity()
{ {
boolean flag = this.fuelTime > 0; boolean flag = this.fuelTime > 0;
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if(this.fuelTime > 0)
{ {
--this.fuelTime; --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]); this.fuelInUseTime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
if (this.fuelTime > 0) if(this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
if (this.ItemStacks[1] != null) if(this.ItemStacks[1] != null)
{ {
--this.ItemStacks[1].stackSize; --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]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
} }
} }
} }
} }
if (this.isUsingFuel() && this.canProcess()) if(this.isUsingFuel() && this.canProcess())
{ {
++this.crushTime; ++this.crushTime;
if (this.crushTime == proTicks) if(this.crushTime == proTicks)
{ {
this.crushTime = 0; this.crushTime = 0;
this.processItem(); this.processItem();
@ -237,50 +240,50 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
this.crushTime = 0; this.crushTime = 0;
} }
} }
if (flag != this.fuelTime > 0) if(flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord, BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord); this.zCoord);
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
} }
private boolean canProcess() private boolean canProcess()
{ {
ItemStack input = this.ItemStacks[0]; ItemStack input = this.ItemStacks[0];
if (input != null) if(input != null)
{ {
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input); ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
if (output == null) if(output == null)
return false; return false;
ItemStack outputSlot = this.ItemStacks[2]; ItemStack outputSlot = this.ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
return true; return true;
if (!outputSlot.isItemEqual(output)) if(!outputSlot.isItemEqual(output))
return false; return false;
int result = outputSlot.stackSize + output.stackSize; int result = outputSlot.stackSize + output.stackSize;
return result <= output.getMaxStackSize(); return result <= output.getMaxStackSize();
} }
return false; return false;
} }
public static void addFuel(ItemStack itemstack) public static void addFuel(ItemStack itemstack)
{ {
fuelItems.add(itemstack); fuelItems.add(itemstack);
} }
public static boolean removeFuel(ItemStack 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); fuelItems.remove(i);
return true; return true;
@ -288,95 +291,94 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
} }
return false; return false;
} }
public static boolean isValid(ItemStack itemstack) public static boolean isValid(ItemStack itemstack)
{ {
if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null) if(ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
return true; return true;
return false; return false;
} }
public void processItem() public void processItem()
{ {
if (this.canProcess()) if(this.canProcess())
{ {
ItemStack input = ItemStacks[0]; ItemStack input = ItemStacks[0];
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input); ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
{ {
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
} }
else else if(outputSlot.isItemEqual(output))
if (outputSlot.isItemEqual(output)) {
{ outputSlot.stackSize += output.stackSize;
outputSlot.stackSize += output.stackSize; }
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if(input.stackSize <= 0)
{ {
ItemStacks[0] = null; ItemStacks[0] = null;
} }
} }
} }
public static int getItemBurnTime(ItemStack itemstack) public static int getItemBurnTime(ItemStack itemstack)
{ {
return isItemEnergetic(itemstack) ? proTicks : 0; return isItemEnergetic(itemstack) ? proTicks : 0;
} }
public static boolean isItemEnergetic(ItemStack itemstack) 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); 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 true;
} }
return false; return false;
} }
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D; (double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory() public void openInventory()
{ {
} }
public void closeInventory() public void closeInventory()
{ {
} }
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
{ {
return slot == 2 ? false : (slot == 1 ? isItemEnergetic(itemstack) : true); return slot == 2 ? false : (slot == 1 ? isItemEnergetic(itemstack) : true);
} }
@Override @Override
public int[] getAccessibleSlotsFromSide(int slot) public int[] getAccessibleSlotsFromSide(int slot)
{ {
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack itemstack, int side) public boolean canInsertItem(int slot, ItemStack itemstack, int side)
{ {
return this.isItemValidForSlot(slot, itemstack); return this.isItemValidForSlot(slot, itemstack);
} }
@Override @Override
public boolean canExtractItem(int slot, ItemStack itemstack, int side) public boolean canExtractItem(int slot, ItemStack itemstack, int side)
{ {
return side != 0 || slot != 1; return side != 0 || slot != 1;
} }
@Override @Override
public void markDirty() public void markDirty()
{ {

View file

@ -19,42 +19,45 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
{ {
private static int proTicks = ConfigHandler.woodchipperProcessTime; private static int proTicks = ConfigHandler.woodchipperProcessTime;
private static int qty = ConfigHandler.woodchipperOutput; private static int qty = ConfigHandler.woodchipperOutput;
private static final int[] slotsTop = new int[] { 0 }; private static final int[] slotsTop = new int[]
private static final int[] slotsBottom = new int[] { 2, 1 }; { 0 };
private static final int[] slotsSides = new int[] { 1 }; private static final int[] slotsBottom = new int[]
{ 2, 1 };
private static final int[] slotsSides = new int[]
{ 1 };
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
private ItemStack[] ItemStacks = new ItemStack[3]; private ItemStack[] ItemStacks = new ItemStack[3];
public int fuelTime; public int fuelTime;
public int processTime; public int processTime;
public int fuelUsetime; public int fuelUsetime;
public static ArrayList<ItemStack> getFuels() public static ArrayList<ItemStack> getFuels()
{ {
return fuelItems; return fuelItems;
} }
@Override @Override
public int getSizeInventory() public int getSizeInventory()
{ {
return this.ItemStacks.length; return this.ItemStacks.length;
} }
@Override @Override
public ItemStack getStackInSlot(int slot) public ItemStack getStackInSlot(int slot)
{ {
return this.ItemStacks[slot]; return this.ItemStacks[slot];
} }
@Override @Override
public ItemStack decrStackSize(int slot, int qtyToDecr) public ItemStack decrStackSize(int slot, int qtyToDecr)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack; ItemStack itemstack;
if (this.ItemStacks[slot].stackSize <= qtyToDecr) if(this.ItemStacks[slot].stackSize <= qtyToDecr)
{ {
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -63,12 +66,12 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
else else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
if (this.ItemStacks[slot].stackSize == 0) if(this.ItemStacks[slot].stackSize == 0)
{ {
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
} }
return itemstack; return itemstack;
} }
} }
@ -77,11 +80,11 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
return null; return null;
} }
} }
@Override @Override
public ItemStack getStackInSlotOnClosing(int slot) public ItemStack getStackInSlotOnClosing(int slot)
{ {
if (this.ItemStacks[slot] != null) if(this.ItemStacks[slot] != null)
{ {
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
@ -92,53 +95,53 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
return null; return null;
} }
} }
@Override @Override
public void setInventorySlotContents(int slot, ItemStack itemstack) public void setInventorySlotContents(int slot, ItemStack itemstack)
{ {
this.ItemStacks[slot] = itemstack; this.ItemStacks[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
{ {
itemstack.stackSize = this.getInventoryStackLimit(); itemstack.stackSize = this.getInventoryStackLimit();
} }
} }
@Override @Override
public String getInventoryName() public String getInventoryName()
{ {
return "container.woodchipper"; return "container.woodchipper";
} }
@Override @Override
public boolean hasCustomInventoryName() public boolean hasCustomInventoryName()
{ {
return true; return true;
} }
@Override @Override
public void readFromNBT(NBTTagCompound tag) public void readFromNBT(NBTTagCompound tag)
{ {
super.readFromNBT(tag); super.readFromNBT(tag);
NBTTagList nbttaglist = tag.getTagList("Items", 10); NBTTagList nbttaglist = tag.getTagList("Items", 10);
this.ItemStacks = new ItemStack[this.getSizeInventory()]; 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); NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
byte b0 = nbttagcompound1.getByte("Slot"); 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.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
} }
} }
this.fuelTime = tag.getShort("FuelTime"); this.fuelTime = tag.getShort("FuelTime");
this.processTime = tag.getShort("WorkTime"); this.processTime = tag.getShort("WorkTime");
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]); this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
} }
@Override @Override
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
@ -146,10 +149,10 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
tag.setShort("FuelTime", (short) this.fuelTime); tag.setShort("FuelTime", (short) this.fuelTime);
tag.setShort("WorkTime", (short) this.processTime); tag.setShort("WorkTime", (short) this.processTime);
NBTTagList nbttaglist = new NBTTagList(); 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(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
@ -157,77 +160,77 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
} }
tag.setTag("Items", nbttaglist); tag.setTag("Items", nbttaglist);
} }
@Override @Override
public int getInventoryStackLimit() public int getInventoryStackLimit()
{ {
return 64; return 64;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getProgressScaled(int par1) public int getProgressScaled(int par1)
{ {
return this.processTime * par1 / proTicks; return this.processTime * par1 / proTicks;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getBurnTimeRemainingScaled(int par1) public int getBurnTimeRemainingScaled(int par1)
{ {
if (this.fuelUsetime == 0) if(this.fuelUsetime == 0)
{ {
this.fuelUsetime = proTicks; this.fuelUsetime = proTicks;
} }
return this.fuelTime * par1 / this.fuelUsetime; return this.fuelTime * par1 / this.fuelUsetime;
} }
public boolean isUsingFuel() public boolean isUsingFuel()
{ {
return this.fuelTime > 0; return this.fuelTime > 0;
} }
public void updateEntity() public void updateEntity()
{ {
boolean flag = this.fuelTime > 0; boolean flag = this.fuelTime > 0;
boolean flag1 = false; boolean flag1 = false;
if (this.fuelTime > 0) if(this.fuelTime > 0)
{ {
--this.fuelTime; --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]); this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
if (this.fuelTime > 0) if(this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
if (this.ItemStacks[1] != null) if(this.ItemStacks[1] != null)
{ {
--this.ItemStacks[1].stackSize; --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]); this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
} }
} }
} }
} }
if (this.isUsingFuel() && this.canProcess()) if(this.isUsingFuel() && this.canProcess())
{ {
++this.processTime; ++this.processTime;
if (this.processTime == proTicks) if(this.processTime == proTicks)
{ {
this.processTime = 0; this.processTime = 0;
this.processItem(); this.processItem();
@ -239,50 +242,50 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
this.processTime = 0; this.processTime = 0;
} }
} }
if (flag != this.fuelTime > 0) if(flag != this.fuelTime > 0)
{ {
flag1 = true; flag1 = true;
BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord, BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord); this.zCoord);
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
} }
private boolean canProcess() private boolean canProcess()
{ {
ItemStack input = this.ItemStacks[0]; ItemStack input = this.ItemStacks[0];
if (input != null) if(input != null)
{ {
ItemStack output = WoodchipperRecipes.getInstance().getResult(input); ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
if (output == null) if(output == null)
return false; return false;
ItemStack outputSlot = this.ItemStacks[2]; ItemStack outputSlot = this.ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
return true; return true;
if (!outputSlot.isItemEqual(output)) if(!outputSlot.isItemEqual(output))
return false; return false;
int result = outputSlot.stackSize + output.stackSize; int result = outputSlot.stackSize + output.stackSize;
return result <= output.getMaxStackSize(); return result <= output.getMaxStackSize();
} }
return false; return false;
} }
public static void addFuel(ItemStack itemstack) public static void addFuel(ItemStack itemstack)
{ {
fuelItems.add(itemstack); fuelItems.add(itemstack);
} }
public static boolean removeFuel(ItemStack 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); fuelItems.remove(i);
return true; return true;
@ -290,119 +293,118 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
} }
return false; return false;
} }
public static boolean isValidForWoodchipper(ItemStack itemstack) public static boolean isValidForWoodchipper(ItemStack itemstack)
{ {
if (WoodchipperRecipes.getInstance().getResult(itemstack) != null) if(WoodchipperRecipes.getInstance().getResult(itemstack) != null)
return true; return true;
return false; return false;
} }
public void processItem() public void processItem()
{ {
if (this.canProcess()) if(this.canProcess())
{ {
ItemStack input = ItemStacks[0]; ItemStack input = ItemStacks[0];
ItemStack output = WoodchipperRecipes.getInstance().getResult(input); ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
ItemStack outputSlot = ItemStacks[2]; ItemStack outputSlot = ItemStacks[2];
if (outputSlot == null) if(outputSlot == null)
{ {
ItemStacks[2] = output.copy(); ItemStacks[2] = output.copy();
} }
else else if(outputSlot.isItemEqual(output))
if (outputSlot.isItemEqual(output)) {
{ outputSlot.stackSize += output.stackSize;
outputSlot.stackSize += output.stackSize; }
}
--input.stackSize; --input.stackSize;
if (input.stackSize <= 0) if(input.stackSize <= 0)
{ {
ItemStacks[0] = null; ItemStacks[0] = null;
} }
} }
} }
public static int getItemBurnTime(ItemStack itemstack) public static int getItemBurnTime(ItemStack itemstack)
{ {
return isItemFuel(itemstack) ? proTicks : 0; return isItemFuel(itemstack) ? proTicks : 0;
} }
public static boolean isItemFuel(ItemStack itemstack) 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); 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 true;
} }
return false; return false;
} }
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, : player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D; (double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory() public void openInventory()
{ {
} }
public void closeInventory() public void closeInventory()
{ {
} }
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
{ {
return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true); return slot == 2 ? false : (slot == 1 ? isItemFuel(itemstack) : true);
} }
@Override @Override
public int[] getAccessibleSlotsFromSide(int slot) public int[] getAccessibleSlotsFromSide(int slot)
{ {
return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides); return slot == 0 ? slotsBottom : (slot == 1 ? slotsTop : slotsSides);
} }
@Override @Override
public boolean canInsertItem(int slot, ItemStack itemstack, int side) public boolean canInsertItem(int slot, ItemStack itemstack, int side)
{ {
return this.isItemValidForSlot(slot, itemstack); return this.isItemValidForSlot(slot, itemstack);
} }
@Override @Override
public boolean canExtractItem(int slot, ItemStack itemstack, int side) public boolean canExtractItem(int slot, ItemStack itemstack, int side)
{ {
return side != 0 || slot != 1; return side != 0 || slot != 1;
} }
@Override @Override
public void markDirty() public void markDirty()
{ {
} }
public static class WoodchipperRecipe public static class WoodchipperRecipe
{ {
public final int time; public final int time;
public final ItemStack input; public final ItemStack input;
public final ItemStack result; public final ItemStack result;
public WoodchipperRecipe(ItemStack input, ItemStack result) public WoodchipperRecipe(ItemStack input, ItemStack result)
{ {
this.time = ConfigHandler.woodchipperProcessTime; this.time = ConfigHandler.woodchipperProcessTime;
this.input = input; this.input = input;
this.result = result; this.result = result;
} }
public boolean matches(ItemStack input) public boolean matches(ItemStack input)
{ {
return ItemStack.areItemStacksEqual(this.input, input); return ItemStack.areItemStacksEqual(this.input, input);
} }
public ItemStack getResult() public ItemStack getResult()
{ {
return result.copy(); return result.copy();

View file

@ -6,27 +6,27 @@ import org.apache.logging.log4j.Logger;
public class CCLog public class CCLog
{ {
private static Logger LOGGER = LogManager.getLogger(Reference.modid); private static Logger LOGGER = LogManager.getLogger(Reference.modid);
public CCLog() public CCLog()
{ {
} }
public static void warn(String msg) public static void warn(String msg)
{ {
LOGGER.warn(msg); LOGGER.warn(msg);
} }
public static void error(String msg) public static void error(String msg)
{ {
LOGGER.error(msg); LOGGER.error(msg);
} }
public static void info(String msg) public static void info(String msg)
{ {
LOGGER.info(msg); LOGGER.info(msg);
} }
public static void debug(String msg) public static void debug(String msg)
{ {
LOGGER.debug(msg); LOGGER.debug(msg);

View file

@ -11,11 +11,11 @@ public class CCTab extends CreativeTabs
{ {
super(CreativeTabs.getNextID(), "tab" + Reference.modid); super(CreativeTabs.getNextID(), "tab" + Reference.modid);
} }
@Override @Override
public Item getTabIconItem() public Item getTabIconItem()
{ {
return Item.getItemFromBlock(CCBlocks.electroextractor); return Item.getItemFromBlock(CCBlocks.electroextractor);
} }
} }

View file

@ -5,12 +5,12 @@ public class ClientProxy extends CommonProxy
@Override @Override
public void preInit() public void preInit()
{ {
} }
@Override @Override
public void init() public void init()
{ {
} }
} }

View file

@ -5,7 +5,7 @@ public class CommonProxy
public void preInit() public void preInit()
{ {
}; };
public void init() public void init()
{ {
}; };

View file

@ -15,39 +15,44 @@ public class ConfigHandler
public static String cropomatorRecipeItem; public static String cropomatorRecipeItem;
public static String[] cropomatorInputs; public static String[] cropomatorInputs;
public static String[] cropomatorCatalysts; public static String[] cropomatorCatalysts;
public static String[] defaultCropomatorInputs = new String[] { "minecraft:apple", "minecraft:reeds", public static String[] defaultCropomatorInputs = new String[]
"minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus", "minecraft:potato", "minecraft:sapling:0", { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus",
"minecraft:sapling:1", "minecraft:sapling:2", "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2",
"minecraft:sapling:5", "minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon",
"minecraft:cocoa", "minecraft:pumpkin", "minecraft:wheat", "minecraft:wheat_seeds" }; "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:cocoa", "minecraft:pumpkin",
public static String[] defaultCropomatorCatalystItems = new String[] { "minecraft:dye:15" }; "minecraft:wheat", "minecraft:wheat_seeds" };
public static String[] defaultCropomatorCatalystItems = new String[]
{ "minecraft:dye:15" };
public static int electroextractorProcessTime; public static int electroextractorProcessTime;
public static int electroextractorOutput; public static int electroextractorOutput;
public static String electroextractorRecipeItem; public static String electroextractorRecipeItem;
public static String[] electroextractorEnergySources; public static String[] electroextractorEnergySources;
public static String[] electroextractorOreDictInputs; public static String[] electroextractorOreDictInputs;
public static String[] defaultElectroextractorOreDictInputs = new String[] { "Iron:12428902", "Gold:15400704", public static String[] defaultElectroextractorOreDictInputs = new String[]
"Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Tin:15132390", { "Iron:12428902", "Gold:15400704", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872",
"Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113", "Nickel:16580553" }; "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113",
public static String[] defaultElectroextractorEnergySources = new String[] { "minecraft:redstone_block" }; "Nickel:16580553" };
public static String[] defaultElectroextractorEnergySources = new String[]
{ "minecraft:redstone_block" };
public static int woodchipperProcessTime; public static int woodchipperProcessTime;
public static int woodchipperOutput; public static int woodchipperOutput;
public static String woodchipperRecipeItem; public static String woodchipperRecipeItem;
public static String[] woodchipperFuels; 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) public static void init(File configFile)
{ {
// Create the configuration object from the given configuration file // Create the configuration object from the given configuration file
if (config == null) if(config == null)
{ {
config = new Configuration(configFile); config = new Configuration(configFile);
loadConfiguration(); loadConfiguration();
} }
} }
private static void loadConfiguration() private static void loadConfiguration()
{ {
// Cropomator Configs // Cropomator Configs
@ -55,40 +60,40 @@ public class ConfigHandler
.get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs, .get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs,
"A list of items to be added to the Cropomator's recipe list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.") "A list of items to be added to the Cropomator's recipe list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList(); .getStringList();
cropomatorCatalysts = config cropomatorCatalysts = config
.get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems, .get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems,
"A list of items to be added to the Cropomator's catalyst list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.") "A list of items to be added to the Cropomator's catalyst list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList(); .getStringList();
cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1, cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1,
Short.MAX_VALUE, Short.MAX_VALUE,
"Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200."); "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, 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."); "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, cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL,
"minecraft:diamond_block", "minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); "This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
// Electroextractor's Configs // Electroextractor's Configs
electroextractorEnergySources = config electroextractorEnergySources = config
.get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources, .get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources,
"A list of items to be added as the Electroextractor's energy sources. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.") "A list of items to be added as the Electroextractor's energy sources. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList(); .getStringList();
electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0, electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0,
Short.MAX_VALUE, Short.MAX_VALUE,
"Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200."); "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, electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64,
"Control how many dusts you get as the output. Default is 2."); "Control how many dusts you get as the output. Default is 2.");
electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL, electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL,
"minecraft:diamond_block", "minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); "This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
electroextractorOreDictInputs = config electroextractorOreDictInputs = config
.get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.", .get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.",
defaultElectroextractorOreDictInputs, defaultElectroextractorOreDictInputs,
@ -97,32 +102,32 @@ public class ConfigHandler
+ "\n" + "\n"
+ "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.") + "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.")
.getStringList(); .getStringList();
// Woodchipper's Configs // Woodchipper's Configs
woodchipperFuels = config woodchipperFuels = config
.get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels, .get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels,
"A list of items to be added as the Woodchipper's 'fuels'. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.") "A list of items to be added as the Woodchipper's 'fuels'. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList(); .getStringList();
woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0, woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0,
Short.MAX_VALUE, Short.MAX_VALUE,
"Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200."); "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, 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."); "Control how many planks are yielded from processing a log. Default is 6.");
woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL,
"minecraft:diamond_block", "minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); "This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
if (config.hasChanged()) if(config.hasChanged())
config.save(); config.save();
} }
@SubscribeEvent @SubscribeEvent
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
{ {
if (event.modID.equalsIgnoreCase(Reference.modid)) if(event.modID.equalsIgnoreCase(Reference.modid))
loadConfiguration(); loadConfiguration();
} }
} }

View file

@ -11,77 +11,77 @@ import net.minecraft.world.World;
/** /**
* *
* @author TeamCoFH * @author TeamCoFH All credit goes to TeamCoFH, this was required for proper
* All credit goes to TeamCoFH, this was required for proper woodchipper recipes :) * woodchipper recipes :)
* *
*/ */
public class ItemHelper public class ItemHelper
{ {
public static ItemStack cloneStack(Item item, int stackSize) public static ItemStack cloneStack(Item item, int stackSize)
{ {
if (item == null) if(item == null)
{ {
return null; return null;
} }
ItemStack stack = new ItemStack(item, stackSize); ItemStack stack = new ItemStack(item, stackSize);
return stack; return stack;
} }
public static ItemStack cloneStack(Block item, int stackSize) public static ItemStack cloneStack(Block item, int stackSize)
{ {
if (item == null) if(item == null)
{ {
return null; return null;
} }
ItemStack stack = new ItemStack(item, stackSize); ItemStack stack = new ItemStack(item, stackSize);
return stack; return stack;
} }
public static ItemStack cloneStack(ItemStack stack, int stackSize) public static ItemStack cloneStack(ItemStack stack, int stackSize)
{ {
if (stack == null) if(stack == null)
{ {
return null; return null;
} }
ItemStack retStack = stack.copy(); ItemStack retStack = stack.copy();
retStack.stackSize = stackSize; retStack.stackSize = stackSize;
return retStack; return retStack;
} }
public static ItemStack cloneStack(ItemStack stack) public static ItemStack cloneStack(ItemStack stack)
{ {
if (stack == null) if(stack == null)
{ {
return null; return null;
} }
ItemStack retStack = stack.copy(); ItemStack retStack = stack.copy();
return retStack; return retStack;
} }
public static int getItemDamage(ItemStack stack) public static int getItemDamage(ItemStack stack)
{ {
return Items.diamond.getDamage(stack); return Items.diamond.getDamage(stack);
} }
public static ItemStack findMatchingRecipe(InventoryCrafting inv, World world) public static ItemStack findMatchingRecipe(InventoryCrafting inv, World world)
{ {
ItemStack[] dmgItems = new ItemStack[2]; 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); 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; 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 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(); recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(i);
int var13 = theItem.getMaxDamage() - dmgItems[0].getItemDamageForDisplay();
int var8 = theItem.getMaxDamage() - dmgItems[1].getItemDamageForDisplay(); if(recipe.matches(inv, world))
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); return recipe.getCraftingResult(inv);
if (recipe.matches(inv, world))
{
return recipe.getCraftingResult(inv);
}
} }
return null;
} }
return null;
}
} }
} }

View file

@ -13,8 +13,8 @@ public class OreDictionaryAdder
public static void init() public static void init()
{ {
ArrayList<String> dustNames = ItemDust.getDusts(); ArrayList<String> 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)); OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(CCItems.dusts, 1, i));
} }
} }

View file

@ -18,6 +18,9 @@ item.CrissCross.Mithril.name=Electrolytic Mithril Dust
item.CrissCross.Nickel.name=Electrolytic Nickel Dust item.CrissCross.Nickel.name=Electrolytic Nickel Dust
item.CrissCross.trash.name=This is a bad item, please trash it. 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 #Containers
container.cropomator=Cropomator container.cropomator=Cropomator
container.electroextractor=ElectroExtractor container.electroextractor=ElectroExtractor

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 4
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B