Trying to work out an NEI handler...

This commit is contained in:
oitsjustjose 2015-10-23 14:03:45 -04:00
commit c50eaf8263
35 changed files with 2905 additions and 2266 deletions

View file

@ -23,6 +23,7 @@ import net.minecraft.world.World;
public class BlockCropomator extends BlockMachineBase public class BlockCropomator extends BlockMachineBase
{ {
private static String unlocName = "Cropomator"; private static String unlocName = "Cropomator";
public BlockCropomator() public BlockCropomator()
{ {
super(unlocName); super(unlocName);
@ -44,7 +45,7 @@ public class BlockCropomator extends BlockMachineBase
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityCropomator tile = (TileEntityCropomator)world.getTileEntity(x, y, z); TileEntityCropomator tile = (TileEntityCropomator) world.getTileEntity(x, y, z);
if (tile != null) if (tile != null)
{ {
@ -68,17 +69,20 @@ public class BlockCropomator extends BlockMachineBase
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if (itemstack.hasTagCompound())
{ {
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double)((float)random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double)((float)random.nextGaussian() * f3 + 0.2F); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double)((float)random.nextGaussian() * f3); entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
world.spawnEntityInWorld(entityitem); world.spawnEntityInWorld(entityitem);
} }
} }
@ -98,16 +102,16 @@ public class BlockCropomator extends BlockMachineBase
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return true; return true;
} } else
else
{ {
TileEntityCropomator tilecropomator = (TileEntityCropomator)world.getTileEntity(x, y, z); TileEntityCropomator tilecropomator = (TileEntityCropomator) world.getTileEntity(x, y, z);
if(tilecropomator != null) if (tilecropomator != null)
player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z); player.openGui(CrissCross.instance, GUIHandler.Cropomator, world, x, y, z);
return true; return true;
} }

View file

@ -23,6 +23,7 @@ import net.minecraft.world.World;
public class BlockElectroextractor extends BlockMachineBase public class BlockElectroextractor extends BlockMachineBase
{ {
private static String unlocName = "ElectroExtractor"; private static String unlocName = "ElectroExtractor";
public BlockElectroextractor() public BlockElectroextractor()
{ {
super(unlocName); super(unlocName);
@ -50,7 +51,7 @@ public class BlockElectroextractor extends BlockMachineBase
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityElectroextractor tile = (TileEntityElectroextractor)world.getTileEntity(x, y, z); TileEntityElectroextractor tile = (TileEntityElectroextractor) world.getTileEntity(x, y, z);
if (tile != null) if (tile != null)
{ {
@ -74,17 +75,20 @@ public class BlockElectroextractor extends BlockMachineBase
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if (itemstack.hasTagCompound())
{ {
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double)((float)random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double)((float)random.nextGaussian() * f3 + 0.2F); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double)((float)random.nextGaussian() * f3); entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
world.spawnEntityInWorld(entityitem); world.spawnEntityInWorld(entityitem);
} }
} }
@ -98,16 +102,16 @@ public class BlockElectroextractor extends BlockMachineBase
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return true; 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

@ -26,26 +26,26 @@ public class BlockMachineBase extends BlockContainer
public BlockMachineBase(String unlocName) public BlockMachineBase(String unlocName)
{ {
super(Material.rock); //0 - Top super(Material.rock); // 0 - Top
this.setHardness(2.0F); //1 - Bottom this.setHardness(2.0F); // 1 - Bottom
this.setResistance(2.0F); //3 - Front this.setResistance(2.0F); // 3 - Front
this.setStepSound(soundTypeMetal); //4 - Sides this.setStepSound(soundTypeMetal); // 4 - Sides
this.setBlockName(Reference.modid + "." + unlocName); this.setBlockName(Reference.modid + "." + unlocName);
this.setCreativeTab(CrissCross.CCTab); this.setCreativeTab(CrissCross.CCTab);
this.unlocalizedName = unlocName; this.unlocalizedName = unlocName;
} }
//Used for the ItemStack vs. In-world Rendering // Used for the ItemStack vs. In-world Rendering
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) public IIcon getIcon(int side, int meta)
{ {
if(side == 0) if (side == 0)
return blockTextures[0]; return blockTextures[0];
if(side == 1) if (side == 1)
return blockTextures[1]; return blockTextures[1];
if(side == 3) if (side == 3)
return blockTextures[2]; return blockTextures[2];
return blockTextures[3]; return blockTextures[3];
@ -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];
@ -75,7 +75,7 @@ public class BlockMachineBase extends BlockContainer
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack)
{ {
int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0) if (l == 0)
{ {

View file

@ -22,6 +22,7 @@ import net.minecraft.world.World;
public class BlockWoodchipper extends BlockMachineBase public class BlockWoodchipper extends BlockMachineBase
{ {
private static String unlocName = "WoodChipper"; private static String unlocName = "WoodChipper";
public BlockWoodchipper() public BlockWoodchipper()
{ {
super(unlocName); super(unlocName);
@ -49,7 +50,7 @@ public class BlockWoodchipper extends BlockMachineBase
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{ {
Random random = new Random(); Random random = new Random();
TileEntityWoodchipper tile = (TileEntityWoodchipper)world.getTileEntity(x, y, z); TileEntityWoodchipper tile = (TileEntityWoodchipper) world.getTileEntity(x, y, z);
if (tile != null) if (tile != null)
{ {
@ -73,17 +74,20 @@ public class BlockWoodchipper extends BlockMachineBase
} }
itemstack.stackSize -= j; itemstack.stackSize -= j;
EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); EntityItem entityitem = new EntityItem(world, (double) ((float) x + f),
(double) ((float) y + f1), (double) ((float) z + f2),
new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage()));
if (itemstack.hasTagCompound()) if (itemstack.hasTagCompound())
{ {
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); entityitem.getEntityItem()
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
} }
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motionX = (double)((float)random.nextGaussian() * f3); entityitem.motionX = (double) ((float) random.nextGaussian() * f3);
entityitem.motionY = (double)((float)random.nextGaussian() * f3 + 0.2F); entityitem.motionY = (double) ((float) random.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double)((float)random.nextGaussian() * f3); entityitem.motionZ = (double) ((float) random.nextGaussian() * f3);
world.spawnEntityInWorld(entityitem); world.spawnEntityInWorld(entityitem);
} }
} }
@ -97,16 +101,16 @@ public class BlockWoodchipper extends BlockMachineBase
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ)
{ {
if(world.isRemote) if (world.isRemote)
{ {
return true; 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

@ -31,8 +31,8 @@ public class ContainerCropomator extends Container
lastProcessTime = 0; lastProcessTime = 0;
lastCatalystInUseTime = 0; lastCatalystInUseTime = 0;
this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); //input this.addSlotToContainer(new Slot(cropomator, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); //catalyst this.addSlotToContainer(new Slot(cropomator, 1, 56, 53)); // catalyst
this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, cropomator, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@ -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;
@ -89,7 +89,7 @@ public class ContainerCropomator extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -104,8 +104,7 @@ public class ContainerCropomator extends Container
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} } else if (slotID != 1 && slotID != 0)
else if (slotID != 1 && slotID != 0)
{ {
if (TileEntityCropomator.isValidForCropomator(itemstack1)) if (TileEntityCropomator.isValidForCropomator(itemstack1))
{ {
@ -113,36 +112,31 @@ public class ContainerCropomator extends Container
{ {
return null; return null;
} }
} } else if (TileEntityCropomator.isItemCatalyst(itemstack1))
else if (TileEntityCropomator.isItemCatalyst(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{ {
return null; return null;
} }
} } else if (slotID >= 3 && slotID < 30)
else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{ {
return null; return null;
} }
} } else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{ {
return null; return null;
} }
} } else if (!this.mergeItemStack(itemstack1, 3, 39, false))
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{ {
return null; return null;
} }
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack)null); slot.putStack((ItemStack) null);
} } else
else
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }

