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
This commit is contained in:
simibubi 2020-05-09 18:32:47 +02:00
parent 0a869190b2
commit 32cce4e9b9
5 changed files with 21 additions and 15 deletions

View file

@ -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<? extends Entity> builder = EntityType.Builder.create(entity.factory, entity.group)
.setTrackingRange(entity.range).setUpdateInterval(entity.updateFrequency)
Builder<? extends Entity> 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);

View file

@ -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);
}

View file

@ -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;

View file

@ -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<Water
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) {
World world = worldIn.getWorld();
if (world == null)
if (world == null || worldIn instanceof WrappedWorld)
return stateIn;
updateFlowAt(stateIn, world, currentPos, facing);
updateWheelSpeed(worldIn, currentPos);

View file

@ -7,6 +7,7 @@ import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.WrappedWorld;
import com.simibubi.create.modules.contraptions.IWrenchable;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope;
@ -110,7 +111,8 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
@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<BeltTunnelTileEntity>,
// 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);