commit
33c4fe5e16
|
@ -48,6 +48,10 @@ public enum ChestChangerType {
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IronChestType getSource(){
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canUpgrade(IronChestType from)
|
public boolean canUpgrade(IronChestType from)
|
||||||
{
|
{
|
||||||
return from == this.source;
|
return from == this.source;
|
||||||
|
@ -75,7 +79,7 @@ public enum ChestChangerType {
|
||||||
{
|
{
|
||||||
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
Object targetMaterial = IronChestType.translateOreName(targetMat);
|
||||||
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
Object sourceMaterial = IronChestType.translateOreName(sourceMat);
|
||||||
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', Blocks.glass, 'O', Blocks.obsidian);
|
IronChestType.addRecipe(new ItemStack(item), recipe, 'm', targetMaterial, 's', sourceMaterial, 'G', "blockGlass", 'O', Blocks.obsidian);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package cpw.mods.ironchest;
|
package cpw.mods.ironchest;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockChest;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -38,6 +39,15 @@ public class ItemChestChanger extends Item
|
||||||
{
|
{
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return false;
|
return false;
|
||||||
|
if(this.type.canUpgrade(IronChestType.WOOD)){
|
||||||
|
if(!(world.getBlockState(pos).getBlock() instanceof BlockChest)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(world.getBlockState(pos) != IronChest.ironChestBlock.getStateFromMeta(IronChestType.valueOf(type.getSource().getName().toUpperCase()).ordinal())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||||
ItemStack[] chestContents = new ItemStack[27];
|
ItemStack[] chestContents = new ItemStack[27];
|
||||||
|
@ -59,7 +69,7 @@ public class ItemChestChanger extends Item
|
||||||
chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
|
chestContents = new ItemStack[((TileEntityChest) te).getSizeInventory()];
|
||||||
for (int i = 0; i < chestContents.length; i++)
|
for (int i = 0; i < chestContents.length; i++)
|
||||||
chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
|
chestContents[i] = ((TileEntityChest) te).getStackInSlot(i);
|
||||||
newchest = IronChestType.makeEntity(IronChestType.IRON.ordinal());
|
newchest = IronChestType.makeEntity(this.getTargetChestOrdinal(this.type.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue