From 87d630ca0abe07045002b0be1bb4059ff3f2a2c6 Mon Sep 17 00:00:00 2001 From: reidbhuntley Date: Sat, 24 Jul 2021 17:08:50 -0400 Subject: [PATCH] Little ones - Fixed crash when simultaneously converting and destroying a Peculiar Bell (#2008) - Fixed Stockpile Switch not updating its signal when the inventory it's watching is moved (#1980) - Fixed Potato Cannon projectiles being able to move players in creative mode (#1950) - Fixed Lectern Controller not rendering buttons when being used by a different player --- .../curiosities/bell/PeculiarBellBlock.java | 3 +++ .../weapons/PotatoProjectileEntity.java | 3 +-- .../redstone/StockpileSwitchTileEntity.java | 15 +++++++++--- .../item/LinkedControllerItemRenderer.java | 23 ++++++++----------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellBlock.java b/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellBlock.java index 054b37668..e701844c1 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellBlock.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellBlock.java @@ -62,6 +62,9 @@ public class PeculiarBellBlock extends AbstractBellBlock } protected BlockState tryConvert(IWorld world, BlockPos pos, BlockState state, BlockState underState) { + if (!AllBlocks.PECULIAR_BELL.has(state)) + return state; + Block underBlock = underState.getBlock(); if (!(Blocks.SOUL_FIRE.is(underBlock) || Blocks.SOUL_CAMPFIRE.is(underBlock))) return state; diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java index 982773df5..6d7fd45db 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java @@ -31,7 +31,6 @@ import net.minecraft.util.IndirectEntityDamageSource; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.EntityRayTraceResult; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; @@ -222,7 +221,7 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements if (type.getReloadTicks() < 10) livingentity.invulnerableTime = type.getReloadTicks() + 10; - if (knockback > 0) { + if (onServer && knockback > 0) { Vector3d appliedMotion = this.getDeltaMovement() .multiply(1.0D, 0.0D, 1.0D) .normalize() diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java index 27cb20f2a..6aaf61976 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java @@ -8,12 +8,14 @@ import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBe import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour.InterfaceProvider; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.ITickList; import net.minecraft.world.TickPriority; import net.minecraftforge.items.IItemHandler; @@ -75,8 +77,8 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { level.setBlock(worldPosition, getBlockState().setValue(StockpileSwitchBlock.INDICATOR, 0), 3); currentLevel = -1; state = false; - level.blockUpdated(worldPosition, getBlockState().getBlock()); sendData(); + scheduleBlockTick(); return; } @@ -116,13 +118,20 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { displayLevel = (int) (currentLevel * 6); level.setBlock(worldPosition, getBlockState().setValue(StockpileSwitchBlock.INDICATOR, displayLevel), update ? 3 : 2); - if (update && !level.getBlockTicks().willTickThisTick(worldPosition, getBlockState().getBlock())) - level.getBlockTicks().scheduleTick(worldPosition, getBlockState().getBlock(), 2, TickPriority.NORMAL); + if (update) + scheduleBlockTick(); if (changed || update) sendData(); } + protected void scheduleBlockTick() { + ITickList blockTicks = level.getBlockTicks(); + Block block = getBlockState().getBlock(); + if (!blockTicks.willTickThisTick(worldPosition, block)) + blockTicks.scheduleTick(worldPosition, block, 2, TickPriority.NORMAL); + } + @Override public void lazyTick() { super.lazyTick(); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItemRenderer.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItemRenderer.java index a94056ca9..e82a57735 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItemRenderer.java @@ -103,11 +103,6 @@ public class LinkedControllerItemRenderer extends CustomRenderedItemModelRendere renderer.render(active ? model.getPartial("powered") : model.getOriginalModel(), light); - if (!usedByMe) { - ms.popPose(); - return; - } - IBakedModel button = model.getPartial("button"); float s = 1 / 16f; float b = s * -.75f; @@ -120,28 +115,28 @@ public class LinkedControllerItemRenderer extends CustomRenderedItemModelRendere ms.pushPose(); msr.translate(2 * s, 0, 8 * s); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); msr.translate(4 * s, 0, 0); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); msr.translate(-2 * s, 0, 2 * s); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); msr.translate(0, 0, -4 * s); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); ms.popPose(); msr.translate(3 * s, 0, 3 * s); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); msr.translate(2 * s, 0, 0); - button(renderer, ms, light, pt, button, b, index++); + button(renderer, ms, light, pt, button, b, index++, usedByMe); ms.popPose(); } protected static void button(PartialItemModelRenderer renderer, MatrixStack ms, int light, float pt, IBakedModel button, - float b, int index) { + float b, int index, boolean usedByMe) { ms.pushPose(); - ms.translate(0, b * buttons.get(index) - .getValue(pt), 0); + float depression = usedByMe ? b * buttons.get(index).getValue(pt) : 0; + ms.translate(0, depression, 0); renderer.renderSolid(button, light); ms.popPose(); }