From 32cce4e9b9afa0728b4958f005be72902f60ac02 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 9 May 2020 18:32:47 +0200 Subject: [PATCH] Bug-fixes - Reduced tracking range of mounted contraptions - Fixed carpets not able to be pushed directly - Fixed Water Wheels and Belt Tunnels crashing when rendered in a schematic preview --- .../java/com/simibubi/create/AllEntities.java | 16 ++++++++-------- .../contraptions/BlockMovementTraits.java | 2 ++ .../contraptions/piston/PistonContraption.java | 3 ++- .../components/waterwheel/WaterWheelBlock.java | 3 ++- .../block/belts/tunnel/BeltTunnelBlock.java | 12 +++++++----- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllEntities.java b/src/main/java/com/simibubi/create/AllEntities.java index aa9af81f1..4e9c6bfcb 100644 --- a/src/main/java/com/simibubi/create/AllEntities.java +++ b/src/main/java/com/simibubi/create/AllEntities.java @@ -21,12 +21,10 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry; public enum AllEntities { - CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 30, 3, true, - ContraptionEntity::build), - STATIONARY_CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 30, 40, - false, ContraptionEntity::build), - SUPER_GLUE(SuperGlueEntity::new, EntityClassification.MISC, 30, Integer.MAX_VALUE, false, SuperGlueEntity::build), - + CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 5, 3, true, ContraptionEntity::build), + STATIONARY_CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 20, 40, false, ContraptionEntity::build), + SUPER_GLUE(SuperGlueEntity::new, EntityClassification.MISC, 10, Integer.MAX_VALUE, false, SuperGlueEntity::build), + ; private IFactory factory; @@ -53,8 +51,10 @@ public enum AllEntities { for (AllEntities entity : values()) { String id = Lang.asId(entity.name()); ResourceLocation resourceLocation = new ResourceLocation(Create.ID, id); - Builder builder = EntityType.Builder.create(entity.factory, entity.group) - .setTrackingRange(entity.range).setUpdateInterval(entity.updateFrequency) + Builder builder = EntityType.Builder + .create(entity.factory, entity.group) + .setTrackingRange(entity.range) + .setUpdateInterval(entity.updateFrequency) .setShouldReceiveVelocityUpdates(entity.sendVelocity); if (entity.propertyBuilder != null) builder = entity.propertyBuilder.apply(builder); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java index 3063b4f00..55d86719c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java @@ -216,6 +216,8 @@ public class BlockMovementTraits { return state.get(BlockStateProperties.HORIZONTAL_FACING) == facing; if (AllBlocks.ROPE_PULLEY.typeOf(state)) return facing == Direction.DOWN; + if (state.getBlock() instanceof CarpetBlock) + return facing == Direction.UP; return isBrittle(state); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java index 947321a0d..a8bc914df 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java @@ -21,6 +21,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.glue.Sup import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState; import net.minecraft.block.BlockState; +import net.minecraft.block.CarpetBlock; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -152,7 +153,7 @@ public class PistonContraption extends Contraption { if (!BlockMovementTraits.movementNecessary(world, currentPos)) return true; BlockState state = world.getBlockState(currentPos); - if (BlockMovementTraits.isBrittle(state)) + if (BlockMovementTraits.isBrittle(state) && !(state.getBlock() instanceof CarpetBlock)) return true; if (AllBlocks.MECHANICAL_PISTON_HEAD.typeOf(state) && state.get(FACING) == direction.getOpposite()) return true; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java index 09800ca42..33c98c89d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import net.minecraft.block.BlockState; @@ -63,7 +64,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE, @Override public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { - withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps); + if (!(worldIn instanceof WrappedWorld)) + withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps); BlockState tunnelState = getTunnelState(worldIn, currentPos); if (tunnelState.get(HORIZONTAL_AXIS) == state.get(HORIZONTAL_AXIS)) { @@ -166,11 +168,11 @@ public class BeltTunnelBlock extends Block implements ITE, // T and Cross Direction left = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis).rotateY(); BlockState leftState = reader.getBlockState(pos.offset(left).down()); - boolean onLeft = AllBlocks.BELT.typeOf(leftState) - && leftState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; + boolean onLeft = + AllBlocks.BELT.typeOf(leftState) && leftState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; BlockState rightState = reader.getBlockState(pos.offset(left.getOpposite()).down()); - boolean onRight = AllBlocks.BELT.typeOf(rightState) - && rightState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; + boolean onRight = + AllBlocks.BELT.typeOf(rightState) && rightState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; if (onLeft && onRight) state = state.with(SHAPE, Shape.CROSS);