View file

@ -29,8 +29,8 @@ public class ContainerElectroextractor extends Container
lastCrushTime = 0; lastCrushTime = 0;
lastFuelTime = 0; lastFuelTime = 0;
this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); //input this.addSlotToContainer(new Slot(electroextractor, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); //fuelitem this.addSlotToContainer(new Slot(electroextractor, 1, 56, 53)); // fuelitem
this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, electroextractor, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@ -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;
@ -87,7 +87,7 @@ public class ContainerElectroextractor extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -102,8 +102,7 @@ public class ContainerElectroextractor extends Container
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} } else if (slotID != 1 && slotID != 0)
else if (slotID != 1 && slotID != 0)
{ {
if (TileEntityElectroextractor.isValidForElectroextractor(itemstack1)) if (TileEntityElectroextractor.isValidForElectroextractor(itemstack1))
{ {
@ -111,36 +110,31 @@ public class ContainerElectroextractor extends Container
{ {
return null; return null;
} }
} } else if (TileEntityElectroextractor.isItemEnergetic(itemstack1))
else if (TileEntityElectroextractor.isItemEnergetic(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{ {
return null; return null;
} }
} } else if (slotID >= 3 && slotID < 30)
else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{ {
return null; return null;
} }
} } else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{ {
return null; return null;
} }
} } else if (!this.mergeItemStack(itemstack1, 3, 39, false))
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{ {
return null; return null;
} }
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack)null); slot.putStack((ItemStack) null);
} } else
else
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }

View file

@ -29,8 +29,8 @@ public class ContainerWoodchipper extends Container
lastChopTime = 0; lastChopTime = 0;
lastFuelTime = 0; lastFuelTime = 0;
this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); //input this.addSlotToContainer(new Slot(woodchipper, 0, 56, 17)); // input
this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); //catalyst this.addSlotToContainer(new Slot(woodchipper, 1, 56, 53)); // catalyst
this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35)); this.addSlotToContainer(new MachineOutputSlot(player, woodchipper, 2, 116, 35));
this.addInventorySlots(); this.addInventorySlots();
} }
@ -38,13 +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:this.woodchipper.processTime = timeType2; case 0:
this.woodchipper.processTime = timeType2;
break; break;
case 1:this.woodchipper.fuelTime = timeType2; case 1:
this.woodchipper.fuelTime = timeType2;
break; break;
case 2:this.woodchipper.fuelUsetime = timeType2; case 2:
this.woodchipper.fuelUsetime = timeType2;
break; break;
} }
} }
@ -62,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;
@ -82,7 +85,7 @@ public class ContainerWoodchipper extends Container
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{ {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(slotID); Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) if (slot != null && slot.getHasStack())
{ {
@ -97,8 +100,7 @@ public class ContainerWoodchipper extends Container
} }
slot.onSlotChange(itemstack1, itemstack); slot.onSlotChange(itemstack1, itemstack);
} } else if (slotID != 1 && slotID != 0)
else if (slotID != 1 && slotID != 0)
{ {
if (TileEntityWoodchipper.isValidForWoodchipper(itemstack1)) if (TileEntityWoodchipper.isValidForWoodchipper(itemstack1))
{ {
@ -106,36 +108,31 @@ public class ContainerWoodchipper extends Container
{ {
return null; return null;
} }
} } else if (TileEntityWoodchipper.isItemFuel(itemstack1))
else if (TileEntityWoodchipper.isItemFuel(itemstack1))
{ {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) if (!this.mergeItemStack(itemstack1, 1, 2, false))
{ {
return null; return null;
} }
} } else if (slotID >= 3 && slotID < 30)
else if (slotID >= 3 && slotID < 30)
{ {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) if (!this.mergeItemStack(itemstack1, 30, 39, false))
{ {
return null; return null;
} }
} } else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
else if (slotID >= 30 && slotID < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{ {
return null; return null;
} }
} } else if (!this.mergeItemStack(itemstack1, 3, 39, false))
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{ {
return null; return null;
} }
if (itemstack1.stackSize == 0) if (itemstack1.stackSize == 0)
{ {
slot.putStack((ItemStack)null); slot.putStack((ItemStack) null);
} } else
else
{ {
slot.onSlotChanged(); slot.onSlotChanged();
} }

View file

@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross;
import com.oitsjustjose.criss_cross.Blocks.CCBlocks; import com.oitsjustjose.criss_cross.Blocks.CCBlocks;
import com.oitsjustjose.criss_cross.Items.CCItems; import com.oitsjustjose.criss_cross.Items.CCItems;
import com.oitsjustjose.criss_cross.Recipes.CRecipes; import com.oitsjustjose.criss_cross.Recipes.CCRecipes;
import com.oitsjustjose.criss_cross.Util.CommonProxy; import com.oitsjustjose.criss_cross.Util.CommonProxy;
import com.oitsjustjose.criss_cross.Util.ConfigHandler; import com.oitsjustjose.criss_cross.Util.ConfigHandler;
import com.oitsjustjose.criss_cross.Util.OreDictionaryAdder; import com.oitsjustjose.criss_cross.Util.OreDictionaryAdder;
@ -43,7 +43,7 @@ public class CrissCross
{ {
CCBlocks.init(); CCBlocks.init();
CCItems.init(); CCItems.init();
CRecipes.init(); CCRecipes.init();
OreDictionaryAdder.init(); OreDictionaryAdder.init();
proxy.init(); proxy.init();
} }

View file

@ -27,7 +27,8 @@ public class GUICropomator extends GuiContainer
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.cropomator"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)

View file

@ -12,7 +12,8 @@ import net.minecraft.util.StatCollector;
public class GUIElectroextractor extends GuiContainer public class GUIElectroextractor extends GuiContainer
{ {
public static final ResourceLocation texture = new ResourceLocation("crisscross", "textures/gui/electroextractor.png"); public static final ResourceLocation texture = new ResourceLocation("crisscross",
"textures/gui/electroextractor.png");
private TileEntityElectroextractor electroextractor; private TileEntityElectroextractor electroextractor;
@ -25,7 +26,8 @@ public class GUIElectroextractor extends GuiContainer
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.electroextractor"), 50, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)

View file

@ -23,21 +23,21 @@ 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;
return new ContainerWoodchipper(player, TE); return new ContainerWoodchipper(player, TE);
} }
@ -49,22 +49,22 @@ 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;
return new GUIWoodchipper(player, TE); return new GUIWoodchipper(player, TE);
} }

