Skip to content

Commit

Permalink
Add null checks in pedestal block entity renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-makes-code committed Aug 18, 2023
1 parent f2c3155 commit 0e351e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Mod Properties
version = 0.1.6-blanketcon
version = 0.1.7-blanketcon
maven_group = dev.sweetberry
archives_base_name = wwizardry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.sweetberry.wwizardry.client.render;

import dev.sweetberry.wwizardry.block.AltarPedestalBlock;
import dev.sweetberry.wwizardry.block.entity.AltarPedestalBlockEntity;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.client.render.VertexConsumerProvider;
Expand All @@ -15,7 +16,16 @@ public AltarPedestalBlockEntityRenderer(BlockEntityRendererFactory.Context ctx)
public void beforeRender(AltarPedestalBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
matrices.translate(0.5, 0.9509, 0.5);

var blockState = entity.getWorld().getBlockState(entity.getPos());
var world = entity.getWorld();

if (world == null)
return;

var blockState = world.getBlockState(entity.getPos());

if (!blockState.isOf(AltarPedestalBlock.INSTANCE))
return;

var dir = blockState.get(HorizontalFacingBlock.FACING);

switch (dir) {
Expand Down

0 comments on commit 0e351e5

Please sign in to comment.