modified the updated logic for the crucible to write to nbt state changes
This commit is contained in:
@@ -70,7 +70,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
if (recipe != null) {
|
||||
tile.setDrops(recipe.getDropsRaw());
|
||||
}
|
||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state));
|
||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
|
||||
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
return true;
|
||||
}
|
||||
@@ -87,6 +87,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
tile.ingList.set(i-1, pItem1);
|
||||
pItem.shrink(1);
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, i), 2);
|
||||
tile.setHot(i);
|
||||
tile.update();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
@@ -106,6 +107,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
|
||||
tile.setHot(0);
|
||||
tile.update();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
@@ -119,6 +121,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, tile.getDrops());
|
||||
tile.setStatus(false);
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
|
||||
tile.setHot(0);
|
||||
tile.update();
|
||||
tile.markDirty();
|
||||
return true;
|
||||
@@ -143,10 +146,9 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
return this.takeBlock(world, pos, state, EnumFacing.UP, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(World world, BlockPos pos, IBlockState state)
|
||||
public ItemStack getCrucibleItem(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
return NBTHelper.getStackBlockNBT(world, pos, state, super.getItem(world, pos, state));
|
||||
return NBTHelper.getStackBlockNBT(world, pos, state, super.getPickBlock(state, null, world, pos, player));
|
||||
}
|
||||
|
||||
public boolean takeBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player)
|
||||
@@ -154,7 +156,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileNBTCrucible) {
|
||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state));
|
||||
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
|
||||
return world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
|
||||
}
|
||||
}
|
||||
@@ -192,7 +194,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
|
||||
ItemStack temp = stack.copy();
|
||||
int i = temp.getItem().getMetadata(stack.getMetadata());
|
||||
//TODO update this with number instead of the boolean
|
||||
world.setBlockState(pos, getStateFromMeta(i), 2);
|
||||
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, tile.getHot()), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,14 +276,11 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{
|
||||
NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy();
|
||||
NBTTagCompound defaultNBT = this.slotList.get(0).getTagCompound();
|
||||
if (tag != null) {
|
||||
System.out.println(tag);
|
||||
System.out.println(defaultNBT);
|
||||
ItemBlock temp = (ItemBlock) slotList.get(0).getItem();
|
||||
int i = this.getMetadata(slotList.get(0).getMetadata());
|
||||
IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitx, hity, hitz, i, player, hand);
|
||||
temp.placeBlockAt(slotList.get(0), player, world, pos.up(1), face, hitx, hity, hitz, iblockstate1);
|
||||
slotList.set(0, ItemStack.EMPTY);
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user