View file

@ -25,7 +25,8 @@ public class GUIWoodchipper extends GuiContainer
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.woodchipper"), 55, 7, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 7, this.ySize - 92,
4210752);
} }
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY)

View file

@ -14,9 +14,6 @@ public class ModGUIConfig extends GuiConfig
{ {
super(guiScreen, super(guiScreen,
new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
Reference.modid, Reference.modid, false, true, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
false,
true,
GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
} }
} }

View file

@ -5,6 +5,7 @@ import net.minecraft.item.Item;
public class CCItems public class CCItems
{ {
public static Item dusts; public static Item dusts;
public static void init() public static void init()
{ {
dusts = new ItemDust(); dusts = new ItemDust();

View file

@ -63,7 +63,7 @@ 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("This is a bad item, please trash it.");
return ("item." + Reference.modid + ".trash"); return ("item." + Reference.modid + ".trash");
@ -83,13 +83,12 @@ 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());
} } else
else
return 16777215; return 16777215;
} }
@ -97,7 +96,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,34 @@
package com.oitsjustjose.criss_cross.NEI;
import com.oitsjustjose.criss_cross.Util.Reference;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class CCNEIIntegration implements IConfigureNEI
{
@Override
public void loadConfig()
{
registerHandler(new RecipeHandlerWoodchipper());
}
@Override
public String getName()
{
return Reference.modid + " built-in NEI plugin.";
}
@Override
public String getVersion()
{
return Reference.version;
}
public void registerHandler(RecipeHandlerBase handler)
{
API.registerRecipeHandler(handler);
API.registerUsageHandler(handler);
}
}

View file

@ -0,0 +1,358 @@
package com.oitsjustjose.criss_cross.NEI;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidContainerItem;
public abstract class RecipeHandlerBase extends TemplateRecipeHandler
{
public abstract class CachedBaseRecipe extends CachedRecipe
{
public List<FluidTankElement> getFluidTanks()
{
return null;
}
}
public abstract String getRecipeID();
public void loadCraftingRecipes(FluidStack result)
{
}
public void loadUsageRecipes(FluidStack ingredient)
{
}
@Override
public void drawForeground(int recipe)
{
super.drawForeground(recipe);
this.drawFluidTanks(recipe);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
try
{
if (outputId.equals("liquid") && results.length == 1 && results[0] instanceof FluidStack)
{
this.loadCraftingRecipes((FluidStack) results[0]);
} else
{
super.loadCraftingRecipes(outputId, results);
}
} catch (Throwable ex)
{
ex.printStackTrace();
}
}
@Override
public void loadCraftingRecipes(ItemStack result)
{
FluidStack fluid = getFluidStack(result);
if (fluid != null)
{
this.loadCraftingRecipes(fluid);
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients)
{
try
{
if (inputId.equals("liquid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
{
this.loadUsageRecipes((FluidStack) ingredients[0]);
} else
{
super.loadUsageRecipes(inputId, ingredients);
}
} catch (Throwable ex)
{
ex.printStackTrace();
}
}
@Override
public void loadUsageRecipes(ItemStack ingred)
{
FluidStack fluid = getFluidStack(ingred);
if (fluid != null)
{
this.loadUsageRecipes(fluid);
}
}
@Override
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip, int recipe)
{
super.handleTooltip(guiRecipe, currenttip, recipe);
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
if (GuiContainerManager.shouldShowTooltip(guiRecipe))
{
Point mouse = GuiDraw.getMousePosition();
Point offset = guiRecipe.getRecipePosition(recipe);
Point relMouse = new Point(mouse.x - ((guiRecipe.width - 176) / 2) - offset.x,
mouse.y - ((guiRecipe.height - 166) / 2) - offset.y);
if (crecipe.getFluidTanks() != null)
{
for (FluidTankElement tank : crecipe.getFluidTanks())
{
if (tank.position.contains(relMouse))
{
tank.handleTooltip(currenttip);
}
}
}
}
return currenttip;
}
@Override
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
{
if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
{
if (this.transferFluidTank(gui, recipe, false))
{
return true;
}
} else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage"))
{
if (this.transferFluidTank(gui, recipe, true))
{
return true;
}
}
return super.keyTyped(gui, keyChar, keyCode, recipe);
}
@Override
public boolean mouseClicked(GuiRecipe gui, int button, int recipe)
{
if (button == 0)
{
if (this.transferFluidTank(gui, recipe, false))
{
return true;
}
} else if (button == 1)
{
if (this.transferFluidTank(gui, recipe, true))
{
return true;
}
}
return super.mouseClicked(gui, button, recipe);
}
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage)
{
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
Point mousepos = GuiDraw.getMousePosition();
Point offset = guiRecipe.getRecipePosition(recipe);
Point relMouse = new Point(mousepos.x - ((guiRecipe.width - 176) / 2) - offset.x,
mousepos.y - ((guiRecipe.height - 166) / 2) - offset.y);
if (crecipe.getFluidTanks() != null)
{
for (FluidTankElement tank : crecipe.getFluidTanks())
{
if (tank.position.contains(relMouse))
{
if ((tank.fluid != null) && tank.fluid.amount > 0)
{
if (usage)
{
if (!GuiUsageRecipe.openRecipeGui("liquid", new Object[]
{ tank.fluid }))
{
return false;
}
} else
{
if (!GuiCraftingRecipe.openRecipeGui("liquid", new Object[]
{ tank.fluid }))
{
return false;
}
}
return true;
}
}
}
}
return false;
}
public void drawFluidTanks(int recipe)
{
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
if (crecipe.getFluidTanks() != null)
{
for (FluidTankElement fluidTank : crecipe.getFluidTanks())
{
fluidTank.draw();
}
}
}
public static List getSingleList(Object o)
{
List list = new ArrayList();
list.add(o);
return list;
}
public static FluidStack getFluidStack(ItemStack stack)
{
if (stack == null)
{
return null;
}
Item item = stack.getItem();
FluidStack fluidStack = null;
if ((item instanceof IFluidContainerItem))
{
fluidStack = ((IFluidContainerItem) item).getFluid(stack);
}
if (fluidStack == null)
{
fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
}
if ((fluidStack == null) && (Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock))
{
Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid();
if (fluid != null)
{
return new FluidStack(fluid, 1000);
}
}
return fluidStack;
}
public static boolean areFluidsEqual(FluidStack fluidStack1, FluidStack fluidStack2)
{
if (fluidStack1 == null || fluidStack2 == null)
{
return false;
}
return fluidStack1.isFluidEqual(fluidStack2);
}
public static class FluidTankElement
{
public Rectangle position;
public FluidStack fluid;
public int capacity;
public boolean flowingTexture = false;
public FluidTankElement(Rectangle position, int capacity, FluidStack fluid)
{
this.position = position;
this.capacity = capacity;
this.fluid = fluid;
}
public List<String> handleTooltip(List<String> currenttip)
{
if (this.fluid == null || this.fluid.getFluid() == null || this.fluid.amount <= 0)
{
return currenttip;
}
currenttip.add(this.fluid.getLocalizedName());
currenttip.add(EnumChatFormatting.GRAY.toString() + this.fluid.amount + " mB");
return currenttip;
}
public void draw()
{
if (this.fluid == null || this.fluid.getFluid() == null || this.fluid.amount <= 0)
{
return;
}
IIcon fluidIcon = null;
if (this.flowingTexture && this.fluid.getFluid().getFlowingIcon() != null)
{
fluidIcon = this.fluid.getFluid().getFlowingIcon();
} else if (this.fluid.getFluid().getStillIcon() != null)
{
fluidIcon = this.fluid.getFluid().getStillIcon();
} else
{
return;
}
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
int color = this.fluid.getFluid().getColor(this.fluid);
GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF));
GL11.glDisable(GL11.GL_BLEND);
int amount = Math
.max(Math.min(this.position.height, this.fluid.amount * this.position.height / this.capacity), 1);
int posY = this.position.y + this.position.height - amount;
for (int i = 0; i < this.position.width; i += 16)
{
for (int j = 0; j < amount; j += 16)
{
int drawWidth = Math.min(this.position.width - i, 16);
int drawHeight = Math.min(amount - j, 16);
int drawX = this.position.x + i;
int drawY = posY + j;
double minU = fluidIcon.getMinU();
double maxU = fluidIcon.getMaxU();
double minV = fluidIcon.getMinV();
double maxV = fluidIcon.getMaxV();
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(drawX, drawY + drawHeight, 0, minU,
minV + (maxV - minV) * drawHeight / 16F);
tessellator.addVertexWithUV(drawX + drawWidth, drawY + drawHeight, 0,
minU + (maxU - minU) * drawWidth / 16F, minV + (maxV - minV) * drawHeight / 16F);
tessellator.addVertexWithUV(drawX + drawWidth, drawY, 0, minU + (maxU - minU) * drawWidth / 16F,
minV);
tessellator.addVertexWithUV(drawX, drawY, 0, minU, minV);
tessellator.draw();
}
}
GL11.glEnable(GL11.GL_BLEND);
}
}
}

