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

@ -47,23 +47,23 @@ public class BlockCropomator extends BlockMachineBase
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;
} }
@ -73,7 +73,7 @@ public class BlockCropomator extends BlockMachineBase
(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());
@ -105,14 +105,14 @@ public class BlockCropomator extends BlockMachineBase
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

@ -53,23 +53,23 @@ public class BlockElectroextractor extends BlockMachineBase
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;
} }
@ -79,7 +79,7 @@ public class BlockElectroextractor extends BlockMachineBase
(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());
@ -105,14 +105,14 @@ public class BlockElectroextractor extends BlockMachineBase
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

@ -41,11 +41,11 @@ public class BlockMachineBase extends BlockContainer
@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];
@ -55,11 +55,11 @@ public class BlockMachineBase extends BlockContainer
@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];
@ -77,22 +77,22 @@ public class BlockMachineBase extends BlockContainer
{ {
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);
} }
@ -100,7 +100,7 @@ public class BlockMachineBase extends BlockContainer
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);
@ -108,22 +108,22 @@ public class BlockMachineBase extends BlockContainer
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;
} }

View file

@ -52,23 +52,23 @@ public class BlockWoodchipper extends BlockMachineBase
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;
} }
@ -78,7 +78,7 @@ public class BlockWoodchipper extends BlockMachineBase
(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());
@ -104,14 +104,14 @@ public class BlockWoodchipper extends BlockMachineBase
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

@ -40,17 +40,17 @@ public class ContainerCropomator extends Container
@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;
} }
@ -69,15 +69,15 @@ public class ContainerCropomator extends Container
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;
@ -91,59 +91,54 @@ public class ContainerCropomator extends Container
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;
} }
}
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) if(itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
} }
@ -152,7 +147,7 @@ public class ContainerCropomator extends Container
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
@ -178,11 +173,11 @@ public class ContainerCropomator extends Container
{ {
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

@ -38,17 +38,17 @@ public class ContainerElectroextractor extends Container
@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;
} }
@ -67,15 +67,15 @@ public class ContainerElectroextractor extends Container
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;
@ -89,59 +89,54 @@ public class ContainerElectroextractor extends Container
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;
} }
}
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) if(itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
} }
@ -150,7 +145,7 @@ public class ContainerElectroextractor extends Container
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
@ -176,11 +171,11 @@ public class ContainerElectroextractor extends Container
{ {
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

@ -38,16 +38,16 @@ public class ContainerWoodchipper extends Container
@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;
} }
} }
@ -65,15 +65,15 @@ public class ContainerWoodchipper extends Container
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;
@ -87,59 +87,54 @@ public class ContainerWoodchipper extends Container
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;
} }
}
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) if(itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack) null); slot.putStack((ItemStack) null);
} }
@ -148,7 +143,7 @@ public class ContainerWoodchipper extends Container
slot.onSlotChanged(); slot.onSlotChanged();
} }
if (itemstack1.stackSize == itemstack.stackSize) if(itemstack1.stackSize == itemstack.stackSize)
{ {
return null; return null;
} }
@ -174,11 +169,11 @@ public class ContainerWoodchipper extends Container
{ {
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

@ -32,7 +32,7 @@ public class MachineOutputSlot extends Slot
@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);
} }

View file

@ -39,7 +39,7 @@ public class GUICropomator extends GuiContainer
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

@ -38,7 +38,7 @@ public class GUIElectroextractor extends GuiContainer
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

@ -23,19 +23,19 @@ public class GUIHandler implements IGuiHandler
{ {
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;
@ -49,20 +49,20 @@ public class GUIHandler implements IGuiHandler
{ {
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;

View file

@ -37,7 +37,7 @@ public class GUIWoodchipper extends GuiContainer
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,20 +16,23 @@ 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()
@ -63,10 +66,10 @@ public class ItemDust extends Item
@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());
} }
@ -83,9 +86,9 @@ public class ItemDust extends Item
@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());
} }
@ -97,7 +100,7 @@ public class ItemDust extends Item
@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

@ -57,22 +57,22 @@ public class CropomatorFuelHandler extends CropomatorRecipeHandler
{ {
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));
} }

View file

@ -89,7 +89,7 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
@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();
} }
@ -97,11 +97,11 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
@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
@ -112,15 +112,15 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
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);
@ -130,9 +130,9 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
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);
@ -157,9 +157,9 @@ public class CropomatorRecipeHandler extends TemplateRecipeHandler
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));
} }
} }

View file

@ -57,22 +57,22 @@ public class ElectroextractorFuelHandler extends ElectroextractorRecipeHandler
{ {
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));
} }

View file

@ -89,7 +89,7 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
@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();
} }
@ -97,11 +97,11 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
@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
@ -113,15 +113,15 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
{ {
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);
@ -132,9 +132,9 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
{ {
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);
@ -159,9 +159,9 @@ public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
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));
} }
} }

View file

@ -57,22 +57,22 @@ public class WoodchipperFuelHandler extends WoodchipperRecipeHandler
{ {
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));
} }

View file

