From 00be0f57f0cdf5ee0cec6650ebd138ea5401399b Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 22 Oct 2019 00:26:21 +0200 Subject: [PATCH] Last Minute Fixes - 0.1.1a - Added safety check for other Tile Entities blocking two Crushing Wheels, addresses #36 - Overwrote blockzapper preview renders of Fourway-blocks, addresses #21 - Added safety check for Crushing Wheels in null Worlds, addresses #38 --- build.gradle | 2 +- .../contraptions/receivers/CrushingWheelBlock.java | 2 ++ .../receivers/CrushingWheelControllerBlock.java | 10 ++++++---- .../placementHandgun/BuilderGunItemRenderer.java | 14 ++++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 1ac49b931..b25c1e610 100644 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,7 @@ dependencies { minecraft 'net.minecraftforge:forge:1.14.4-28.1.61' // compile against the JEI API but do not include it at runtime - compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.18:api") + compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.10:api") // at runtime, use the full JEI jar runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.10") } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java index 9f5fbccb5..fdf78b7a6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java @@ -76,6 +76,8 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock { public void updateControllers(BlockState state, World world, BlockPos pos, Direction facing) { if (facing.getAxis() == state.get(AXIS) || facing.getAxis().isVertical()) return; + if (world == null) + return; BlockPos controllerPos = pos.offset(facing); BlockPos otherWheelPos = pos.offset(facing, 2); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java index 33e6866f3..2e5cd80b7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelControllerBlock.java @@ -65,10 +65,12 @@ public class CrushingWheelControllerBlock extends Block implements IWithoutBlock super.onLanded(worldIn, entityIn); if (CrushingWheelControllerTileEntity.isFrozen()) return; - CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) worldIn - .getTileEntity(entityIn.getPosition().down()); - if (te == null) + TileEntity tileEntity = worldIn.getTileEntity(entityIn.getPosition().down()); + if (tileEntity == null) return; + if (!(tileEntity instanceof CrushingWheelControllerTileEntity)) + return; + CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) tileEntity; if (te.isOccupied()) return; @@ -96,7 +98,7 @@ public class CrushingWheelControllerBlock extends Block implements IWithoutBlock public void updateSpeed(BlockState state, World world, BlockPos pos) { CrushingWheelControllerTileEntity te = (CrushingWheelControllerTileEntity) world.getTileEntity(pos); - + if (te == null) return; if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) { diff --git a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItemRenderer.java index f7bfe386a..d24df1c94 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItemRenderer.java @@ -12,6 +12,7 @@ import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.C import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem.Components; import net.minecraft.block.BlockState; +import net.minecraft.block.FourWayBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.ItemRenderer; @@ -47,7 +48,7 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer { // Block indicator if (mainModel.showBlock && stack.hasTag() && stack.getTag().contains("BlockUsed")) renderBlockUsed(stack, itemRenderer); - + ClientPlayerEntity player = Minecraft.getInstance().player; boolean leftHanded = player.getPrimaryHand() == HandSide.LEFT; boolean mainHand = player.getHeldItemMainhand() == stack; @@ -73,7 +74,7 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer { // Accelerator spins float angle = worldTime * -25; - if (mainHand || offHand) + if (mainHand || offHand) angle += 360 * animation; angle %= 360; @@ -92,8 +93,13 @@ public class BuilderGunItemRenderer extends ItemStackTileEntityRenderer { GlStateManager.pushMatrix(); GlStateManager.translatef(-0.8F, -0.7F, -0.5F); GlStateManager.scalef(0.25F, 0.25F, 0.25F); - itemRenderer.renderItem(new ItemStack(state.getBlock()), - Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state)); + IBakedModel modelForState = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state); + + if (state.getBlock() instanceof FourWayBlock) + modelForState = Minecraft.getInstance().getItemRenderer() + .getModelWithOverrides(new ItemStack(state.getBlock())); + + itemRenderer.renderItem(new ItemStack(state.getBlock()), modelForState); GlStateManager.popMatrix(); }