View file

@ -0,0 +1,6 @@
package com.oitsjustjose.criss_cross.NEI;
public class RecipeHandlerElectroextractor
{
}

View file

@ -0,0 +1,130 @@
package com.oitsjustjose.criss_cross.NEI;
import java.awt.Rectangle;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper.WoodchipperRecipe;
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class RecipeHandlerWoodchipper extends RecipeHandlerBase
{
public class CachedWoodchipperRecipe extends CachedBaseRecipe
{
public PositionedStack input;
public PositionedStack output;
public int time = ConfigHandler.woodchipperProcessTime;
public CachedWoodchipperRecipe(WoodchipperRecipe chipper)
{
this.input = new PositionedStack(chipper.input, 44, 18);
this.output = new PositionedStack(chipper.result, 98, 18);
}
@Override
public PositionedStack getIngredient()
{
return this.input;
}
@Override
public PositionedStack getResult()
{
return this.output;
}
}
@Override
public String getRecipeName()
{
return StatCollector.translateToLocal("crisscross.nei.woodchipper");
}
@Override
public String getRecipeID()
{
return "crisscross.woodchipper";
}
@Override
public void loadTransferRects()
{
this.transferRects
.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 15), this.getRecipeID(), new Object[0]));
}
@Override
public String getGuiTexture()
{
return "crisscross:textures/gui/woodchipper.png";
}
@Override
public void drawBackground(int recipe)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(this.getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 160, 65);
}
@Override
public void drawExtras(int recipe)
{
int time = ((CachedWoodchipperRecipe) this.arecipes.get(recipe)).time;
int seconds = time / 20;
GuiDraw.drawStringC(time + " ticks (" + seconds + " secs)", 81, 40, 0x808080, false);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if (outputId.equals(this.getRecipeID()))
{
ArrayList<ItemStack> inputs = TileEntityWoodchipper.getInputs();
ArrayList<ItemStack> outputs = TileEntityWoodchipper.getOutputs();
for (int i = 0; i < inputs.size(); i++)
{
WoodchipperRecipe recipe = new WoodchipperRecipe(inputs.get(i), outputs.get(i));
this.arecipes.add(new CachedWoodchipperRecipe(recipe));
}
} else
{
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result)
{
WoodchipperRecipe recipe = new WoodchipperRecipe(TileEntityWoodchipper.getItemFromResult(result), result);
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.result, result))
{
this.arecipes.add(new CachedWoodchipperRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingred)
{
WoodchipperRecipe recipe = new WoodchipperRecipe(ingred, TileEntityWoodchipper.getResult(ingred));
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingred))
{
this.arecipes.add(new CachedWoodchipperRecipe(recipe));
}
}
}

View file

@ -13,7 +13,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
public class CRecipes public class CCRecipes
{ {
public static void init() public static void init()
{ {
@ -27,27 +27,22 @@ public class CRecipes
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
{ {
CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + "could not be added as part of the recipe of the Woodchipper."); CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem
+ "could not be added as part of the recipe of the Woodchipper.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[]
{ { "I#I", "SCS", "I#I", '#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem });
"I#I",
"SCS",
"I#I",
'#', Items.diamond_axe, 'I', Blocks.iron_bars, 'S', Items.golden_axe, 'C', centerItem
});
} }
static void electroextractorRecipe() static void electroextractorRecipe()
@ -55,28 +50,23 @@ public class CRecipes
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
{ {
CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + " could not be added as part of the recipe of the electroextractor."); CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem
+ " could not be added as part of the recipe of the electroextractor.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[]
{ { "I#I", "SCS", "I#I", '#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem });
"I#I",
"SCS",
"I#I",
'#', Blocks.piston, 'I', Blocks.iron_bars, 'S', Items.golden_pickaxe, 'C', centerItem
});
} }
static void cropomatorRecipe() static void cropomatorRecipe()
@ -84,26 +74,21 @@ public class CRecipes
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
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + " could not be added as part of the recipe of the cropomator."); CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem
+ " could not be added as part of the recipe of the cropomator.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[]
{ { "I#I", "SCS", "I#I", '#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem });
"I#I",
"SCS",
"I#I",
'#', Blocks.hay_block, 'I', Items.iron_ingot, 'S', Items.golden_hoe, 'C', centerItem
});
} }
} }

View file

