This commit is contained in:
The_Fireplace 2015-07-30 17:03:00 -05:00
parent a3899f4034
commit 34036bdff1
2 changed files with 14 additions and 0 deletions

View File

@ -47,6 +47,10 @@ public enum ChestChangerType {
this.descriptiveName = descriptiveName; this.descriptiveName = descriptiveName;
this.recipe = recipe; this.recipe = recipe;
} }
public IronChestType getSource(){
return source;
}
public boolean canUpgrade(IronChestType from) public boolean canUpgrade(IronChestType from)
{ {

View File

@ -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];