Skip to content

Commit

Permalink
Fixed barrel itemstack model
Browse files Browse the repository at this point in the history
  • Loading branch information
DisasterMoo committed Sep 12, 2019
1 parent b5f398a commit 3b4d2bd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/main/java/net/dries007/tfc/client/ClientRegisterEvents.java
Expand Up @@ -159,8 +159,19 @@ public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack)

for (ItemBlock item : BlocksTFC.getAllBarrelItemBlocks())
{
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "sealed=false"));
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(item.getRegistryName(), "sealed=true"));
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
{
@Override
@Nonnull
public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack)
{
if (stack.getTagCompound() != null)
{
return new ModelResourceLocation(item.getRegistryName(), "sealed=true");
}
return new ModelResourceLocation(item.getRegistryName(), "sealed=false");
}
});
}

// BLOCKS - STATE MAPPERS //
Expand Down
Expand Up @@ -95,7 +95,7 @@ else if (state.getBlock() instanceof BlockLiquid)

nbt.setLong("sealedTick", CalendarTFC.TOTAL_TIME.getTicks());
nbt.setLong("sealedCalendarTick", CalendarTFC.CALENDAR_TIME.getTicks());
ItemStack stack = new ItemStack(player.getHeldItem(hand).getItem(), 1, 1);
ItemStack stack = new ItemStack(player.getHeldItem(hand).getItem());
stack.setTagCompound(nbt);
player.setHeldItem(hand, stack);
return EnumActionResult.SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/dries007/tfc/objects/te/TEBarrel.java
Expand Up @@ -342,7 +342,7 @@ public void onBreakBlock(World world, BlockPos pos, IBlockState state)
if (state.getValue(SEALED))
{
// Drop the sealed barrel
ItemStack stack = new ItemStack(state.getBlock(), 1, 1);
ItemStack stack = new ItemStack(state.getBlock());
stack.setTagCompound(getItemTag());
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), stack);
}
Expand Down

0 comments on commit 3b4d2bd

Please sign in to comment.