@ -12,38 +12,41 @@ public class CropomatorRecipes
{ {
public static void initRecipes() public static void initRecipes()
{ {
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)
TileEntityCropomator.addItemStackToOutputs(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); TileEntityCropomator
.addItemStackToOutputs(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
else else
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
+ " could not be added to the Cropomator's recipe list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
if(unlocStack.length == 3) if (unlocStack.length == 3)
{ {
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
{ {
ItemStack newStack = new ItemStack(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, Integer.parseInt(unlocStack[2])); ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
Integer.parseInt(unlocStack[2]));
TileEntityCropomator.addItemStackToOutputs(newStack); TileEntityCropomator.addItemStackToOutputs(newStack);
} } else
else
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
+ " could not be added to the Cropomator's recipe list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
} } 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));
} }
@ -53,37 +56,40 @@ public class CropomatorRecipes
public static void initCatalysts() public static void initCatalysts()
{ {
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.addItemStackToCatalysts(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); TileEntityCropomator
.addItemStackToCatalysts(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
else else
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
+ " could not be added to the Cropomator's catalyst list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
if(unlocStack.length == 3) if (unlocStack.length == 3)
{ {
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
{ {
ItemStack newStack = new ItemStack(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, Integer.parseInt(unlocStack[2])); ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
Integer.parseInt(unlocStack[2]));
TileEntityCropomator.addItemStackToCatalysts(newStack); TileEntityCropomator.addItemStackToCatalysts(newStack);
} } else
else
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
+ " could not be added to the Cropomator's catalyst list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
} } 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));
} }

View file

@ -28,69 +28,73 @@ public class ElectroextractorRecipes
public static void oreDictionaryInit() public static void oreDictionaryInit()
{ {
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++)
TileEntityElectroextractor.addRecipe(ores.get(j), new ItemStack(CCItems.dusts, 1, dustNames.size() - 1)); TileEntityElectroextractor.addRecipe(ores.get(j),
} new ItemStack(CCItems.dusts, 1, dustNames.size() - 1));
else } else
{ {
CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] + " could not be registered."); CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i]
if(!OreDictionary.doesOreNameExist("ore" + entry[0])) + " could not be registered.");
CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0] + "."); if (!OreDictionary.doesOreNameExist("ore" + entry[0]))
else if(!OreDictionary.doesOreNameExist("ingot" + entry[0])) CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0]
+ ".");
else if (!OreDictionary.doesOreNameExist("ingot" + entry[0]))
CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] + "."); 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);
} }
} }
public static void initFuels() public static void initFuels()
{ {
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
{ {
CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i]
+ " could not be added to the Electroextractor's fuel list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
if(unlocStack.length == 3) if (unlocStack.length == 3)
{ {
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
{ {
ItemStack newStack = new ItemStack(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, Integer.parseInt(unlocStack[2])); ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
Integer.parseInt(unlocStack[2]));
TileEntityElectroextractor.addFuel(newStack); TileEntityElectroextractor.addFuel(newStack);
} } else
else
{ {
CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i]
+ " could not be added to the Electroextractor's fuel list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
} } 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));
} }

View file

