From 73f41ccce867b41b1346d805cf4e4d25ee751ed8 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Fri, 13 Mar 2020 20:33:25 +0100 Subject: [PATCH] Playtest Issues - Connected texture contexts are no longer queried for invisible faces - Shafts and cogs now place inpendent of the preffered orientation when sneaking - Moving block breakers no longer apply damage to itementities - Fixed inconsistent block collision prediction for pistons when assembling - Sequenced Gearshift no longer resets when UI closed without changes - Minor Improvements to Seq. Gearshift UI usablilty - Fixed encoding issues with degree symbol - Fertilized Trees no longer replace semi-solid/collideable blocks with their leaves --- .../foundation/block/connected/CTModel.java | 8 +++---- .../base/RotatedPillarKineticBlock.java | 5 ++-- .../BlockBreakingMovementBehaviour.java | 3 +++ .../piston/MechanicalPistonTileEntity.java | 8 +++++-- .../ConfigureSequencedGearshiftPacket.java | 6 ++--- .../sequencer/SequencedGearshiftScreen.java | 24 +++++++------------ .../sequencer/SequencerInstructions.java | 18 +++++++------- .../modules/gardens/TreeFertilizerItem.java | 4 ++-- .../resources/assets/create/lang/en_us.json | 1 + 9 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/block/connected/CTModel.java b/src/main/java/com/simibubi/create/foundation/block/connected/CTModel.java index a340d1ac8..426212ac4 100644 --- a/src/main/java/com/simibubi/create/foundation/block/connected/CTModel.java +++ b/src/main/java/com/simibubi/create/foundation/block/connected/CTModel.java @@ -55,7 +55,7 @@ public class CTModel extends BakedModelWrapper { CTData data = new CTData(); for (Direction face : Direction.values()) { - if (state.isNormalCube(world, pos) && !Block.shouldSideBeRendered(state, world, pos, face)) + if (!Block.shouldSideBeRendered(state, world, pos, face)) continue; CTSpriteShiftEntry spriteShift = behaviour.get(state, face); if (spriteShift == null) @@ -88,9 +88,9 @@ public class CTModel extends BakedModelWrapper { float uShift = spriteShift.getUShift(index); float vShift = spriteShift.getVShift(index); - BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), - quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), - quad.getFormat()); + BakedQuad newQuad = + new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), quad.getTintIndex(), + quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat()); VertexFormat format = quad.getFormat(); int[] vertexData = newQuad.getVertexData(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/RotatedPillarKineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/RotatedPillarKineticBlock.java index 01c3177e1..f28975c56 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/RotatedPillarKineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/RotatedPillarKineticBlock.java @@ -66,10 +66,9 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock { @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Axis preferredAxis = getPreferredAxis(context); - if (preferredAxis != null) + if (preferredAxis != null && !context.isPlacerSneaking()) return this.getDefaultState().with(AXIS, preferredAxis); - return this.getDefaultState().with(AXIS, context.isPlacerSneaking() ? context.getFace().getAxis() - : context.getNearestLookingDirection().getAxis()); + return this.getDefaultState().with(AXIS, context.getNearestLookingDirection().getAxis()); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/BlockBreakingMovementBehaviour.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/BlockBreakingMovementBehaviour.java index 118b08f60..55702ab9e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/BlockBreakingMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/BlockBreakingMovementBehaviour.java @@ -6,6 +6,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.Movement import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.util.DamageSource; @@ -36,6 +37,8 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour { if (damageSource == null) return; for (Entity entity : world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos))) { + if (entity instanceof ItemEntity) + return; float damage = (float) MathHelper.clamp(Math.abs(context.relativeMotion.length() * 10) + 1, 5, 20); entity.attackEntityFrom(damageSource, damage); entity.setMotion(entity.getMotion().add(context.relativeMotion.scale(3))); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonTileEntity.java index 421846553..9918f772d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/MechanicalPistonTileEntity.java @@ -3,6 +3,7 @@ package com.simibubi.create.modules.contraptions.components.contraptions.piston; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.behaviour.ValueBoxTransform; +import com.simibubi.create.foundation.utility.Debug; import com.simibubi.create.foundation.utility.ServerSpeedProvider; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionCollider; @@ -14,6 +15,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @@ -45,7 +47,9 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity { // Collect Construct PistonContraption contraption = PistonContraption.movePistonAt(world, pos, direction, getMovementSpeed() < 0); - Direction movementDirection = getSpeed() > 0 ? direction : direction.getOpposite(); + Direction positive = Direction.getFacingFromAxis(AxisDirection.POSITIVE, direction.getAxis()); + Direction movementDirection = + getSpeed() > 0 ^ direction.getAxis() != Axis.Z ? positive : positive.getOpposite(); if (contraption != null) { BlockPos anchor = contraption.getAnchor().offset(direction, contraption.initialExtensionProgress); @@ -99,7 +103,7 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity { @Override public void collided() { super.collided(); - if (!running && getSpeed() > 0) + if (!running && getMovementSpeed() > 0) assembleNextTick = true; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/ConfigureSequencedGearshiftPacket.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/ConfigureSequencedGearshiftPacket.java index 6886b01d9..7c5311bbc 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/ConfigureSequencedGearshiftPacket.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/ConfigureSequencedGearshiftPacket.java @@ -1,7 +1,5 @@ package com.simibubi.create.modules.contraptions.relays.advanced.sequencer; -import java.util.Vector; - import com.simibubi.create.foundation.packet.TileEntityConfigurationPacket; import net.minecraft.nbt.CompoundNBT; @@ -14,9 +12,9 @@ public class ConfigureSequencedGearshiftPacket extends TileEntityConfigurationPa private ListNBT instructions; - public ConfigureSequencedGearshiftPacket(BlockPos pos, Vector instructions) { + public ConfigureSequencedGearshiftPacket(BlockPos pos, ListNBT instructions) { super(pos); - this.instructions = Instruction.serializeAll(instructions); + this.instructions = instructions; } public ConfigureSequencedGearshiftPacket(PacketBuffer buffer) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java index 6ad295296..d290a4ccd 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java @@ -13,6 +13,7 @@ import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.math.BlockPos; public class SequencedGearshiftScreen extends AbstractSimiScreen { @@ -21,7 +22,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { private static final ScreenResources background = ScreenResources.SEQUENCER; private final String title = Lang.translate("gui.sequenced_gearshift.title"); - private int lastModification; + private ListNBT compareTag; private Vector instructions; private BlockPos pos; @@ -30,7 +31,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { public SequencedGearshiftScreen(SequencedGearshiftTileEntity te) { this.instructions = te.instructions; this.pos = te.getPos(); - lastModification = -1; + compareTag = Instruction.serializeAll(instructions); } @Override @@ -145,21 +146,11 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { font.drawStringWithShadow(text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE); } - @Override - public void tick() { - super.tick(); - - if (lastModification >= 0) - lastModification++; - - if (lastModification >= 20) { - lastModification = -1; - sendPacket(); - } - } - public void sendPacket() { - AllPackets.channel.sendToServer(new ConfigureSequencedGearshiftPacket(pos, instructions)); + ListNBT serialized = Instruction.serializeAll(instructions); + if (serialized.equals(compareTag)) + return; + AllPackets.channel.sendToServer(new ConfigureSequencedGearshiftPacket(pos, serialized)); } @Override @@ -176,6 +167,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { private void instructionUpdated(int index, int state) { SequencerInstructions newValue = SequencerInstructions.values()[state]; instructions.get(index).instruction = newValue; + instructions.get(index).value = newValue.defaultValue; updateParamsOfRow(index); if (newValue == SequencerInstructions.END) { for (int i = instructions.size() - 1; i > index; i--) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencerInstructions.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencerInstructions.java index 09278a04f..e80f44f02 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencerInstructions.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencerInstructions.java @@ -8,9 +8,9 @@ import com.simibubi.create.foundation.utility.Lang; public enum SequencerInstructions { - TURN_ANGLE("angle", ScreenResources.SEQUENCER_INSTRUCTION, true, true, 360, 45), - TURN_DISTANCE("distance", ScreenResources.SEQUENCER_INSTRUCTION, true, true, 50, 5), - WAIT("duration", ScreenResources.SEQUENCER_WAIT, true, false, 600, 20), + TURN_ANGLE("angle", ScreenResources.SEQUENCER_INSTRUCTION, true, true, 360, 45, 90), + TURN_DISTANCE("distance", ScreenResources.SEQUENCER_INSTRUCTION, true, true, 50, 5, 5), + WAIT("duration", ScreenResources.SEQUENCER_WAIT, true, false, 600, 20, 10), END("", ScreenResources.SEQUENCER_END), ; @@ -22,18 +22,20 @@ public enum SequencerInstructions { ScreenResources background; int maxValue; int shiftStep; + int defaultValue; private SequencerInstructions(String parameterName, ScreenResources background) { - this(parameterName, background, false, false, -1, -1); + this(parameterName, background, false, false, -1, -1, -1); } private SequencerInstructions(String parameterName, ScreenResources background, boolean hasValueParameter, - boolean hasSpeedParameter, int maxValue, int shiftStep) { + boolean hasSpeedParameter, int maxValue, int shiftStep, int defaultValue) { this.hasValueParameter = hasValueParameter; this.hasSpeedParameter = hasSpeedParameter; this.background = background; this.maxValue = maxValue; this.shiftStep = shiftStep; + this.defaultValue = defaultValue; translationKey = "gui.sequenced_gearshift.instruction." + Lang.asId(name()); parameterKey = translationKey + "." + parameterName; } @@ -44,15 +46,15 @@ public enum SequencerInstructions { options.add(Lang.translate(entry.translationKey)); return options; } - + String formatValue(int value) { if (this == TURN_ANGLE) - return value + "°"; + return value + Lang.translate("generic.unit.degrees"); if (this == TURN_DISTANCE) return value + "m"; if (this == WAIT) { if (value >= 20) - return (value / 20) + "s"; + return (value / 20) + "s"; return value + "t"; } return "" + value; diff --git a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java index 801ed6710..58cd3e79c 100644 --- a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java +++ b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java @@ -49,8 +49,8 @@ public class TreeFertilizerItem extends Item { if (context.getWorld().getBlockState(actualPos).getBlockHardness(context.getWorld(), actualPos) == -1) continue; // Don't replace solid blocks with leaves - if (!world.getBlockState(pos).isNormalCube(world, pos) - && context.getWorld().getBlockState(actualPos).isNormalCube(context.getWorld(), actualPos)) + if (!world.getBlockState(pos).isNormalCube(world, pos) && !context.getWorld().getBlockState(actualPos) + .getCollisionShape(context.getWorld(), actualPos).isEmpty()) continue; if (world.getBlockState(pos).getBlock() == Blocks.GRASS_BLOCK || world.getBlockState(pos).getBlock() == Blocks.PODZOL) diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 36748a12d..8b043f171 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -312,6 +312,7 @@ "create.generic.unit.minutes": "Minutes", "create.generic.unit.rpm": "rpm", "create.generic.unit.stress": "su", + "create.generic.unit.degrees": "°", "create.action.scroll": "Scroll", "create.action.confirm": "Confirm",