From 4ff20b42179b6fbdfc09ec088c681b373282ab04 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 27 Mar 2021 22:42:27 +0100 Subject: [PATCH 1/7] Cogwheel refactor Part I - Moved hasIntegratedCogWheel and isSmallCog to ICogWheel --- .../contraptions/RotationPropagator.java | 16 +++++----- .../content/contraptions/base/IRotate.java | 2 -- .../contraptions/base/KineticBlock.java | 5 ---- .../contraptions/base/KineticTileEntity.java | 3 +- .../base/KineticTileEntityRenderer.java | 3 +- .../base/KineticTileInstance.java | 3 +- .../crafter/MechanicalCrafterBlock.java | 8 ++--- .../components/millstone/MillstoneBlock.java | 8 ++--- .../mixer/MechanicalMixerBlock.java | 8 ++--- .../contraptions/fluids/PumpBlock.java | 8 ++--- .../relays/advanced/SpeedControllerBlock.java | 3 +- .../relays/elementary/CogWheelBlock.java | 30 +++++++------------ .../relays/elementary/CogwheelBlockItem.java | 8 ++--- .../relays/elementary/ICogWheel.java | 22 ++++++++++++++ .../block/mechanicalArm/ArmBlock.java | 8 ++--- 15 files changed, 62 insertions(+), 73 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java diff --git a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java index dd29f947e..faa8c2046 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java @@ -1,6 +1,5 @@ package com.simibubi.create.content.contraptions; -import static com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock.isLargeCog; import static net.minecraft.state.properties.BlockStateProperties.AXIS; import java.util.LinkedList; @@ -12,6 +11,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.content.contraptions.relays.encased.DirectionalShaftHalvesTileEntity; import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock; import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEntity; @@ -66,8 +66,8 @@ public class RotationPropagator { alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction) && definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite()); - boolean connectedByGears = definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom) - && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo); + boolean connectedByGears = ICogWheel.isSmallCog(stateFrom) + && ICogWheel.isSmallCog(stateTo); float custom = from.propagateRotationTo(to, stateFrom, stateTo, diff, connectedByAxis, connectedByGears); if (custom != 0) @@ -98,10 +98,10 @@ public class RotationPropagator { } // Gear <-> Large Gear - if (isLargeCog(stateFrom) && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo)) + if (ICogWheel.isLargeCog(stateFrom) && ICogWheel.isSmallCog(stateTo)) if (isLargeToSmallCog(stateFrom, stateTo, definitionTo, diff)) return -2f; - if (isLargeCog(stateTo) && definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom)) + if (ICogWheel.isLargeCog(stateTo) && ICogWheel.isSmallCog(stateFrom)) if (isLargeToSmallCog(stateTo, stateFrom, definitionFrom, diff)) return -.5f; @@ -109,7 +109,7 @@ public class RotationPropagator { if (connectedByGears) { if (diff.manhattanDistance(BlockPos.ZERO) != 1) return 0; - if (isLargeCog(stateTo)) + if (ICogWheel.isLargeCog(stateTo)) return 0; if (direction.getAxis() == definitionFrom.getRotationAxis(stateFrom)) return 0; @@ -137,7 +137,7 @@ public class RotationPropagator { } private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) { - if (!isLargeCog(from) || !isLargeCog(to)) + if (!ICogWheel.isLargeCog(from) || !ICogWheel.isLargeCog(to)) return false; Axis fromAxis = from.get(AXIS); Axis toAxis = to.get(AXIS); @@ -186,7 +186,7 @@ public class RotationPropagator { } private static boolean isLargeCogToSpeedController(BlockState from, BlockState to, BlockPos diff) { - if (!isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to)) + if (!ICogWheel.isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to)) return false; if (!diff.equals(BlockPos.ZERO.down())) return false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java b/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java index 225532912..fa025e01a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/IRotate.java @@ -118,8 +118,6 @@ public interface IRotate extends IWrenchable { } public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face); - - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state); public Axis getRotationAxis(BlockState state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java index ee0734ae3..4836a2d72 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java @@ -72,11 +72,6 @@ public abstract class KineticBlock extends Block implements IRotate { return false; } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return false; - } - @Override public boolean hasTileEntity(BlockState state) { return true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index f38efb6fa..ae701fb85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -14,6 +14,7 @@ import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; @@ -529,7 +530,7 @@ public abstract class KineticTileEntity extends SmartTileEntity } protected boolean canPropagateDiagonally(IRotate block, BlockState state) { - return block.hasIntegratedCogwheel(world, pos, state); + return ICogWheel.isSmallCog(state); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java index 6ff654402..fe297f718 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.render.Compartment; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; @@ -96,7 +97,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer extends T } protected float getRotationOffset(final Direction.Axis axis) { - float offset = CogWheelBlock.isLargeCog(blockState) ? 11.25f : 0; + float offset = ICogWheel.isLargeCog(blockState) ? 11.25f : 0; double d = (((axis == Direction.Axis.X) ? 0 : pos.getX()) + ((axis == Direction.Axis.Y) ? 0 : pos.getY()) + ((axis == Direction.Axis.Z) ? 0 : pos.getZ())) % 2; if (d == 0) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java index 7f4c9d899..5d4d79ce6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; @@ -41,7 +42,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; -public class MechanicalCrafterBlock extends HorizontalKineticBlock implements ITE { +public class MechanicalCrafterBlock extends HorizontalKineticBlock implements ITE, ICogWheel { public static final EnumProperty POINTING = EnumProperty.create("pointing", Pointing.class); @@ -60,11 +61,6 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT return AllTileEntities.MECHANICAL_CRAFTER.create(); } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return true; - } - @Override public Axis getRotationAxis(BlockState state) { return state.get(HORIZONTAL_FACING) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java index 9696e6b11..7c7ecc989 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.millstone; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.KineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.Iterate; @@ -30,7 +31,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -public class MillstoneBlock extends KineticBlock implements ITE { +public class MillstoneBlock extends KineticBlock implements ITE, ICogWheel { public MillstoneBlock(Properties properties) { super(properties); @@ -131,11 +132,6 @@ public class MillstoneBlock extends KineticBlock implements ITE { +public class MechanicalMixerBlock extends KineticBlock implements ITE, ICogWheel { public MechanicalMixerBlock(Properties properties) { super(properties); @@ -51,11 +52,6 @@ public class MechanicalMixerBlock extends KineticBlock implements ITE items) { items.add(new ItemStack(this)); } - - // IRotate - - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return !isLarge; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java index 6d8018e30..9b5c2af90 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java @@ -21,7 +21,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; -import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; @@ -241,8 +240,7 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getStatePredicate() { - return s -> !AllBlocks.COGWHEEL.has(s) && s.getBlock() instanceof IRotate - && ((IRotate) s.getBlock()).hasIntegratedCogwheel(null, null, null); + return s -> !AllBlocks.COGWHEEL.has(s) && ICogWheel.isSmallCog(s); } @Override @@ -285,7 +283,7 @@ public class CogwheelBlockItem extends BlockItem { } } - static public boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Axis axis) { + public static boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Axis axis) { for (Direction dir : Iterate.directions) { if (dir.getAxis() == axis) continue; @@ -297,7 +295,7 @@ public class CogwheelBlockItem extends BlockItem { return false; } - static public boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Axis axis) { + public static boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Axis axis) { for (Direction dir : Iterate.directions) { if (dir.getAxis() == axis) continue; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java new file mode 100644 index 000000000..c8b4cab28 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java @@ -0,0 +1,22 @@ +package com.simibubi.create.content.contraptions.relays.elementary; + +import com.simibubi.create.content.contraptions.base.IRotate; +import net.minecraft.block.BlockState; + +public interface ICogWheel extends IRotate { + static boolean isSmallCog(BlockState state) { + return state.getBlock() instanceof ICogWheel && ((ICogWheel) state.getBlock()).isSmallCog(); + } + + static boolean isLargeCog(BlockState state) { + return state.getBlock() instanceof ICogWheel && ((ICogWheel) state.getBlock()).isLargeCog(); + } + + default boolean isLargeCog() { + return false; + } + + default boolean isSmallCog() { + return !isLargeCog(); + } +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java index 13354fc17..cbf44210c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllShapes; @@ -29,7 +30,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class ArmBlock extends KineticBlock implements ITE { +public class ArmBlock extends KineticBlock implements ITE, ICogWheel { public static final BooleanProperty CEILING = BooleanProperty.create("ceiling"); @@ -48,11 +49,6 @@ public class ArmBlock extends KineticBlock implements ITE { return getDefaultState().with(CEILING, ctx.getFace() == Direction.DOWN); } - @Override - public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) { - return true; - } - @Override public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { From 7b022cd302536679ac751917a4514eeed5ada254 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 27 Mar 2021 23:05:59 +0100 Subject: [PATCH 2/7] Cogwheel refactor Part II - Refactored getStateForPlacement to reduce doubled code --- .../relays/elementary/CogWheelBlock.java | 86 ++++++++----------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java index 65d64982b..ac973a053 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java @@ -5,18 +5,14 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.foundation.utility.Iterate; - +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.fluid.Fluids; -import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; -import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; @@ -24,7 +20,12 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel{ +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@SuppressWarnings("deprecation") +public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel { boolean isLarge; @@ -67,65 +68,48 @@ public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel{ if (blockState.has(AXIS) && facing.getAxis() == blockState.get(AXIS)) continue; - boolean smallCog = ICogWheel.isSmallCog(blockState); - - if (ICogWheel.isLargeCog(blockState) || isLarge && smallCog) + if (ICogWheel.isLargeCog(blockState) || isLargeCog() && ICogWheel.isSmallCog(blockState)) return false; } return true; } + protected Axis getAxisForPlacement(BlockItemUseContext context) { + if (context.getPlayer() != null && context.getPlayer().isSneaking()) + return context.getFace().getAxis(); + + World world = context.getWorld(); + BlockState stateBelow = world.getBlockState(context.getPos().down()); + + if (AllBlocks.ROTATION_SPEED_CONTROLLER.has(stateBelow) && isLargeCog()) + return stateBelow.get(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X; + + BlockPos placedOnPos = context.getPos().offset(context.getFace().getOpposite()); + BlockState placedAgainst = world.getBlockState(placedOnPos); + + Block block = placedAgainst.getBlock(); + if (ICogWheel.isSmallCog(placedAgainst)) + return ((IRotate) block).getRotationAxis(placedAgainst); + + Axis preferredAxis = getPreferredAxis(context); + return preferredAxis != null ? preferredAxis : context.getFace().getAxis(); + } + @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - BlockPos placedOnPos = context.getPos() - .offset(context.getFace() - .getOpposite()); - World world = context.getWorld(); - BlockState placedAgainst = world.getBlockState(placedOnPos); - Block block = placedAgainst.getBlock(); - - if (context.getPlayer() != null && context.getPlayer() - .isSneaking()) - return this.getDefaultState() - .with(AXIS, context.getFace() - .getAxis()); - - BlockState stateBelow = world.getBlockState(context.getPos() - .down()); - IFluidState ifluidstate = context.getWorld() - .getFluidState(context.getPos()); - if (AllBlocks.ROTATION_SPEED_CONTROLLER.has(stateBelow) && isLarge) { - return this.getDefaultState() - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER) - .with(AXIS, stateBelow.get(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X); - } - - if (!ICogWheel.isSmallCog(placedAgainst)) { - Axis preferredAxis = getPreferredAxis(context); - if (preferredAxis != null) - return this.getDefaultState() - .with(AXIS, preferredAxis) - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER); - return this.getDefaultState() - .with(AXIS, context.getFace() - .getAxis()) - .with(BlockStateProperties.WATERLOGGED, ifluidstate.getFluid() == Fluids.WATER); - } - - return getDefaultState().with(AXIS, ((IRotate) block).getRotationAxis(placedAgainst)); + boolean shouldWaterlog = context.getWorld().getFluidState(context.getPos()).getFluid() == Fluids.WATER; + return this.getDefaultState() + .with(AXIS, getAxisForPlacement(context)) + .with(BlockStateProperties.WATERLOGGED, shouldWaterlog); } @Override public float getParticleTargetRadius() { - return isLarge ? 1.125f : .65f; + return isLargeCog() ? 1.125f : .65f; } @Override public float getParticleInitialRadius() { - return isLarge ? 1f : .75f; - } - - public void fillItemGroup(ItemGroup group, NonNullList items) { - items.add(new ItemStack(this)); + return isLargeCog() ? 1f : .75f; } } From 5f49698a94a86fd9b0270946b06b5526c3186de8 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Sat, 27 Mar 2021 15:06:56 -0700 Subject: [PATCH 3/7] Fix mixer weirdness. - Mixer and Press instances now use the quaternion shader. --- .../components/mixer/MixerInstance.java | 114 ++++++++---------- .../components/press/PressInstance.java | 25 ++-- 2 files changed, 68 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java index 50098f65f..9cd7c0c7b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java @@ -1,91 +1,81 @@ package com.simibubi.create.content.contraptions.components.mixer; -import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.ShaftlessCogInstance; import com.simibubi.create.foundation.render.backend.instancing.*; -import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.impl.OrientedData; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.util.Direction; public class MixerInstance extends ShaftlessCogInstance implements IDynamicInstance { - private final InstanceKey mixerHead; - private final InstanceKey mixerPole; + private final InstanceKey mixerHead; + private final InstanceKey mixerPole; + private final MechanicalMixerTileEntity mixer; - public MixerInstance(InstancedTileRenderer dispatcher, KineticTileEntity tile) { - super(dispatcher, tile); + public MixerInstance(InstancedTileRenderer dispatcher, MechanicalMixerTileEntity tile) { + super(dispatcher, tile); + this.mixer = tile; - mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState) - .createInstance(); + mixerHead = getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState) + .createInstance(); - mixerHead.getInstance() - .setRotationAxis(Direction.Axis.Y); + mixerHead.getInstance() + .setRotationAxis(Direction.Axis.Y); - mixerPole = getTransformMaterial() - .getModel(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState) - .createInstance(); + mixerPole = getOrientedMaterial() + .getModel(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState) + .createInstance(); - MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) tile; - float renderedHeadOffset = getRenderedHeadOffset(mixer); + float renderedHeadOffset = getRenderedHeadOffset(); - transformPole(renderedHeadOffset); - transformHead(mixer, renderedHeadOffset); - } + transformPole(renderedHeadOffset); + transformHead(renderedHeadOffset); + } - @Override - public void beginFrame() { - MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) tile; + @Override + public void beginFrame() { - float renderedHeadOffset = getRenderedHeadOffset(mixer); + float renderedHeadOffset = getRenderedHeadOffset(); - if (mixer.running) { - transformPole(renderedHeadOffset); - } + transformPole(renderedHeadOffset); + transformHead(renderedHeadOffset); + } - transformHead(mixer, renderedHeadOffset); - } + private void transformHead(float renderedHeadOffset) { + float speed = mixer.getRenderedHeadRotationSpeed(AnimationTickHolder.getPartialTicks()); - private void transformHead(MechanicalMixerTileEntity mixer, float renderedHeadOffset) { - float speed = mixer.getRenderedHeadRotationSpeed(AnimationTickHolder.getPartialTicks()); + mixerHead.getInstance() + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0) + .setRotationalSpeed(speed * 2); + } - mixerHead.getInstance() - .setPosition(getInstancePosition()) - .nudge(0, -renderedHeadOffset, 0) - .setRotationalSpeed(speed * 2); - } + private void transformPole(float renderedHeadOffset) { + mixerPole.getInstance() + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0); + } - private void transformPole(float renderedHeadOffset) { - MatrixStack ms = new MatrixStack(); + private float getRenderedHeadOffset() { + return mixer.getRenderedHeadOffset(AnimationTickHolder.getPartialTicks()); + } - MatrixStacker msr = MatrixStacker.of(ms); - msr.translate(getInstancePosition()); - msr.translate(0, -renderedHeadOffset, 0); + @Override + public void updateLight() { + super.updateLight(); - mixerPole.getInstance().setTransform(ms); - } + relight(pos.down(), mixerHead.getInstance()); + relight(pos, mixerPole.getInstance()); + } - private float getRenderedHeadOffset(MechanicalMixerTileEntity mixer) { - return mixer.getRenderedHeadOffset(AnimationTickHolder.getPartialTicks()); - } - - @Override - public void updateLight() { - super.updateLight(); - - relight(pos.down(), mixerHead.getInstance()); - - relight(pos, mixerPole.getInstance()); - } - - @Override - public void remove() { - super.remove(); - mixerHead.delete(); - mixerPole.delete(); - } + @Override + public void remove() { + super.remove(); + mixerHead.delete(); + mixerPole.delete(); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java index e9985adb6..d40e9d421 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.contraptions.components.press; +import net.minecraft.client.renderer.Quaternion; +import net.minecraft.client.renderer.Vector3f; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -8,19 +11,28 @@ import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance import com.simibubi.create.foundation.render.backend.instancing.InstanceKey; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.impl.OrientedData; +import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; public class PressInstance extends ShaftInstance implements IDynamicInstance { - private final InstanceKey pressHead; + private final InstanceKey pressHead; private final MechanicalPressTileEntity press; public PressInstance(InstancedTileRenderer dispatcher, MechanicalPressTileEntity tile) { super(dispatcher, tile); press = tile; - pressHead = AllBlockPartials.MECHANICAL_PRESS_HEAD.renderOnHorizontalModel(dispatcher, blockState).createInstance(); + pressHead = dispatcher.getOrientedMaterial() + .getModel(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState) + .createInstance(); + + Quaternion q = Vector3f.POSITIVE_Y.getDegreesQuaternion(AngleHelper.horizontalAngle(blockState.get(MechanicalPressBlock.HORIZONTAL_FACING))); + + pressHead.getInstance().setRotation(q); + transformModels(); } @@ -35,14 +47,9 @@ public class PressInstance extends ShaftInstance implements IDynamicInstance { private void transformModels() { float renderedHeadOffset = getRenderedHeadOffset(press); - MatrixStack ms = new MatrixStack(); - - MatrixStacker msr = MatrixStacker.of(ms); - msr.translate(getInstancePosition()); - msr.translate(0, -renderedHeadOffset, 0); - pressHead.getInstance() - .setTransform(ms); + .setPosition(getInstancePosition()) + .nudge(0, -renderedHeadOffset, 0); } private float getRenderedHeadOffset(MechanicalPressTileEntity press) { From 1bffb82ae4a82942404cbb27812166d52f262eae Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sun, 28 Mar 2021 00:19:27 +0100 Subject: [PATCH 4/7] Cogwheel refactor Part III - Removed the calls to the AllBlocks entries where necessary - Made placement helpers call the same code as CogWheelBlock.isValidPosition --- .../relays/advanced/SpeedControllerBlock.java | 28 +++++------ .../advanced/SpeedControllerTileEntity.java | 5 +- .../relays/elementary/CogWheelBlock.java | 13 +++++- .../relays/elementary/CogwheelBlockItem.java | 43 ++++------------- .../relays/elementary/ICogWheel.java | 46 ++++++++++++++++++- .../elementary/SimpleKineticTileEntity.java | 3 +- 6 files changed, 83 insertions(+), 55 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java index 7cf8d25ed..5a7edbd98 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java @@ -1,6 +1,16 @@ package com.simibubi.create.content.contraptions.relays.advanced; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllShapes; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; +import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.placement.IPlacementHelper; +import com.simibubi.create.foundation.utility.placement.PlacementHelpers; +import com.simibubi.create.foundation.utility.placement.PlacementOffset; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -19,18 +29,11 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Predicate; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.AllShapes; -import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; -import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; -import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; -import com.simibubi.create.foundation.block.ITE; -import com.simibubi.create.foundation.utility.placement.IPlacementHelper; -import com.simibubi.create.foundation.utility.placement.PlacementHelpers; -import com.simibubi.create.foundation.utility.placement.PlacementOffset; +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements ITE { private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper()); @@ -83,7 +86,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements private static class PlacementHelper implements IPlacementHelper { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -101,8 +104,7 @@ public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements Axis newAxis = state.get(HORIZONTAL_AXIS) == Axis.X ? Axis.Z : Axis.X; - if (CogwheelBlockItem.hasLargeCogwheelNeighbor(world, newPos, newAxis) - || CogwheelBlockItem.hasSmallCogwheelNeighbor(world, newPos, newAxis)) + if (!CogWheelBlock.isValidCogwheelPosition(true, world, newPos, newAxis)) return PlacementOffset.fail(); return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java index 8c225b86a..725d2e204 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.RotationPropagator; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.motor.CreativeMotorTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; @@ -118,8 +119,8 @@ public class SpeedControllerTileEntity extends KineticTileEntity { if (world == null || !world.isRemote) return; BlockState stateAbove = world.getBlockState(pos.up()); - hasBracket = AllBlocks.LARGE_COGWHEEL.has(stateAbove) && stateAbove.get(CogWheelBlock.AXIS) - .isHorizontal(); + hasBracket = ICogWheel.isDedicatedCogWheel(stateAbove.getBlock()) && ICogWheel.isLargeCog(stateAbove) + && stateAbove.get(CogWheelBlock.AXIS).isHorizontal(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java index ac973a053..deb5c17df 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java @@ -59,8 +59,12 @@ public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel { @Override public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { + return isValidCogwheelPosition(ICogWheel.isLargeCog(state), worldIn, pos, state.get(AXIS)); + } + + public static boolean isValidCogwheelPosition(boolean large, IWorldReader worldIn, BlockPos pos, Axis cogAxis) { for (Direction facing : Iterate.directions) { - if (facing.getAxis() == state.get(AXIS)) + if (facing.getAxis() == cogAxis) continue; BlockPos offsetPos = pos.offset(facing); @@ -68,7 +72,7 @@ public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel { if (blockState.has(AXIS) && facing.getAxis() == blockState.get(AXIS)) continue; - if (ICogWheel.isLargeCog(blockState) || isLargeCog() && ICogWheel.isSmallCog(blockState)) + if (ICogWheel.isLargeCog(blockState) || large && ICogWheel.isSmallCog(blockState)) return false; } return true; @@ -112,4 +116,9 @@ public class CogWheelBlock extends AbstractShaftBlock implements ICogWheel { public float getParticleInitialRadius() { return isLargeCog() ? 1f : .75f; } + + @Override + public boolean isDedicatedCogWheel() { + return true; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java index 9b5c2af90..b8b0a0d5e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java @@ -17,7 +17,6 @@ import net.minecraft.world.World; import java.util.List; import java.util.function.Predicate; -import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; @@ -99,7 +98,7 @@ public class CogwheelBlockItem extends BlockItem { continue; if (blockState.get(CogWheelBlock.AXIS) != axis) continue; - if (AllBlocks.LARGE_COGWHEEL.has(blockState) == large) + if (ICogWheel.isLargeCog(blockState) == large) continue; AllTriggers.triggerFor(AllTriggers.SHIFTING_GEARS, player); } @@ -113,7 +112,7 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.COGWHEEL::isIn; + return ((Predicate) ICogWheel::isSmallCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -128,7 +127,7 @@ public class CogwheelBlockItem extends BlockItem { for (Direction dir : directions) { BlockPos newPos = pos.offset(dir); - if (hasLargeCogwheelNeighbor(world, newPos, state.get(AXIS))) + if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, state.get(AXIS))) continue; if (!world.getBlockState(newPos) @@ -152,7 +151,7 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override @@ -169,7 +168,7 @@ public class CogwheelBlockItem extends BlockItem { BlockPos newPos = pos.offset(dir) .offset(side); - if (hasLargeCogwheelNeighbor(world, newPos, dir.getAxis()) || hasSmallCogwheelNeighbor(world, newPos, dir.getAxis())) + if (!CogWheelBlock.isValidCogwheelPosition(true, world, newPos, dir.getAxis())) continue; if (!world.getBlockState(newPos) @@ -211,7 +210,7 @@ public class CogwheelBlockItem extends BlockItem { .isReplaceable()) continue; - if (AllBlocks.COGWHEEL.has(state) && hasSmallCogwheelNeighbor(world, newPos, state.get(AXIS))) + if (!CogWheelBlock.isValidCogwheelPosition(ICogWheel.isLargeCog(state), world, newPos, state.get(AXIS))) continue; return PlacementOffset.success(newPos, s -> s.with(AXIS, state.get(AXIS))); @@ -235,12 +234,12 @@ public class CogwheelBlockItem extends BlockItem { @Override public Predicate getItemPredicate() { - return AllBlocks.LARGE_COGWHEEL::isIn; + return ((Predicate) ICogWheel::isLargeCogItem).and(ICogWheel::isDedicatedCogItem); } @Override public Predicate getStatePredicate() { - return s -> !AllBlocks.COGWHEEL.has(s) && ICogWheel.isSmallCog(s); + return s -> !ICogWheel.isDedicatedCogWheel(s.getBlock()) && ICogWheel.isSmallCog(s); } @Override @@ -272,8 +271,7 @@ public class CogwheelBlockItem extends BlockItem { .isReplaceable()) continue; - if (hasLargeCogwheelNeighbor(world, newPos, newAxis) - || hasSmallCogwheelNeighbor(world, newPos, newAxis)) + if (!CogWheelBlock.isValidCogwheelPosition(false, world, newPos, newAxis)) return PlacementOffset.fail(); return PlacementOffset.success(newPos, s -> s.with(CogWheelBlock.AXIS, newAxis)); @@ -283,27 +281,4 @@ public class CogwheelBlockItem extends BlockItem { } } - public static boolean hasLargeCogwheelNeighbor(World world, BlockPos pos, Axis axis) { - for (Direction dir : Iterate.directions) { - if (dir.getAxis() == axis) - continue; - - if (AllBlocks.LARGE_COGWHEEL.has(world.getBlockState(pos.offset(dir)))) - return true; - } - - return false; - } - - public static boolean hasSmallCogwheelNeighbor(World world, BlockPos pos, Axis axis) { - for (Direction dir : Iterate.directions) { - if (dir.getAxis() == axis) - continue; - - if (AllBlocks.COGWHEEL.has(world.getBlockState(pos.offset(dir)))) - return true; - } - - return false; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java index c8b4cab28..7f2ad6f2c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java @@ -1,15 +1,53 @@ package com.simibubi.create.content.contraptions.relays.elementary; import com.simibubi.create.content.contraptions.base.IRotate; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public interface ICogWheel extends IRotate { + static boolean isSmallCog(BlockState state) { - return state.getBlock() instanceof ICogWheel && ((ICogWheel) state.getBlock()).isSmallCog(); + return isSmallCog(state.getBlock()); } static boolean isLargeCog(BlockState state) { - return state.getBlock() instanceof ICogWheel && ((ICogWheel) state.getBlock()).isLargeCog(); + return isLargeCog(state.getBlock()); + } + + static boolean isSmallCog(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isSmallCog(); + } + + static boolean isLargeCog(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isLargeCog(); + } + + static boolean isDedicatedCogWheel(Block block) { + return block instanceof ICogWheel && ((ICogWheel) block).isDedicatedCogWheel(); + } + + static boolean isDedicatedCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isDedicatedCogWheel(((BlockItem) item).getBlock()); + } + + static boolean isSmallCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isSmallCog(((BlockItem) item).getBlock()); + } + + static boolean isLargeCogItem(ItemStack test) { + Item item = test.getItem(); + if (!(item instanceof BlockItem)) + return false; + return isLargeCog(((BlockItem) item).getBlock()); } default boolean isLargeCog() { @@ -19,4 +57,8 @@ public interface ICogWheel extends IRotate { default boolean isSmallCog() { return !isLargeCog(); } + + default boolean isDedicatedCogWheel() { + return false; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java index ddf55f972..2c3f47a6a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java @@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.relays.elementary; import java.util.List; -import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.foundation.advancement.AllTriggers; @@ -34,7 +33,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity { @Override public List addPropagationLocations(IRotate block, BlockState state, List neighbours) { - if (!AllBlocks.LARGE_COGWHEEL.has(state)) + if (!ICogWheel.isLargeCog(state)) return super.addPropagationLocations(block, state, neighbours); BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) From 4e7777a1304e279df8978e72ea2705dd9a0f9cb7 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Sat, 27 Mar 2021 16:35:47 -0700 Subject: [PATCH 5/7] Fix more instancing nonsense. OrientedData was still applying the origin position shift, so some things (mechanical presses) wouldn't appear in the right spot. --- .../create/content/contraptions/base/KineticData.java | 6 ------ .../render/backend/instancing/impl/OrientedData.java | 8 -------- 2 files changed, 14 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java index 18e48cb8f..376f46514 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java @@ -28,12 +28,6 @@ public class KineticData extends BasicData { return setPosition(pos.getX(), pos.getY(), pos.getZ()); } - public KineticData setPosition(int x, int y, int z) { - return setPosition((float) (x), - (float) (y), - (float) (z)); - } - public KineticData setPosition(float x, float y, float z) { this.x = x; this.y = y; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java index 97a741182..2b4c8a185 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/impl/OrientedData.java @@ -35,14 +35,6 @@ public class OrientedData extends BasicData { return setPosition(pos.getX(), pos.getY(), pos.getZ()); } - public OrientedData setPosition(int x, int y, int z) { - BlockPos origin = owner.renderer.getOriginCoordinate(); - - return setPosition((float) (x - origin.getX()), - (float) (y - origin.getY()), - (float) (z - origin.getZ())); - } - public OrientedData setPosition(float x, float y, float z) { this.posX = x; this.posY = y; From fcae7e5c9a8663b5f75443689d34fc6e5b44958e Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 28 Mar 2021 00:45:14 +0100 Subject: [PATCH 6/7] Motion commotion - Update recipe for redstone contact - Counteracted ejector inaccuracies caused by deferred activation - Rewired ponder vertex sorting to evade Optifine incompatibilities --- src/generated/resources/.cache/cache | 2 +- .../crafting/logistics/redstone_contact.json | 10 ++--- .../java/com/simibubi/create/AllBlocks.java | 37 +++++++++--------- .../block/depot/EjectorTileEntity.java | 39 ++++++++++--------- .../logistics/block/depot/EntityLauncher.java | 2 +- .../data/recipe/StandardRecipeGen.java | 8 ++-- .../create/foundation/ponder/PonderUI.java | 15 +++---- .../renderState/SuperRenderTypeBuffer.java | 18 --------- 8 files changed, 58 insertions(+), 73 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index aab8b94c2..f4ced7d43 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -2914,7 +2914,7 @@ fc75c87159569cb6ee978e6d51b0c3b0f504b5de data/create/recipes/crafting/logistics/ a32ac53848862837f3044ff9c81ed62c1134fe4f data/create/recipes/crafting/logistics/powered_latch.json 660eb73bcc66c1528cbd4d4204ad6b771f4bd721 data/create/recipes/crafting/logistics/powered_toggle_latch.json 74b8a38d252cce564cc63db2ade41ed2d656d025 data/create/recipes/crafting/logistics/pulse_repeater.json -bb73dac60392f4811df033c3d1d3256df5e022af data/create/recipes/crafting/logistics/redstone_contact.json +739f0d8b7f98a5639ed37f7fb8ce474d5e6ba0c6 data/create/recipes/crafting/logistics/redstone_contact.json bc511f7c225750743ae3e985502fa65beb1e7b8d data/create/recipes/crafting/logistics/redstone_link.json 10b16358664f2bb8a11589ef8ba3d69ee8d3b9fc data/create/recipes/crafting/logistics/stockpile_switch.json 0dc99b8a8c68d6a9250c3a1167ffb565be9622ec data/create/recipes/crafting/materials/andesite_alloy.json diff --git a/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json b/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json index 840a75afe..d8530defc 100644 --- a/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json +++ b/src/generated/resources/data/create/recipes/crafting/logistics/redstone_contact.json @@ -1,19 +1,19 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "WDW", " S ", - "WDW" + "CWC", + "CCC" ], "key": { "W": { "tag": "forge:dusts/redstone" }, - "D": { - "item": "create:brass_casing" + "C": { + "item": "minecraft:cobblestone" }, "S": { - "tag": "forge:ingots/iron" + "tag": "forge:plates/iron" } }, "result": { diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 35295937e..87e0dc54a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -480,15 +480,16 @@ public class AllBlocks { .item() .transform(customItemModel("_", "block")) .register(); - - public static final BlockEntry WEIGHTED_EJECTOR = REGISTRATE.block("weighted_ejector", EjectorBlock::new) - .initialProperties(SharedProperties::stone) - .properties(Block.Properties::nonOpaque) - .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) - .transform(StressConfigDefaults.setImpact(2.0)) - .item(EjectorItem::new) - .transform(customItemModel()) - .register(); + + public static final BlockEntry WEIGHTED_EJECTOR = + REGISTRATE.block("weighted_ejector", EjectorBlock::new) + .initialProperties(SharedProperties::stone) + .properties(Block.Properties::nonOpaque) + .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) + .transform(StressConfigDefaults.setImpact(2.0)) + .item(EjectorItem::new) + .transform(customItemModel()) + .register(); public static final BlockEntry CHUTE = REGISTRATE.block("chute", ChuteBlock::new) .initialProperties(SharedProperties::softMetal) @@ -906,6 +907,15 @@ public class AllBlocks { .transform(customItemModel()) .register(); + public static final BlockEntry REDSTONE_CONTACT = + REGISTRATE.block("redstone_contact", RedstoneContactBlock::new) + .initialProperties(SharedProperties::stone) + .onRegister(addMovementBehaviour(new ContactMovementBehaviour())) + .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) + .item() + .transform(customItemModel("_", "block")) + .register(); + public static final BlockEntry MECHANICAL_HARVESTER = REGISTRATE.block("mechanical_harvester", HarvesterBlock::new) .initialProperties(SharedProperties::stone) @@ -1150,15 +1160,6 @@ public class AllBlocks { .onRegister(connectedTextures(new BrassTunnelCTBehaviour())) .register(); - public static final BlockEntry REDSTONE_CONTACT = - REGISTRATE.block("redstone_contact", RedstoneContactBlock::new) - .initialProperties(SharedProperties::stone) - .onRegister(addMovementBehaviour(new ContactMovementBehaviour())) - .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) - .item() - .transform(customItemModel("_", "block")) - .register(); - public static final BlockEntry CONTENT_OBSERVER = REGISTRATE.block("content_observer", ContentObserverBlock::new) .initialProperties(SharedProperties::stone) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index 8218fa025..69cc84372 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -302,22 +302,27 @@ public class EjectorTileEntity extends KineticTileEntity { } if (state == State.RETRACTING) { - lidProgress.updateChaseSpeed(0); - if (lidProgress.getValue() == 0 && doLogic) { - state = State.CHARGED; - lidProgress.setValue(0); - sendData(); + if (lidProgress.getChaseTarget() == 1 && !lidProgress.settled()) { + lidProgress.tickChaser(); + } else { + lidProgress.updateChaseTarget(0); + lidProgress.updateChaseSpeed(0); + if (lidProgress.getValue() == 0 && doLogic) { + state = State.CHARGED; + lidProgress.setValue(0); + sendData(); + } + + float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1); + lidProgress.setValue(value); + + int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1; + float volume = .125f; + float pitch = 1.5f - lidProgress.getValue(); + if (((int) world.getGameTime()) % soundRate == 0 && doLogic) + world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume, + pitch); } - - float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1); - lidProgress.setValue(value); - - int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1; - float volume = .125f; - float pitch = 1.5f - lidProgress.getValue(); - if (((int) world.getGameTime()) % soundRate == 0 && doLogic) - world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume, - pitch); } if (state != prevState) @@ -509,10 +514,6 @@ public class EjectorTileEntity extends KineticTileEntity { public void setTarget(int horizontalDistance, int verticalDistance) { launcher.set(Math.max(1, horizontalDistance), verticalDistance); - if (horizontalDistance == 0 && verticalDistance == 0) { - state = State.CHARGED; - lidProgress.startWithValue(0); - } sendData(); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java index cf91ddfef..752fff659 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EntityLauncher.java @@ -36,7 +36,7 @@ public class EntityLauncher { public void applyMotion(Entity entity, Direction facing) { Vec3d motionVec = new Vec3d(0, yMotion, xMotion); motionVec = VecHelper.rotate(motionVec, AngleHelper.horizontalAngle(facing), Axis.Y); - entity.setMotion(motionVec.x, motionVec.y, motionVec.z); + entity.setMotion(motionVec.x * .91, motionVec.y * .98, motionVec.z * .91); } public int getHorizontalDistance() { diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 5fddcde92..a05b192a2 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -790,11 +790,11 @@ public class StandardRecipeGen extends CreateRecipeProvider { REDSTONE_CONTACT = create(AllBlocks.REDSTONE_CONTACT).returns(2) .unlockedBy(I::brassCasing) .viaShaped(b -> b.key('W', I.redstone()) - .key('D', I.brassCasing()) - .key('S', I.iron()) - .patternLine("WDW") + .key('C', Blocks.COBBLESTONE) + .key('S', I.ironSheet()) .patternLine(" S ") - .patternLine("WDW")), + .patternLine("CWC") + .patternLine("CCC")), ANDESITE_FUNNEL = create(AllBlocks.ANDESITE_FUNNEL).returns(2) .unlockedBy(I::andesite) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 8cc99fedd..29435f48e 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -369,7 +369,6 @@ public class PonderUI extends NavigatableSimiScreen { } protected void renderVisibleScenes(int mouseX, int mouseY, float partialTicks) { - SuperRenderTypeBuffer.vertexSortingOrigin = new BlockPos(0, 0, 800); renderScene(mouseX, mouseY, index, partialTicks); float lazyIndexValue = lazyIndex.getValue(partialTicks); if (Math.abs(lazyIndexValue - index) > 1 / 512f) @@ -388,13 +387,21 @@ public class PonderUI extends NavigatableSimiScreen { RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); + RenderSystem.pushMatrix(); + + // has to be outside of MS transforms, important for vertex sorting + RenderSystem.translated(0, 0, 800); + ms.push(); + ms.translate(0, 0, -800); story.transform.updateScreenParams(width, height, slide); story.transform.apply(ms, partialTicks, false); story.transform.updateSceneRVE(partialTicks); story.renderScene(buffer, ms, partialTicks); buffer.draw(); + RenderSystem.popMatrix(); + MutableBoundingBox bounds = story.getBounds(); RenderSystem.pushMatrix(); RenderSystem.multMatrix(ms.peek() @@ -933,10 +940,4 @@ public class PonderUI extends NavigatableSimiScreen { skipCooling = 15; } - @Override - public void removed() { - super.removed(); - SuperRenderTypeBuffer.vertexSortingOrigin = BlockPos.ZERO; - } - } diff --git a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java index 66cefb99d..9f64634bc 100644 --- a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java @@ -1,7 +1,5 @@ package com.simibubi.create.foundation.renderState; -import java.util.Objects; -import java.util.Optional; import java.util.SortedMap; import com.mojang.blaze3d.systems.RenderSystem; @@ -15,11 +13,9 @@ import net.minecraft.client.renderer.RegionRenderCacheBuilder; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; public class SuperRenderTypeBuffer implements IRenderTypeBuffer { - public static BlockPos vertexSortingOrigin = BlockPos.ZERO; static SuperRenderTypeBuffer instance; public static SuperRenderTypeBuffer getInstance() { @@ -100,20 +96,6 @@ public class SuperRenderTypeBuffer implements IRenderTypeBuffer { super(new BufferBuilder(256), createEntityBuilders()); } - public void draw(RenderType p_228462_1_) { - BlockPos v = vertexSortingOrigin; - BufferBuilder bufferbuilder = layerBuffers.getOrDefault(p_228462_1_, this.fallbackBuffer); - boolean flag = Objects.equals(this.currentLayer, p_228462_1_.asOptional()); - if (flag || bufferbuilder != this.fallbackBuffer) { - if (this.activeConsumers.remove(bufferbuilder)) { - p_228462_1_.draw(bufferbuilder, v.getX(), v.getY(), v.getZ()); - if (flag) { - this.currentLayer = Optional.empty(); - } - } - } - } - } } From 76bd3b3f5060830ea294169b22a3d31e0e43f193 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 28 Mar 2021 01:52:04 +0100 Subject: [PATCH 7/7] Pondering too fast - Added a button to slow down ponder scenes while any text is shown on screen --- src/generated/resources/.cache/cache | 26 ++--- .../resources/assets/create/lang/en_us.json | 1 + .../assets/create/lang/unfinished/de_de.json | 3 +- .../assets/create/lang/unfinished/es_es.json | 3 +- .../assets/create/lang/unfinished/es_mx.json | 3 +- .../assets/create/lang/unfinished/fr_fr.json | 3 +- .../assets/create/lang/unfinished/it_it.json | 3 +- .../assets/create/lang/unfinished/ja_jp.json | 3 +- .../assets/create/lang/unfinished/ko_kr.json | 3 +- .../assets/create/lang/unfinished/nl_nl.json | 3 +- .../assets/create/lang/unfinished/pt_br.json | 3 +- .../assets/create/lang/unfinished/ru_ru.json | 3 +- .../assets/create/lang/unfinished/zh_cn.json | 3 +- .../assets/create/lang/unfinished/zh_tw.json | 3 +- .../create/foundation/gui/AllIcons.java | 3 +- .../foundation/ponder/PonderLocalization.java | 1 + .../create/foundation/ponder/PonderUI.java | 99 ++++++++++++------ .../assets/create/textures/gui/icons.png | Bin 2881 -> 2923 bytes 18 files changed, 108 insertions(+), 58 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index f4ced7d43..78ca66029 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -403,19 +403,19 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json ce0e5405da381a86625b908c569c5dbe347abdba assets/create/lang/en_ud.json -442123de75c67a2b562194981d62c6a6de053593 assets/create/lang/en_us.json -1a5739ce1ab4a923dcf5a7ed12f16af394aed719 assets/create/lang/unfinished/de_de.json -4f21f855b45e8b44aedcae94e5a41c797d05af45 assets/create/lang/unfinished/es_es.json -e971082462cd5a92a08c3a1481e8e7c6e1afcea1 assets/create/lang/unfinished/es_mx.json -64a39634a36da998fd11553340cd1fc652129ce9 assets/create/lang/unfinished/fr_fr.json -afb72ad7e2713819b3cda0110a41dcdbbcc0bb0b assets/create/lang/unfinished/it_it.json -583b4bddc044614efb1b08f9bfb36a49e0a67e4f assets/create/lang/unfinished/ja_jp.json -9baa3052e1a9440e1cb6d46950d2227f2be3435e assets/create/lang/unfinished/ko_kr.json -7701f3b29b3e92a9943c15000beb9df02143fe90 assets/create/lang/unfinished/nl_nl.json -9f935fe569d793f6ee581ebc24bff5740c91fbab assets/create/lang/unfinished/pt_br.json -9ede4dc1051fea0bcabc30da1d133c0048d29641 assets/create/lang/unfinished/ru_ru.json -2442b5fe4ed2d92ab3081e7422bfecdf1ac06610 assets/create/lang/unfinished/zh_cn.json -56268c452b57cf072f35839ebfa130213a966730 assets/create/lang/unfinished/zh_tw.json +e847bb88a7cf6bfa81f03f87f106a85c7e351da8 assets/create/lang/en_us.json +950f435754c82bb46d0f0bbd7fb0ea5c2a6db2be assets/create/lang/unfinished/de_de.json +953669a0880eb087bff8c6a0f31ab593826410ac assets/create/lang/unfinished/es_es.json +49dcba9e9e74421dc74e24a27f6876a9f9e4bafa assets/create/lang/unfinished/es_mx.json +db5fa9ea3a940cc378657db43d7de6f71abb8da3 assets/create/lang/unfinished/fr_fr.json +144bbca783790c63c1671388227a00780c23e5ba assets/create/lang/unfinished/it_it.json +8ebf781c5e3d8dd78eed9c1445d39a643dd1e2b1 assets/create/lang/unfinished/ja_jp.json +46f41cb9e6870bbb8aa4d58525f7ab07f5e911ff assets/create/lang/unfinished/ko_kr.json +eb16433d9ba6c3f9748074f48c22368c81cc52b3 assets/create/lang/unfinished/nl_nl.json +a4aa6902f68a6e4c2c0ce38dee6623e80a6cc65e assets/create/lang/unfinished/pt_br.json +8f889340f518084c90eba259ddbe822601462c4a assets/create/lang/unfinished/ru_ru.json +737e73147690f40aaae5ed51d24e3016fa9d778c assets/create/lang/unfinished/zh_cn.json +34826633b870307b430c64ec62695852b27cb872 assets/create/lang/unfinished/zh_tw.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index c7b5d21ad..2032f7448 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1829,6 +1829,7 @@ "create.ponder.previous": "Previous Scene", "create.ponder.replay": "Replay", "create.ponder.think_back": "Think Back", + "create.ponder.slow_text": "Comfy Reading", "create.ponder.shared.movement_anchors": "With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "32 RPM", "create.ponder.shared.sneak_and": "Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 043f0e322..141fee0d9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1506", + "_": "Missing Localizations: 1507", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_es.json b/src/generated/resources/assets/create/lang/unfinished/es_es.json index b2e8c7da2..b5220f2d3 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_es.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_es.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 541", + "_": "Missing Localizations: 542", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index b6c37a338..8beff1428 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1436", + "_": "Missing Localizations: 1437", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index af65f930a..17937cc79 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1218", + "_": "Missing Localizations: 1219", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index dde52b028..207f43b51 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 558", + "_": "Missing Localizations: 559", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index 73d0995a1..d1f0cfd19 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 565", + "_": "Missing Localizations: 566", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index 0788669d2..506b241b9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 611", + "_": "Missing Localizations: 612", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index 375fd54da..9ea591d07 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1705", + "_": "Missing Localizations: 1706", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index f3be159ec..cd99e83ca 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1771", + "_": "Missing Localizations: 1772", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 879ba25c9..7f3f96767 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 561", + "_": "Missing Localizations: 562", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 3b343e167..e5dba1fb9 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 559", + "_": "Missing Localizations: 560", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 6f2d608e7..f51b62266 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 564", + "_": "Missing Localizations: 565", "_": "->------------------------] Game Elements [------------------------<-", @@ -1830,6 +1830,7 @@ "create.ponder.previous": "UNLOCALIZED: Previous Scene", "create.ponder.replay": "UNLOCALIZED: Replay", "create.ponder.think_back": "UNLOCALIZED: Think Back", + "create.ponder.slow_text": "UNLOCALIZED: Comfy Reading", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.rpm32": "UNLOCALIZED: 32 RPM", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java index 577ea8028..cb12f0517 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java @@ -123,7 +123,8 @@ public class AllIcons implements IScreenRenderable { I_MTD_RIGHT = next(), I_MTD_SCAN = next(), I_MTD_REPLAY = next(), - I_MTD_USER_MODE = next(); + I_MTD_USER_MODE = next(), + I_MTD_SLOW_MODE = next(); public AllIcons(int x, int y) { iconX = x * 16; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java index 62e359ab2..ad8a895fa 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java @@ -80,6 +80,7 @@ public class PonderLocalization { addGeneral(object, PonderUI.PREVIOUS, "Previous Scene"); addGeneral(object, PonderUI.REPLAY, "Replay"); addGeneral(object, PonderUI.THINK_BACK, "Think Back"); + addGeneral(object, PonderUI.SLOW_TEXT, "Comfy Reading"); shared.forEach((k, v) -> object.addProperty(Create.ID + "." + langKeyForShared(k), v)); tag.forEach((k, v) -> { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 29435f48e..0c0e0c630 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.ponder; +import static com.simibubi.create.foundation.ponder.PonderLocalization.LANG_PREFIX; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -21,6 +23,7 @@ import com.simibubi.create.foundation.ponder.content.PonderChapter; import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.content.PonderTag; import com.simibubi.create.foundation.ponder.content.PonderTagScreen; +import com.simibubi.create.foundation.ponder.elements.TextWindowElement; import com.simibubi.create.foundation.ponder.ui.PonderButton; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.ColorHelper; @@ -58,14 +61,15 @@ public class PonderUI extends NavigatableSimiScreen { public static int ponderTicks; public static float ponderPartialTicksPaused; - public static final String PONDERING = PonderLocalization.LANG_PREFIX + "pondering"; - public static final String IDENTIFY_MODE = PonderLocalization.LANG_PREFIX + "identify_mode"; - public static final String IN_CHAPTER = PonderLocalization.LANG_PREFIX + "in_chapter"; - public static final String IDENTIFY = PonderLocalization.LANG_PREFIX + "identify"; - public static final String PREVIOUS = PonderLocalization.LANG_PREFIX + "previous"; - public static final String CLOSE = PonderLocalization.LANG_PREFIX + "close"; - public static final String NEXT = PonderLocalization.LANG_PREFIX + "next"; - public static final String REPLAY = PonderLocalization.LANG_PREFIX + "replay"; + public static final String PONDERING = LANG_PREFIX + "pondering"; + public static final String IDENTIFY_MODE = LANG_PREFIX + "identify_mode"; + public static final String IN_CHAPTER = LANG_PREFIX + "in_chapter"; + public static final String IDENTIFY = LANG_PREFIX + "identify"; + public static final String PREVIOUS = LANG_PREFIX + "previous"; + public static final String CLOSE = LANG_PREFIX + "close"; + public static final String NEXT = LANG_PREFIX + "next"; + public static final String REPLAY = LANG_PREFIX + "replay"; + public static final String SLOW_TEXT = LANG_PREFIX + "slow_text"; private List scenes; private List tags; @@ -76,6 +80,7 @@ public class PonderUI extends NavigatableSimiScreen { PonderChapter chapter = null; private boolean userViewMode; + private boolean slowTextMode; private boolean identifyMode; private ItemStack hoveredTooltipItem; private BlockPos hoveredBlockPos; @@ -90,10 +95,13 @@ public class PonderUI extends NavigatableSimiScreen { private int index = 0; private PonderTag referredToByTag; - private PonderButton left, right, scan, chap, userMode, close, replay; + private PonderButton left, right, scan, chap, userMode, close, replay, slowMode; private PonderProgressBar progressBar; private int skipCooling = 0; + private int extendedTickLength = 0; + private int extendedTickTimer = 0; + public static PonderUI of(ResourceLocation id) { return new PonderUI(PonderRegistry.compile(id)); } @@ -196,8 +204,13 @@ public class PonderUI extends NavigatableSimiScreen { .shortcut(bindings.keyBindDrop) .fade(0, -1)); + widgets.add(slowMode = new PonderButton(width - 20 - 31, bY, () -> { + slowTextMode = !slowTextMode; + }).showing(AllIcons.I_MTD_SLOW_MODE) + .fade(0, -1)); + if (PonderIndex.EDITOR_MODE) { - widgets.add(userMode = new PonderButton(width - 20 - 31, bY, () -> { + widgets.add(userMode = new PonderButton(width - 50 - 31, bY, () -> { userViewMode = !userViewMode; }).showing(AllIcons.I_MTD_USER_MODE) .fade(0, -1)); @@ -250,16 +263,32 @@ public class PonderUI extends NavigatableSimiScreen { referredToByTag = null; } - PonderScene activeScene = scenes.get(index); - if (!identifyMode) { - ponderTicks++; - if (skipCooling == 0) - activeScene.tick(); - } - lazyIndex.tickChaser(); fadeIn.tickChaser(); finishingFlash.tickChaser(); + PonderScene activeScene = scenes.get(index); + + extendedTickLength = 0; + if (slowTextMode) + activeScene.forEachVisible(TextWindowElement.class, twe -> extendedTickLength = 2); + + if (extendedTickTimer == 0) { + if (!identifyMode) { + ponderTicks++; + if (skipCooling == 0) + activeScene.tick(); + } + + if (!identifyMode) { + float lazyIndexValue = lazyIndex.getValue(); + if (Math.abs(lazyIndexValue - index) > 1 / 512f) + scenes.get(lazyIndexValue < index ? index - 1 : index + 1) + .tick(); + } + extendedTickTimer = extendedTickLength; + } else + extendedTickTimer--; + progressBar.tick(); if (activeScene.currentTime == activeScene.totalTime - 1) @@ -272,13 +301,6 @@ public class PonderUI extends NavigatableSimiScreen { } } - if (!identifyMode) { - float lazyIndexValue = lazyIndex.getValue(); - if (Math.abs(lazyIndexValue - index) > 1 / 512f) - scenes.get(lazyIndexValue < index ? index - 1 : index + 1) - .tick(); - } - updateIdentifiedItem(activeScene); } @@ -357,6 +379,7 @@ public class PonderUI extends NavigatableSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { + partialTicks = getPartialTicks(); RenderSystem.enableBlend(); renderVisibleScenes(mouseX, mouseY, skipCooling > 0 ? 0 : identifyMode ? ponderPartialTicksPaused : partialTicks); @@ -388,7 +411,7 @@ public class PonderUI extends NavigatableSimiScreen { RenderSystem.enableDepthTest(); RenderSystem.pushMatrix(); - + // has to be outside of MS transforms, important for vertex sorting RenderSystem.translated(0, 0, 800); @@ -400,8 +423,6 @@ public class PonderUI extends NavigatableSimiScreen { story.renderScene(buffer, ms, partialTicks); buffer.draw(); - RenderSystem.popMatrix(); - MutableBoundingBox bounds = story.getBounds(); RenderSystem.pushMatrix(); RenderSystem.multMatrix(ms.peek() @@ -492,8 +513,8 @@ public class PonderUI extends NavigatableSimiScreen { } RenderSystem.popMatrix(); - ms.pop(); + RenderSystem.popMatrix(); } protected void renderWidgets(int mouseX, int mouseY, float partialTicks) { @@ -547,7 +568,7 @@ public class PonderUI extends NavigatableSimiScreen { drawRightAlignedString(font, Lang.translate(IN_CHAPTER), 0, 0, tooltipColor); drawRightAlignedString(font, - Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); + Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); RenderSystem.popMatrix(); } @@ -594,6 +615,11 @@ public class PonderUI extends NavigatableSimiScreen { else userMode.dim(); } + + if (slowTextMode) + slowMode.flash(); + else + slowMode.dim(); { // Scene overlay @@ -680,6 +706,10 @@ public class PonderUI extends NavigatableSimiScreen { drawCenteredString(font, Lang.translate(NEXT), right.x + 10, tooltipY, tooltipColor); if (replay.isHovered()) drawCenteredString(font, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor); + if (slowMode.isHovered()) + drawCenteredString(font, Lang.translate(SLOW_TEXT), slowMode.x + 5, tooltipY, tooltipColor); + if (PonderIndex.EDITOR_MODE && userMode.isHovered()) + drawCenteredString(font, "Editor View", userMode.x + 10, tooltipY, tooltipColor); RenderSystem.popMatrix(); } @@ -794,7 +824,7 @@ public class PonderUI extends NavigatableSimiScreen { @Override protected String getBreadcrumbTitle() { if (chapter != null) - return Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()); + return Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()); return stack.getItem() .getName() @@ -922,13 +952,18 @@ public class PonderUI extends NavigatableSimiScreen { } public static float getPartialTicks() { + float renderPartialTicks = Minecraft.getInstance() + .getRenderPartialTicks(); + if (Minecraft.getInstance().currentScreen instanceof PonderUI) { PonderUI ui = (PonderUI) Minecraft.getInstance().currentScreen; if (ui.identifyMode) return ponderPartialTicksPaused; + + return (renderPartialTicks + (ui.extendedTickLength - ui.extendedTickTimer)) / (ui.extendedTickLength + 1); } - return Minecraft.getInstance() - .getRenderPartialTicks(); + + return renderPartialTicks; } @Override diff --git a/src/main/resources/assets/create/textures/gui/icons.png b/src/main/resources/assets/create/textures/gui/icons.png index c9d661aee4462a0b8ea19468f8c50e180a0a9546..1dff79b367fb92985f19643b0fe3032bca2a9dae 100644 GIT binary patch literal 2923 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 Hdc=PKERk3x literal 2881 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 R_r9rsg^8{4Q$x4-e*=$OM{WQB