@ -22,25 +22,25 @@ public class WoodchipperRecipes
String logName; String logName;
String plankName; String plankName;
for(int i = 0; i < logs.size(); i++) for (int i = 0; i < logs.size(); i++)
{ {
for(int logMeta = 0; logMeta < 16; logMeta++) for (int logMeta = 0; logMeta < 16; logMeta++)
{ {
ItemStack log = new ItemStack(logs.get(i).getItem(), 1, logMeta); ItemStack log = new ItemStack(logs.get(i).getItem(), 1, logMeta);
logName = log.getDisplayName(); logName = log.getDisplayName();
logName = logName.replace("Wood", ""); logName = logName.replace("Wood", "");
logName = logName.trim(); logName = logName.trim();
for(int j = 0; j < planks.size(); j++) for (int j = 0; j < planks.size(); j++)
{ {
for(int plankMeta = 0; plankMeta < 16; plankMeta++) for (int plankMeta = 0; plankMeta < 16; plankMeta++)
{ {
ItemStack plank = new ItemStack(planks.get(j).getItem(), 1, plankMeta); ItemStack plank = new ItemStack(planks.get(j).getItem(), 1, plankMeta);
plankName = plank.getDisplayName(); plankName = plank.getDisplayName();
plankName = plankName.replace("Wood", ""); plankName = plankName.replace("Wood", "");
plankName = plankName.replace("Planks", ""); plankName = plankName.replace("Planks", "");
plankName = plankName.trim(); plankName = plankName.trim();
if(plankName.contains(logName)) if (plankName.contains(logName))
{ {
TileEntityWoodchipper.addRecipe(log, plank); TileEntityWoodchipper.addRecipe(log, plank);
break; break;
@ -53,37 +53,39 @@ public class WoodchipperRecipes
public static void initFuels() public static void initFuels()
{ {
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
{ {
CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i]
+ " could not be added to the Woodchipper's fuel list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
if(unlocStack.length == 3) if (unlocStack.length == 3)
{ {
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
{ {
ItemStack newStack = new ItemStack(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, Integer.parseInt(unlocStack[2])); ItemStack newStack = new ItemStack(
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
Integer.parseInt(unlocStack[2]));
TileEntityWoodchipper.addFuel(newStack); TileEntityWoodchipper.addFuel(newStack);
} } else
else
{ {
CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i]
+ " could not be added to the Woodchipper's fuel list.");
CCLog.warn("Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
} }
} } 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));
} }

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> recipeItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> recipeItems = new ArrayList<ItemStack>();
private static ArrayList<ItemStack> catalystItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> catalystItems = new ArrayList<ItemStack>();
@ -32,6 +35,17 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public int processTime; public int processTime;
public int catalystInUseTime; public int catalystInUseTime;
public static ItemStack getResult(ItemStack input)
{
for (int i = 0; i < recipeItems.size(); i++)
{
ItemStack temp = recipeItems.get(i);
if (ItemStack.areItemStacksEqual(temp, input))
return new ItemStack(temp.getItem(), qty, temp.getItemDamage());
}
return null;
}
@Override @Override
public int getSizeInventory() public int getSizeInventory()
{ {
@ -56,8 +70,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
@ -68,8 +81,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
return itemstack; return itemstack;
} }
} } else
else
{ {
return null; return null;
} }
@ -83,8 +95,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
return null; return null;
} }
@ -140,8 +151,8 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
super.writeToNBT(tag); super.writeToNBT(tag);
tag.setShort("BonemealTime", (short)this.catalystTime); tag.setShort("BonemealTime", (short) this.catalystTime);
tag.setShort("ProcessTime", (short)this.processTime); tag.setShort("ProcessTime", (short) this.processTime);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
@ -149,7 +160,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
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);
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
@ -230,8 +241,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
this.fertilizeItem(); this.fertilizeItem();
flag1 = true; flag1 = true;
} }
} } else
else
{ {
this.processTime = 0; this.processTime = 0;
} }
@ -240,7 +250,8 @@ 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, this.zCoord); BlockCropomator.updateBlockState(this.catalystTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord);
} }
} }
@ -255,14 +266,13 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
if (this.ItemStacks[0] == null) if (this.ItemStacks[0] == null)
{ {
return false; return false;
} } else
else
{ {
ItemStack itemstack = new ItemStack(this.ItemStacks[0].getItem(), qty, this.ItemStacks[0].getItemDamage()); ItemStack itemstack = new ItemStack(this.ItemStacks[0].getItem(), qty, this.ItemStacks[0].getItemDamage());
if(this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
return true; return true;
if(!this.ItemStacks[2].isItemEqual(itemstack)) if (!this.ItemStacks[2].isItemEqual(itemstack))
return false; return false;
int result = ItemStacks[2].stackSize + itemstack.stackSize; int result = ItemStacks[2].stackSize + itemstack.stackSize;
@ -272,9 +282,9 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public static boolean removeItemStackFromOutputs(ItemStack itemstack) public static boolean removeItemStackFromOutputs(ItemStack itemstack)
{ {
for(int i = 0; i < recipeItems.size(); i++) for (int i = 0; i < recipeItems.size(); i++)
{ {
if(recipeItems.get(i) == itemstack) if (recipeItems.get(i) == itemstack)
{ {
recipeItems.remove(i); recipeItems.remove(i);
return true; return true;
@ -305,9 +315,9 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public static boolean removeItemStackFromCatalysts(ItemStack itemstack) public static boolean removeItemStackFromCatalysts(ItemStack itemstack)
{ {
for(int i = 0; i < catalystItems.size(); i++) for (int i = 0; i < catalystItems.size(); i++)
{ {
if(catalystItems.get(i) == itemstack) if (catalystItems.get(i) == itemstack)
{ {
catalystItems.remove(i); catalystItems.remove(i);
return true; return true;
@ -318,10 +328,10 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public static boolean isValidForCropomator(ItemStack itemstack) public static boolean isValidForCropomator(ItemStack itemstack)
{ {
for(int i = 0; i < recipeItems.size(); i++) for (int i = 0; i < recipeItems.size(); i++)
{ {
ItemStack temp = recipeItems.get(i); ItemStack temp = recipeItems.get(i);
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
return true; return true;
} }
@ -337,8 +347,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
if (this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
{ {
this.ItemStacks[2] = output.copy(); this.ItemStacks[2] = output.copy();
} } else if (this.ItemStacks[2].getItem() == output.getItem())
else if (this.ItemStacks[2].getItem() == output.getItem())
{ {
this.ItemStacks[2].stackSize += output.stackSize; this.ItemStacks[2].stackSize += output.stackSize;
} }
@ -359,10 +368,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 < catalystItems.size(); i++) for (int i = 0; i < catalystItems.size(); i++)
{ {
ItemStack temp = catalystItems.get(i); ItemStack temp = catalystItems.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;
@ -370,12 +379,18 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory(){} public void openInventory()
{
}
public void closeInventory(){} public void closeInventory()
{
}
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
@ -402,5 +417,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
} }
@Override @Override
public void markDirty(){} public void markDirty()
{
}
} }

View file

@ -21,9 +21,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> inputItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> inputItems = new ArrayList<ItemStack>();
private static ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>();
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
@ -34,6 +37,16 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
public int crushTime; public int crushTime;
public int fuelInUseTime; public int fuelInUseTime;
public static ItemStack getResult(ItemStack input)
{
for (int i = 0; i < inputItems.size(); i++)
{
ItemStack temp = inputItems.get(i);
if (ItemStack.areItemStacksEqual(temp, input))
return new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
}
return null;
}
@Override @Override
public int getSizeInventory() public int getSizeInventory()
@ -59,8 +72,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
@ -71,8 +83,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
return itemstack; return itemstack;
} }
} } else
else
{ {
return null; return null;
} }
@ -86,8 +97,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
return null; return null;
} }
@ -143,8 +153,8 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
super.writeToNBT(tag); super.writeToNBT(tag);
tag.setShort("Energy", (short)this.fuelTime); tag.setShort("Energy", (short) this.fuelTime);
tag.setShort("CrushTime", (short)this.crushTime); tag.setShort("CrushTime", (short) this.crushTime);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
@ -152,7 +162,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
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);
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
@ -233,8 +243,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
this.crushItem(); this.crushItem();
flag1 = true; flag1 = true;
} }
} } else
else
{ {
this.crushTime = 0; this.crushTime = 0;
} }
@ -243,7 +252,8 @@ 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, this.zCoord); BlockElectroextractor.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord);
} }
} }
@ -258,24 +268,24 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
if (this.ItemStacks[0] == null) if (this.ItemStacks[0] == null)
{ {
return false; return false;
} } else
else
{ {
ItemStack output = null; ItemStack output = null;
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i).getItem() == ItemStacks[0].getItem() && inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage()) if (inputItems.get(i).getItem() == ItemStacks[0].getItem()
&& inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage())
{ {
output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage()); output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
} }
} }
if(output == null) if (output == null)
return false; return false;
if(this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
return true; return true;
if(!this.ItemStacks[2].isItemEqual(output)) if (!this.ItemStacks[2].isItemEqual(output))
return false; return false;
int result = ItemStacks[2].stackSize + output.stackSize; int result = ItemStacks[2].stackSize + output.stackSize;
@ -285,9 +295,9 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
public static boolean removeRecipe(ItemStack itemstack) public static boolean removeRecipe(ItemStack itemstack)
{ {
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i) == itemstack) if (inputItems.get(i) == itemstack)
{ {
inputItems.remove(i); inputItems.remove(i);
outputItems.remove(i); outputItems.remove(i);
@ -322,9 +332,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;
@ -335,10 +345,10 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
public static boolean isValidForElectroextractor(ItemStack itemstack) public static boolean isValidForElectroextractor(ItemStack itemstack)
{ {
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
ItemStack temp = inputItems.get(i); ItemStack temp = inputItems.get(i);
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
return true; return true;
} }
@ -351,24 +361,25 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
{ {
ItemStack output = null; ItemStack output = null;
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i).getItem() == ItemStacks[0].getItem() && inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage()) if (inputItems.get(i).getItem() == ItemStacks[0].getItem()
&& inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage())
{ {
output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage()); output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
if(output.getItem() instanceof ItemDust) if (output.getItem() instanceof ItemDust)
output.setStackDisplayName("Electrolytic " + ItemDust.getName(outputItems.get(i).getItemDamage()) + " Dust"); output.setStackDisplayName(
"Electrolytic " + ItemDust.getName(outputItems.get(i).getItemDamage()) + " Dust");
} }
} }
if(output == null) if (output == null)
return; return;
if (this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
{ {
this.ItemStacks[2] = output.copy(); this.ItemStacks[2] = output.copy();
} } else if (this.ItemStacks[2].getItem() == output.getItem())
else if (this.ItemStacks[2].getItem() == output.getItem())
{ {
this.ItemStacks[2].stackSize += output.stackSize; this.ItemStacks[2].stackSize += output.stackSize;
} }
@ -389,10 +400,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;
@ -400,12 +411,18 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory(){} public void openInventory()
{
}
public void closeInventory(){} public void closeInventory()
{
}
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
@ -432,5 +449,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
} }
@Override @Override
public void markDirty(){} public void markDirty()
{
}
} }

View file

