Skip to content

Commit

Permalink
Remove need for block var in ForgeChestItem
Browse files Browse the repository at this point in the history
  • Loading branch information
JT122406 committed Nov 12, 2024
1 parent 2bd2398 commit 4bc2c0f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@

public class ForgeChestItem extends ForgeBlockItem {

private final Supplier<? extends Block> block;

public ForgeChestItem(Supplier<? extends Block> block, Properties properties) {
super(block, properties, 300);
this.block = block;
}

@Override
Expand All @@ -35,9 +32,9 @@ public BlockEntityWithoutLevelRenderer getCustomRenderer() {
return new BlockEntityWithoutLevelRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()) {
@Override
public void renderByItem(@NotNull ItemStack stack, @NotNull ItemDisplayContext displayContext, @NotNull PoseStack poseStack, @NotNull MultiBufferSource buffer, int packedLight, int packedOverlay) {
if (block.get() instanceof WWGTrappedChestBlock)
Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(new WWGTrappedChestBlockEntity(BlockPos.ZERO, block.get().defaultBlockState()), poseStack, buffer, packedLight, packedOverlay);
else Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(new WWGChestBlockEntity(BlockPos.ZERO, block.get().defaultBlockState()), poseStack, buffer, packedLight, packedOverlay);
if (getBlock() instanceof WWGTrappedChestBlock)
Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(new WWGTrappedChestBlockEntity(BlockPos.ZERO, getBlock().defaultBlockState()), poseStack, buffer, packedLight, packedOverlay);
else Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(new WWGChestBlockEntity(BlockPos.ZERO, getBlock().defaultBlockState()), poseStack, buffer, packedLight, packedOverlay);
}
};
}
Expand Down

0 comments on commit 4bc2c0f

Please sign in to comment.