@ -89,7 +89,7 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
@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();
} }
@ -97,11 +97,11 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
@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
@ -113,15 +113,15 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
{ {
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);
@ -132,9 +132,9 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
{ {
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);
@ -159,9 +159,9 @@ public class WoodchipperRecipeHandler extends TemplateRecipeHandler
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));
} }
} }

View file

@ -27,12 +27,12 @@ public class CCCraftingRecipes
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
@ -42,9 +42,8 @@ public class CCCraftingRecipes
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()
@ -52,12 +51,12 @@ public class CCCraftingRecipes
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
@ -68,9 +67,8 @@ public class CCCraftingRecipes
} }
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()
@ -78,12 +76,12 @@ public class CCCraftingRecipes
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
@ -93,8 +91,7 @@ public class CCCraftingRecipes
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

@ -45,14 +45,14 @@ public class CCMachineRecipes
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,
@ -66,9 +66,9 @@ public class CCMachineRecipes
} }
} }
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,7 +85,7 @@ 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));
} }
@ -95,14 +95,14 @@ public class CCMachineRecipes
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
{ {
@ -112,9 +112,9 @@ public class CCMachineRecipes
} }
} }
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,14 +129,15 @@ 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()
{ {
@ -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;
@ -193,14 +194,14 @@ 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
{ {
@ -210,9 +211,9 @@ public class CCMachineRecipes
} }
} }
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,7 +228,7 @@ 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));
} }
@ -236,14 +237,14 @@ public class CCMachineRecipes
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
{ {
@ -253,9 +254,9 @@ public class CCMachineRecipes
} }
} }
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,7 +271,7 @@ 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));
} }
@ -280,14 +281,14 @@ public class CCMachineRecipes
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

@ -36,12 +36,12 @@ public class CropomatorRecipes
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();
} }

View file

@ -34,12 +34,12 @@ public class ElectroextractorRecipes
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();
} }

View file

@ -34,12 +34,12 @@ public class WoodchipperRecipes
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();
} }

View file

@ -20,9 +20,12 @@ 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];
@ -51,11 +54,11 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
@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;
@ -65,7 +68,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
{ {
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;
} }
@ -82,7 +85,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
@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;
@ -99,7 +102,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
{ {
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();
} }
@ -124,12 +127,12 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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);
} }
@ -148,9 +151,9 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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);
@ -177,7 +180,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
@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;
} }
@ -195,28 +198,28 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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]);
} }
@ -224,11 +227,11 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
} }
} }
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();
@ -241,7 +244,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
} }
} }
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,
@ -249,7 +252,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
@ -258,15 +261,15 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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();
@ -281,9 +284,9 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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;
@ -294,31 +297,30 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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;
} }
@ -332,10 +334,10 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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;

View file

@ -22,9 +22,12 @@ 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];
@ -48,11 +51,11 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
@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;
@ -62,7 +65,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
{ {
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;
} }
@ -79,7 +82,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
@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;
@ -96,7 +99,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
{ {
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();
} }
@ -121,12 +124,12 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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);
} }
@ -145,9 +148,9 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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);
@ -174,7 +177,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
@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;
} }
@ -192,28 +195,28 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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]);
} }
@ -221,11 +224,11 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
} }
} }
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();
@ -238,7 +241,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
} }
} }
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,
@ -246,7 +249,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
@ -255,15 +258,15 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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();
@ -278,9 +281,9 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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,31 +294,30 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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;
} }
@ -329,10 +331,10 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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;

View file

@ -19,9 +19,12 @@ 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];
@ -50,11 +53,11 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
@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,7 +67,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
{ {
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;
} }
@ -81,7 +84,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
@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;
@ -98,7 +101,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
{ {
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();
} }
@ -123,12 +126,12 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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);
} }
@ -147,9 +150,9 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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);
@ -176,7 +179,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
@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;
} }
@ -194,28 +197,28 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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]);
} }
@ -223,11 +226,11 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
} }
} }
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,7 +243,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
} }
} }
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,
@ -248,7 +251,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
} }
} }
if (flag1) if(flag1)
{ {
this.markDirty(); this.markDirty();
} }
@ -257,15 +260,15 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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();
@ -280,9 +283,9 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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;
@ -293,31 +296,30 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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;
} }
@ -331,10 +333,10 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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;

View file

@ -15,33 +15,38 @@ 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();
@ -115,14 +120,14 @@ public class ConfigHandler
"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,8 +11,8 @@ 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 :)
* *
*/ */
@ -21,7 +21,7 @@ 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;
} }
@ -33,7 +33,7 @@ public class ItemHelper
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;
} }
@ -45,7 +45,7 @@ public class ItemHelper
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;
} }
@ -58,7 +58,7 @@ public class ItemHelper
public static ItemStack cloneStack(ItemStack stack) public static ItemStack cloneStack(ItemStack stack)
{ {
if (stack == null) if(stack == null)
{ {
return null; return null;
} }
@ -77,11 +77,11 @@ public class ItemHelper
{ {
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();
int var9 = var13 + var8 + theItem.getMaxDamage() * 5 / 100;
int var10 = Math.max(0, theItem.getMaxDamage() - var9);
return new ItemStack(dmgItems[0].getItem(), 1, var10); if(recipe.matches(inv, world))
}
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

@ -14,7 +14,7 @@ public class OreDictionaryAdder
{ {
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