@ -20,9 +20,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> inputItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> inputItems = new ArrayList<ItemStack>();
private static ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>();
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>(); private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
@ -33,6 +36,43 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
public int processTime; public int processTime;
public int fuelUsetime; public int fuelUsetime;
public static ItemStack getItemFromResult(ItemStack output)
{
for (int i = 0; i < outputItems.size(); i++)
{
ItemStack temp = outputItems.get(i);
if (ItemStack.areItemStacksEqual(temp, output))
return new ItemStack(inputItems.get(i).getItem(), qty, inputItems.get(i).getItemDamage());
}
return null;
}
public static ItemStack getResult(ItemStack input)
{
for (int i = 0; i < inputItems.size(); i++)
{
ItemStack temp = inputItems.get(i);
if (ItemStack.areItemStacksEqual(temp, input))
return new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
}
return null;
}
public static ArrayList<ItemStack> getInputs()
{
return inputItems;
}
public static ArrayList<ItemStack> getOutputs()
{
return outputItems;
}
public static ArrayList<ItemStack> getFuels()
{
return fuelItems;
}
@Override @Override
public int getSizeInventory() public int getSizeInventory()
{ {
@ -57,8 +97,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
itemstack = this.ItemStacks[slot]; itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
itemstack = this.ItemStacks[slot].splitStack(qtyToDecr); itemstack = this.ItemStacks[slot].splitStack(qtyToDecr);
@ -69,8 +108,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
return itemstack; return itemstack;
} }
} } else
else
{ {
return null; return null;
} }
@ -84,8 +122,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
ItemStack itemstack = this.ItemStacks[slot]; ItemStack itemstack = this.ItemStacks[slot];
this.ItemStacks[slot] = null; this.ItemStacks[slot] = null;
return itemstack; return itemstack;
} } else
else
{ {
return null; return null;
} }
@ -141,8 +178,8 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
public void writeToNBT(NBTTagCompound tag) public void writeToNBT(NBTTagCompound tag)
{ {
super.writeToNBT(tag); super.writeToNBT(tag);
tag.setShort("FuelTime", (short)this.fuelTime); tag.setShort("FuelTime", (short) this.fuelTime);
tag.setShort("WorkTime", (short)this.processTime); tag.setShort("WorkTime", (short) this.processTime);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.ItemStacks.length; ++i) for (int i = 0; i < this.ItemStacks.length; ++i)
@ -150,7 +187,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
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);
this.ItemStacks[i].writeToNBT(nbttagcompound1); this.ItemStacks[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1);
} }
@ -231,8 +268,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
this.processItem(); this.processItem();
flag1 = true; flag1 = true;
} }
} } else
else
{ {
this.processTime = 0; this.processTime = 0;
} }
@ -241,7 +277,8 @@ 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, this.zCoord); BlockWoodchipper.updateBlockState(this.fuelTime > 0, this.worldObj, this.xCoord, this.yCoord,
this.zCoord);
} }
} }
@ -256,24 +293,24 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
if (this.ItemStacks[0] == null) if (this.ItemStacks[0] == null)
{ {
return false; return false;
} } else
else
{ {
ItemStack output = null; ItemStack output = null;
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i).getItem() == ItemStacks[0].getItem() && inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage()) if (inputItems.get(i).getItem() == ItemStacks[0].getItem()
&& inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage())
{ {
output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage()); output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
} }
} }
if(output == null) if (output == null)
return false; return false;
if(this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
return true; return true;
if(!this.ItemStacks[2].isItemEqual(output)) if (!this.ItemStacks[2].isItemEqual(output))
return false; return false;
int result = ItemStacks[2].stackSize + output.stackSize; int result = ItemStacks[2].stackSize + output.stackSize;
@ -283,9 +320,9 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
public static boolean removeRecipe(ItemStack itemstack) public static boolean removeRecipe(ItemStack itemstack)
{ {
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i) == itemstack) if (inputItems.get(i) == itemstack)
{ {
inputItems.remove(i); inputItems.remove(i);
outputItems.remove(i); outputItems.remove(i);
@ -320,9 +357,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;
@ -333,10 +370,10 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
public static boolean isValidForWoodchipper(ItemStack itemstack) public static boolean isValidForWoodchipper(ItemStack itemstack)
{ {
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
ItemStack temp = inputItems.get(i); ItemStack temp = inputItems.get(i);
if(temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage()) if (temp.getItem() == itemstack.getItem() && temp.getItemDamage() == itemstack.getItemDamage())
return true; return true;
} }
@ -348,22 +385,22 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
if (this.canProcess()) if (this.canProcess())
{ {
ItemStack output = null; ItemStack output = null;
for(int i = 0; i < inputItems.size(); i++) for (int i = 0; i < inputItems.size(); i++)
{ {
if(inputItems.get(i).getItem() == ItemStacks[0].getItem() && inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage()) if (inputItems.get(i).getItem() == ItemStacks[0].getItem()
&& inputItems.get(i).getItemDamage() == ItemStacks[0].getItemDamage())
{ {
output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage()); output = new ItemStack(outputItems.get(i).getItem(), qty, outputItems.get(i).getItemDamage());
} }
} }
if(output == null) if (output == null)
return; return;
if (this.ItemStacks[2] == null) if (this.ItemStacks[2] == null)
{ {
this.ItemStacks[2] = output.copy(); this.ItemStacks[2] = output.copy();
} } else if (this.ItemStacks[2].getItem() == output.getItem())
else if (this.ItemStacks[2].getItem() == output.getItem())
{ {
this.ItemStacks[2].stackSize += output.stackSize; this.ItemStacks[2].stackSize += output.stackSize;
} }
@ -384,10 +421,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;
@ -396,12 +433,18 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
public boolean isUseableByPlayer(EntityPlayer player) public boolean isUseableByPlayer(EntityPlayer player)
{ {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false
: player.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D,
(double) this.zCoord + 0.5D) <= 64.0D;
} }
public void openInventory(){} public void openInventory()
{
}
public void closeInventory(){} public void closeInventory()
{
}
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) public boolean isItemValidForSlot(int slot, ItemStack itemstack)
@ -428,5 +471,31 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
} }
@Override @Override
public void markDirty(){} public void markDirty()
{
}
public static class WoodchipperRecipe
{
public final int time;
public final ItemStack input;
public final ItemStack result;
public WoodchipperRecipe(ItemStack input, ItemStack result)
{
this.time = ConfigHandler.woodchipperProcessTime;
this.input = input;
this.result = result;
}
public boolean matches(ItemStack input)
{
return ItemStack.areItemStacksEqual(this.input, input);
}
public ItemStack getResult()
{
return result.copy();
}
}
} }

View file

@ -2,6 +2,11 @@ package com.oitsjustjose.criss_cross.Util;
public class CommonProxy public class CommonProxy
{ {
public void preInit(){}; public void preInit()
public void init(){}; {
};
public void init()
{
};
} }

View file

@ -16,19 +16,13 @@ public class ConfigHandler
public static String[] cropomatorInputs; public static String[] cropomatorInputs;
public static String[] cropomatorCatalysts; public static String[] cropomatorCatalysts;
public static String[] defaultCropomatorInputs = new String[] public static String[] defaultCropomatorInputs = new String[]
{ { "minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:carrot", "minecraft:cactus",
"minecraft:apple", "minecraft:reeds", "minecraft:nether_wart", "minecraft:potato", "minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2",
"minecraft:carrot", "minecraft:cactus", "minecraft:potato", "minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:melon",
"minecraft:sapling:0", "minecraft:sapling:1", "minecraft:sapling:2", "minecraft:brown_mushroom", "minecraft:red_mushroom", "minecraft:cocoa", "minecraft:pumpkin",
"minecraft:sapling:3", "minecraft:sapling:4", "minecraft:sapling:5", "minecraft:wheat", "minecraft:wheat_seeds" };
"minecraft:melon", "minecraft:brown_mushroom", "minecraft:red_mushroom",
"minecraft:cocoa", "minecraft:pumpkin", "minecraft:wheat",
"minecraft:wheat_seeds"
};
public static String[] defaultCropomatorCatalystItems = new String[] public static String[] defaultCropomatorCatalystItems = new String[]
{ { "minecraft:dye:15" };
"minecraft:dye:15"
};
public static int electroextractorProcessTime; public static int electroextractorProcessTime;
public static int electroextractorOutput; public static int electroextractorOutput;
@ -36,25 +30,18 @@ public class ConfigHandler
public static String[] electroextractorEnergySources; public static String[] electroextractorEnergySources;
public static String[] electroextractorOreDictInputs; public static String[] electroextractorOreDictInputs;
public static String[] defaultElectroextractorOreDictInputs = new String[] public static String[] defaultElectroextractorOreDictInputs = new String[]
{ { "Iron:12428902", "Gold:15400704", "Aluminum:15987699", "Cobalt:17663", "Ardite:13938485", "Copper:16751872",
"Iron:12428902", "Gold:15400704", "Aluminum:15987699", "Tin:15132390", "Silver:13297640", "Lead:5722979", "Platinum:11067903", "Mithril:4433113",
"Cobalt:17663", "Ardite:13938485", "Copper:16751872", "Nickel:16580553" };
"Tin:15132390", "Silver:13297640", "Lead:5722979",
"Platinum:11067903", "Mithril:4433113", "Nickel:16580553"
};
public static String[] defaultElectroextractorEnergySources = new String[] public static String[] defaultElectroextractorEnergySources = new String[]
{ { "minecraft:redstone_block" };
"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[] public static String[] defaultWoodchipperFuels = new String[]
{ { "minecraft:water_bucket", "minecraft:potion:0" };
"minecraft:water_bucket", "minecraft:potion:0"
};
public static void init(File configFile) public static void init(File configFile)
{ {
@ -68,50 +55,69 @@ public class ConfigHandler
private static void loadConfiguration() private static void loadConfiguration()
{ {
//Cropomator Configs // Cropomator Configs
cropomatorInputs = config.get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs, cropomatorInputs = config
"A list of items to be added to the Cropomator's recipe list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.").getStringList(); .get(config.CATEGORY_GENERAL, "Cropomator's Recipe Items.", defaultCropomatorInputs,
"A list of items to be added to the Cropomator's recipe list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList();
cropomatorCatalysts = config.get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems, cropomatorCatalysts = config
"A list of items to be added to the Cropomator's catalyst list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.").getStringList(); .get(config.CATEGORY_GENERAL, "Cropomator's Catalyst Items.", defaultCropomatorCatalystItems,
"A list of items to be added to the Cropomator's catalyst list. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList();
cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1, Short.MAX_VALUE, cropomatorProcessTime = config.getInt("Cropomator Processing Time", config.CATEGORY_GENERAL, 150, 1,
Short.MAX_VALUE,
"Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200."); "Control how many ticks it takes the Cropomator to process an item. Default is 150; furnaces are 200.");
cropomatorOutput = config.getInt("Cropomator Output Quantity", config.CATEGORY_GENERAL, 3, 0, 64, cropomatorOutput = config.getInt("Cropomator Output Quantity", config.CATEGORY_GENERAL, 3, 0, 64,
"Control how many of the input item you get as the output item. Default is 3."); "Control how many of the input item you get as the output item. Default is 3.");
cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", cropomatorRecipeItem = config.getString("Cropomator Crafting Item.", config.CATEGORY_GENERAL,
"minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); "This is the item located in the center of the crafting recipe for the Cropomator. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
//Electroextractor's Configs // Electroextractor's Configs
electroextractorEnergySources = config.get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources, electroextractorEnergySources = config
"A list of items to be added as the Electroextractor's energy sources. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.").getStringList(); .get(config.CATEGORY_GENERAL, "Electroextractor's Fuel Items.", defaultElectroextractorEnergySources,
"A list of items to be added as the Electroextractor's energy sources. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList();
electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0, Short.MAX_VALUE, electroextractorProcessTime = config.getInt("Electroextractor Processing Time", config.CATEGORY_GENERAL, 250, 0,
Short.MAX_VALUE,
"Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200."); "Control how many ticks it takes the Electroextractor to process an item. Default is 250; furnaces are 200.");
electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64, electroextractorOutput = config.getInt("Electroextractor Output Quantity", config.CATEGORY_GENERAL, 2, 0, 64,
"Control how many dusts you get as the output. Default is 2."); "Control how many dusts you get as the output. Default is 2.");
electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL, "minecraft:diamond_block", electroextractorRecipeItem = config.getString("Electroextractor Crafting Item.", config.CATEGORY_GENERAL,
"minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>."); "This is the item located in the center of the crafting recipe for the Electroextractor. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.");
electroextractorOreDictInputs = config.get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.", defaultElectroextractorOreDictInputs, electroextractorOreDictInputs = config
"Formatted as <OreDictName>:<DecimalColorYouWant>." + "\n" + " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')" + "\n" .get(config.CATEGORY_GENERAL, "Electroextractor OreDictionary Entries.",
+ "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.").getStringList(); defaultElectroextractorOreDictInputs,
"Formatted as <OreDictName>:<DecimalColorYouWant>." + "\n"
+ " Remove the 'ore' part of the oredict name (i.e. 'oreIron' should be entered as 'Iron')"
+ "\n"
+ "Use http://www.colorpicker.com/ to find a color and http://bit.ly/1RhPhcX to convert it from Hex to Decimal.")
.getStringList();
//Woodchipper's Configs // Woodchipper's Configs
woodchipperFuels = config.get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels, woodchipperFuels = config
"A list of items to be added as the Woodchipper's 'fuels'. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.").getStringList(); .get(config.CATEGORY_GENERAL, "Woodchipper Fuel Items", defaultWoodchipperFuels,
"A list of items to be added as the Woodchipper's 'fuels'. Formatted as: <modid>:<item>:<meta> or <modid>:<item>.")
.getStringList();
woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0, Short.MAX_VALUE, woodchipperProcessTime = config.getInt("Woodchipper Process Time", config.CATEGORY_GENERAL, 400, 0,
Short.MAX_VALUE,
"Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200."); "Control how many ticks it takes the Woodchipper to process an item. Default is 400; furnaces are 200.");
woodchipperOutput = config.getInt("Woodchipper Output Quantity", config.CATEGORY_GENERAL, 6, 0, 64, woodchipperOutput = config.getInt("Woodchipper Output Quantity", config.CATEGORY_GENERAL, 6, 0, 64,
"Control how many planks are yielded from processing a log. Default is 6."); "Control how many planks are yielded from processing a log. Default is 6.");
woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, "minecraft:diamond_block", woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL,
"minecraft:diamond_block",
"This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: <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())

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