diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 656dc417d..b23271ec1 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -43,6 +43,7 @@ import com.simibubi.create.modules.contraptions.relays.ShaftBlock; import com.simibubi.create.modules.contraptions.relays.ShaftHalfBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelBlock; +import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock; import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock; import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock; import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock; @@ -132,6 +133,11 @@ public enum AllBlocks { MECHANICAL_CRAFTER_ARROW(new RenderUtilityDirectionalBlock()), MECHANICAL_CRAFTER_BELT_FRAME(new RenderUtilityDirectionalBlock()), MECHANICAL_CRAFTER_BELT(new RenderUtilityDirectionalBlock()), + SPEED_GAUGE(new GaugeBlock(GaugeBlock.Type.SPEED)), + STRESS_GAUGE(new GaugeBlock(GaugeBlock.Type.STRESS)), + GAUGE_DIAL(new RenderUtilityBlock()), + GAUGE_INDICATOR(new RenderUtilityBlock()), + GAUGE_HEAD(new GaugeBlock.Head()), MECHANICAL_PISTON(new MechanicalPistonBlock(false)), STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)), diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 00651bd74..1bb970ba9 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -43,6 +43,10 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntityRenderer; +import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock; +import com.simibubi.create.modules.contraptions.relays.gauge.GaugeTileEntityRenderer; +import com.simibubi.create.modules.contraptions.relays.gauge.SpeedGaugeTileEntity; +import com.simibubi.create.modules.contraptions.relays.gauge.StressGaugeTileEntity; import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity; import com.simibubi.create.modules.logistics.block.LinkedTileEntityRenderer; import com.simibubi.create.modules.logistics.block.RedstoneBridgeTileEntity; @@ -115,6 +119,8 @@ public enum AllTileEntities { MECHANICAL_MIXER(MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER), BASIN(BasinTileEntity::new, AllBlocks.BASIN), MECHANICAL_CRAFTER(MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER), + SPEED_GAUGE(SpeedGaugeTileEntity::new, AllBlocks.SPEED_GAUGE), + STRESS_GAUGE(StressGaugeTileEntity::new, AllBlocks.STRESS_GAUGE), // Logistics REDSTONE_BRIDGE(RedstoneBridgeTileEntity::new, AllBlocks.REDSTONE_BRIDGE), @@ -198,6 +204,8 @@ public enum AllTileEntities { bind(MechanicalMixerTileEntity.class, new MechanicalMixerTileEntityRenderer()); bind(MechanicalCrafterTileEntity.class, new MechanicalCrafterTileEntityRenderer()); bind(BasinTileEntity.class, new BasinTileEntityRenderer()); + bind(SpeedGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.SPEED)); + bind(StressGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.STRESS)); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index 040ae527d..cd347c60d 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -8,13 +8,11 @@ import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.modules.contraptions.KineticDebugger; -import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.receivers.TurntableHandler; import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItemHandler; import net.minecraft.client.Minecraft; -import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; diff --git a/src/main/java/com/simibubi/create/CreateConfig.java b/src/main/java/com/simibubi/create/CreateConfig.java index 4cb1c2fbc..f6651d6dd 100644 --- a/src/main/java/com/simibubi/create/CreateConfig.java +++ b/src/main/java/com/simibubi/create/CreateConfig.java @@ -459,6 +459,8 @@ public class CreateConfig { case ENCASED_BELT: case ENCASED_SHAFT: case SHAFT: + case SPEED_GAUGE: + case STRESS_GAUGE: default: return 1; } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index b2269db2d..2eeb26366 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -86,7 +86,7 @@ public class ItemDescription { if (hasSpeedRequirement) { List speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); int index = minimumRequiredSpeedLevel.ordinal(); - String level = minimumRequiredSpeedLevel.getColor() + makeProgressBar(3, index) + speedLevels.get(index); + String level = minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index) + speedLevels.get(index); add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement")); add(linesOnShift, level); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java index 3771b8a30..b034fc27a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java @@ -89,9 +89,8 @@ public class KineticNetwork { } public void sync() { - for (KineticTileEntity te : members.keySet()) { + for (KineticTileEntity te : members.keySet()) te.sync(maxStress, currentStress); - } } public void updateStressCapacity() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/DirectionalAxisKineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/DirectionalAxisKineticBlock.java index 5c303dada..8081ed6ae 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/DirectionalAxisKineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/DirectionalAxisKineticBlock.java @@ -24,14 +24,23 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc super.fillStateContainer(builder); } + protected Direction getFacingForPlacement(BlockItemUseContext context) { + Direction facing = context.getNearestLookingDirection().getOpposite(); + if (context.isPlacerSneaking()) + facing = facing.getOpposite(); + return facing; + } + + protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) { + return context.getPlacementHorizontalFacing().getAxis() == Axis.X; + } + @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - Direction facing = context.getNearestLookingDirection().getOpposite(); + Direction facing = getFacingForPlacement(context); BlockPos pos = context.getPos(); World world = context.getWorld(); boolean alongFirst = false; - if (context.isPlacerSneaking()) - facing = facing.getOpposite(); if (facing.getAxis().isHorizontal()) { alongFirst = facing.getAxis() == Axis.Z; @@ -48,7 +57,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc } if (facing.getAxis().isVertical()) { - alongFirst = context.getPlacementHorizontalFacing().getAxis() == Axis.X; + alongFirst = getAxisAlignmentForPlacement(context); Direction prefferedSide = null; for (Direction side : Direction.values()) { if (side.getAxis().isVertical()) @@ -72,7 +81,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc return this.getDefaultState().with(FACING, facing).with(AXIS_ALONG_FIRST_COORDINATE, alongFirst); } - + @Override public Axis getRotationAxis(BlockState state) { Axis pistonAxis = state.get(FACING).getAxis(); @@ -87,7 +96,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc return super.getRotationAxis(state); } - + @Override public boolean hasShaftTowards(World world, BlockPos pos, BlockState state, Direction face) { return face.getAxis() == getRotationAxis(state); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java b/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java index 70cae5715..0e33e5f9f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java @@ -16,11 +16,19 @@ public interface IRotate { public enum SpeedLevel { NONE, MEDIUM, FAST; - public TextFormatting getColor() { + public TextFormatting getTextColor() { return this == NONE ? TextFormatting.GREEN : this == MEDIUM ? TextFormatting.AQUA : TextFormatting.LIGHT_PURPLE; } + + public int getColor() { + return this == NONE ? 0x22FF22 : this == MEDIUM ? 0x0084FF : 0xFF55FF; + } + public int getParticleSpeed() { + return this == NONE ? 10 : this == MEDIUM ? 20 : 30; + } + public static SpeedLevel of(float speed) { speed = Math.abs(speed); @@ -35,10 +43,9 @@ public interface IRotate { public enum StressImpact { LOW, MEDIUM, HIGH; - + public TextFormatting getColor() { - return this == LOW ? TextFormatting.YELLOW - : this == MEDIUM ? TextFormatting.GOLD : TextFormatting.RED; + return this == LOW ? TextFormatting.YELLOW : this == MEDIUM ? TextFormatting.GOLD : TextFormatting.RED; } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index beac04ca5..7cb2c50f7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -346,22 +346,9 @@ public abstract class KineticTileEntity extends SyncedTileEntity implements ITic char axisChar = axis.name().charAt(0); Vec3d vec = VecHelper.getCenterOf(pos); - int color = 0x22FF22; - int particleSpeed = 10; - - switch (SpeedLevel.of(getSpeed())) { - case FAST: - color = 16733695; - particleSpeed = 30; - break; - case MEDIUM: - color = 0x0084FF; - particleSpeed = 20; - break; - default: - break; - } - + SpeedLevel speedLevel = SpeedLevel.of(getSpeed()); + int color = speedLevel.getColor(); + int particleSpeed = speedLevel.getParticleSpeed(); particleSpeed *= Math.signum(getSpeed()); if (getWorld() instanceof ServerWorld) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java new file mode 100644 index 000000000..7caa46e6b --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java @@ -0,0 +1,198 @@ +package com.simibubi.create.modules.contraptions.relays.gauge; + +import java.util.Random; + +import com.simibubi.create.foundation.block.RenderUtilityBlock; +import com.simibubi.create.foundation.utility.ColorHelper; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.VecHelper; +import com.simibubi.create.foundation.utility.VoxelShaper; +import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.material.Material; +import net.minecraft.block.material.MaterialColor; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.particles.RedstoneParticleData; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.IProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Direction.AxisDirection; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; + +public class GaugeBlock extends DirectionalAxisKineticBlock { + + protected Type type; + + protected VoxelShape LOG = makeCuboidShape(1, 2, 2, 15, 14, 14); + protected VoxelShaper PLATE = VoxelShaper.forDirectional(makeCuboidShape(0, 1, 0, 16, 15, 2)); + + protected VoxelShaper ON_WALL_HORIZONTAL = VoxelShaper + .forHorizontal(VoxelShapes.or(PLATE.get(Direction.SOUTH), LOG)); + protected VoxelShaper ON_WALL_VERTICAL = VoxelShaper + .forHorizontal(VoxelShapes.or(makeCuboidShape(1, 0, 0, 15, 16, 2), makeCuboidShape(2, 1, 2, 14, 15, 14))); + protected VoxelShaper ON_GROUND = VoxelShaper.forHorizontalAxis(VoxelShapes.or(PLATE.get(Direction.UP), LOG)); + protected VoxelShaper ON_CEILING = VoxelShaper.forHorizontalAxis(VoxelShapes.or(PLATE.get(Direction.DOWN), LOG)); + + public enum Type implements IStringSerializable { + SPEED, STRESS; + + @Override + public String getName() { + return Lang.asId(name()); + } + } + + public GaugeBlock(Type type) { + super(Properties.from(Blocks.PISTON)); + this.type = type; + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + switch (type) { + case SPEED: + return new SpeedGaugeTileEntity(); + case STRESS: + return new StressGaugeTileEntity(); + default: + return null; + } + } + + @SuppressWarnings("deprecation") + @Override + public MaterialColor getMaterialColor(BlockState state, IBlockReader worldIn, BlockPos pos) { + return Blocks.SPRUCE_PLANKS.getMaterialColor(state, worldIn, pos); + } + + @Override + protected boolean hasStaticPart() { + return true; + } + + @Override + public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { + Direction facing = state.get(FACING).getOpposite(); + BlockPos neighbourPos = pos.offset(facing); + BlockState neighbour = worldIn.getBlockState(neighbourPos); + return Block.hasSolidSide(neighbour, worldIn, neighbourPos, facing.getOpposite()); + } + + @Override + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, + boolean isMoving) { + if (worldIn.isRemote) + return; + + Direction blockFacing = state.get(FACING); + if (fromPos.equals(pos.offset(blockFacing.getOpposite()))) { + if (!isValidPosition(state, worldIn, pos)) { + worldIn.destroyBlock(pos, true); + return; + } + } + } + + @Override + protected Direction getFacingForPlacement(BlockItemUseContext context) { + return context.getFace(); + } + + protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) { + return context.getPlacementHorizontalFacing().getAxis() != Axis.X; + } + + public boolean shouldRenderHeadOnFace(World world, BlockPos pos, BlockState state, Direction face) { + if (face.getAxis().isVertical()) + return false; + if (face == state.get(FACING).getOpposite()) + return false; + if (face.getAxis() == getRotationAxis(state)) + return false; + if (getRotationAxis(state) == Axis.Y && face != state.get(FACING)) + return false; + BlockState blockState = world.getBlockState(pos.offset(face)); + if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) + && blockState.getMaterial() != Material.GLASS) + return false; + return true; + } + + @Override + public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { + TileEntity te = worldIn.getTileEntity(pos); + if (te == null || !(te instanceof GaugeTileEntity)) + return; + GaugeTileEntity gaugeTE = (GaugeTileEntity) te; + if (gaugeTE.dialTarget == 0) + return; + int color = gaugeTE.color; + + for (Direction face : Direction.values()) { + if (!shouldRenderHeadOnFace(worldIn, pos, stateIn, face)) + continue; + + Vec3d rgb = ColorHelper.getRGB(color); + Vec3d faceVec = new Vec3d(face.getDirectionVec()); + Direction positiveFacing = Direction.getFacingFromAxis(AxisDirection.POSITIVE, face.getAxis()); + Vec3d positiveFaceVec = new Vec3d(positiveFacing.getDirectionVec()); + int particleCount = gaugeTE.dialTarget > 1 ? 4 : 1; + + if (particleCount == 1 && rand.nextFloat() > 1 / 4f) + continue; + + for (int i = 0; i < particleCount; i++) { + Vec3d mul = VecHelper.offsetRandomly(Vec3d.ZERO, rand, .25f) + .mul(new Vec3d(1, 1, 1).subtract(positiveFaceVec)).normalize().scale(.3f); + Vec3d offset = VecHelper.getCenterOf(pos).add(faceVec.scale(.55)).add(mul); + worldIn.addParticle(new RedstoneParticleData((float) rgb.x, (float) rgb.y, (float) rgb.z, 1), offset.x, + offset.y, offset.z, mul.x, mul.y, mul.z); + } + + } + + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + Direction facing = state.get(FACING); + Axis axis = getRotationAxis(state); + + if (facing.getAxis().isHorizontal()) { + if (axis.isHorizontal()) + return ON_WALL_HORIZONTAL.get(facing); + return ON_WALL_VERTICAL.get(facing); + } + + axis = axis == Axis.X ? Axis.Z : Axis.X; + if (facing == Direction.UP) + return ON_GROUND.get(axis); + if (facing == Direction.DOWN) + return ON_CEILING.get(axis); + return VoxelShapes.empty(); + } + + public static class Head extends RenderUtilityBlock { + public static final IProperty TYPE = EnumProperty.create("type", Type.class); + + @Override + protected void fillStateContainer(Builder builder) { + super.fillStateContainer(builder.add(TYPE)); + } + } + +} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntity.java new file mode 100644 index 000000000..571c31a8b --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntity.java @@ -0,0 +1,48 @@ +package com.simibubi.create.modules.contraptions.relays.gauge; + +import com.simibubi.create.modules.contraptions.base.KineticTileEntity; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntityType; + +public class GaugeTileEntity extends KineticTileEntity { + + public float dialTarget; + public float dialState; + public float prevDialState; + public int color; + + public GaugeTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putFloat("Value", dialTarget); + compound.putInt("Color", color); + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + dialTarget = compound.getFloat("Value"); + color = compound.getInt("Color"); + super.read(compound); + } + + @Override + public void removeSource() { + super.removeSource(); + dialTarget = 0; + } + + @Override + public void tick() { + super.tick(); + prevDialState = dialState; + dialState += (dialTarget - dialState) * .125f; + if (dialState > 1 && world.rand.nextFloat() < 1 / 2f) + dialState -= (dialState - 1) * world.rand.nextFloat(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java new file mode 100644 index 000000000..23c74edd7 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java @@ -0,0 +1,68 @@ +package com.simibubi.create.modules.contraptions.relays.gauge; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.utility.SuperByteBuffer; +import com.simibubi.create.modules.contraptions.base.IRotate; +import com.simibubi.create.modules.contraptions.base.KineticTileEntity; +import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; + +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.MathHelper; + +public class GaugeTileEntityRenderer extends KineticTileEntityRenderer { + + protected GaugeBlock.Type type; + + public GaugeTileEntityRenderer(GaugeBlock.Type type) { + this.type = type; + } + + @Override + public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + int destroyStage, BufferBuilder buffer) { + BlockState gaugeState = te.getBlockState(); + if (!(gaugeState.getBlock() instanceof GaugeBlock)) + return; + + super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer); + GaugeTileEntity gaugeTE = (GaugeTileEntity) te; + int lightCoords = gaugeState.getPackedLightmapCoords(getWorld(), te.getPos()); + + BlockState head = AllBlocks.GAUGE_HEAD.get().getDefaultState().with(GaugeBlock.Head.TYPE, type); + BlockState dial = AllBlocks.GAUGE_DIAL.get().getDefaultState(); + + SuperByteBuffer headBuffer = CreateClient.bufferCache.renderGenericBlockModel(head); + SuperByteBuffer dialBuffer = CreateClient.bufferCache.renderGenericBlockModel(dial); + + for (Direction facing : Direction.values()) { + if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(getWorld(), te.getPos(), gaugeState, + facing)) + continue; + + float dialPivot = -5.75f / 16; + float progress = MathHelper.lerp(partialTicks, gaugeTE.prevDialState, gaugeTE.dialState); + dialBuffer.translate(0, dialPivot, dialPivot).rotate(Axis.X, (float) (Math.PI / 2 * -progress)).translate(0, + -dialPivot, -dialPivot); + + rotateBufferTowards(dialBuffer, facing).light(lightCoords).translate(x, y, z).renderInto(buffer); + rotateBufferTowards(headBuffer, facing).light(lightCoords).translate(x, y, z).renderInto(buffer); + } + + } + + @Override + protected BlockState getRenderedBlockState(KineticTileEntity te) { + return AllBlocks.SHAFT.block.getDefaultState().with(BlockStateProperties.AXIS, + ((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState())); + } + + protected SuperByteBuffer rotateBufferTowards(SuperByteBuffer buffer, Direction target) { + return buffer.rotateCentered(Axis.Y, (float) ((-target.getHorizontalAngle() - 90) / 180 * Math.PI)); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/SpeedGaugeTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/SpeedGaugeTileEntity.java new file mode 100644 index 000000000..090e337bc --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/SpeedGaugeTileEntity.java @@ -0,0 +1,36 @@ +package com.simibubi.create.modules.contraptions.relays.gauge; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.CreateConfig; +import com.simibubi.create.foundation.utility.ColorHelper; +import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; + +import net.minecraft.util.math.MathHelper; + +public class SpeedGaugeTileEntity extends GaugeTileEntity { + + public SpeedGaugeTileEntity() { + super(AllTileEntities.SPEED_GAUGE.type); + } + + @Override + public void onSpeedChanged() { + float speed = Math.abs(getSpeed()); + float medium = CreateConfig.parameters.mediumSpeed.get().floatValue(); + float fast = CreateConfig.parameters.fastSpeed.get().floatValue(); + float max = CreateConfig.parameters.maxRotationSpeed.get().floatValue(); + color = ColorHelper.mixColors(SpeedLevel.of(speed).getColor(), 0xffffff, .25f); + + if (speed == 0) { + dialTarget = 0; + color = 0x333333; + } else if (speed < medium) { + dialTarget = MathHelper.lerp(speed / medium, 0, .45f); + } else if (speed < fast) { + dialTarget = MathHelper.lerp((speed - medium) / (fast - medium), .45f, .75f); + } else { + dialTarget = MathHelper.lerp((speed - fast) / (max - fast), .75f, 1.125f); + } + } + +} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/StressGaugeTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/StressGaugeTileEntity.java new file mode 100644 index 000000000..82678d9b7 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/StressGaugeTileEntity.java @@ -0,0 +1,35 @@ +package com.simibubi.create.modules.contraptions.relays.gauge; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.utility.ColorHelper; + +public class StressGaugeTileEntity extends GaugeTileEntity { + + public StressGaugeTileEntity() { + super(AllTileEntities.STRESS_GAUGE.type); + } + + @Override + public void sync(float maxStress, float currentStress) { + super.sync(maxStress, currentStress); + + if (overStressed) + dialTarget = 1.125f; + else if (maxStress == 0) + dialTarget = 0; + else + dialTarget = currentStress / maxStress; + + if (dialTarget > 0) { + if (dialTarget < .5f) + color = ColorHelper.mixColors(0x00FF00, 0xFFFF00, dialTarget * 2); + else if (dialTarget < 1) + color = ColorHelper.mixColors(0xFFFF00, 0xFF0000, (dialTarget) * 2 - 1); + else + color = 0xFF0000; + } + + sendData(); + } + +} diff --git a/src/main/resources/assets/create/blockstates/gauge_dial.json b/src/main/resources/assets/create/blockstates/gauge_dial.json new file mode 100644 index 000000000..8c6a988bf --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gauge_dial.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "create:block/gauge/dial" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/gauge_head.json b/src/main/resources/assets/create/blockstates/gauge_head.json new file mode 100644 index 000000000..ff76ceab9 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gauge_head.json @@ -0,0 +1,6 @@ +{ + "variants": { + "type=speed": { "model": "create:block/gauge/speed" }, + "type=stress": { "model": "create:block/gauge/stress" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/gauge_indicator.json b/src/main/resources/assets/create/blockstates/gauge_indicator.json new file mode 100644 index 000000000..9e3f611be --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gauge_indicator.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "create:block/gauge/indicator" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/speed_gauge.json b/src/main/resources/assets/create/blockstates/speed_gauge.json new file mode 100644 index 000000000..ee071ca12 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/speed_gauge.json @@ -0,0 +1,18 @@ +{ + "forge_marker": 1, + "variants": { + "facing=east,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 0, "y": 0 }, + "facing=west,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 0, "y": 180 }, + "facing=up,axis_along_first=false": { "model": "create:block/gauge/base", "x": 0, "y": 0 }, + "facing=down,axis_along_first=false": { "model": "create:block/gauge/base", "x": 180, "y": 0 }, + "facing=south,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 90, "y": 90 }, + "facing=north,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 90, "y": 270 }, + + "facing=east,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 90, "y": 0 }, + "facing=west,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 90, "y": 180 }, + "facing=up,axis_along_first=true": { "model": "create:block/gauge/base", "x": 0, "y": 90 }, + "facing=down,axis_along_first=true": { "model": "create:block/gauge/base", "x": 180, "y": 90 }, + "facing=south,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 0, "y": 90 }, + "facing=north,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 0, "y": 270 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/stress_gauge.json b/src/main/resources/assets/create/blockstates/stress_gauge.json new file mode 100644 index 000000000..ee071ca12 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/stress_gauge.json @@ -0,0 +1,18 @@ +{ + "forge_marker": 1, + "variants": { + "facing=east,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 0, "y": 0 }, + "facing=west,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 0, "y": 180 }, + "facing=up,axis_along_first=false": { "model": "create:block/gauge/base", "x": 0, "y": 0 }, + "facing=down,axis_along_first=false": { "model": "create:block/gauge/base", "x": 180, "y": 0 }, + "facing=south,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 90, "y": 90 }, + "facing=north,axis_along_first=false": { "model": "create:block/gauge/base_wall", "x": 90, "y": 270 }, + + "facing=east,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 90, "y": 0 }, + "facing=west,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 90, "y": 180 }, + "facing=up,axis_along_first=true": { "model": "create:block/gauge/base", "x": 0, "y": 90 }, + "facing=down,axis_along_first=true": { "model": "create:block/gauge/base", "x": 180, "y": 90 }, + "facing=south,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 0, "y": 90 }, + "facing=north,axis_along_first=true": { "model": "create:block/gauge/base_wall", "x": 0, "y": 270 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index a49e7b39e..f2daf42af 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -73,6 +73,8 @@ "block.create.mechanical_mixer": "Mechanical Mixer", "block.create.basin": "Basin", "block.create.mechanical_crafter": "Mechanical Crafter", + "block.create.speed_gauge": "Speedometer", + "block.create.stress_gauge": "Stress Gauge", "block.create.sticky_mechanical_piston": "Sticky Mechanical Piston", "block.create.mechanical_piston": "Mechanical Piston", @@ -682,6 +684,16 @@ "block.create.flexpeater.tooltip": "FLEX REPEATER", "block.create.flexpeater.tooltip.summary": "An advanced _Redstone_ _Repeater_ with a _configurable_ _Delay_ up to 30 Minutes.", + "block.create.speed_gauge.tooltip": "SPEEDOMETER", + "block.create.speed_gauge.tooltip.summary": "Measures and displays the _rotational_ _speed_ of attached kinetic components.", + "block.create.speed_gauge.tooltip.condition1": "When Rotated", + "block.create.speed_gauge.tooltip.behaviour1": "Indicates a color corresponding to the level of speed. _Green_ indicates Slow, _Blue_ moderate and _Purple_ fast rotation. Some mechanical components require a sufficient level of speed to work properly.", + + "block.create.stress_gauge.tooltip": "STRESS GAUGE", + "block.create.stress_gauge.tooltip.summary": "Measures and displays the _overall_ _stress_ of the attached kinetic network.", + "block.create.stress_gauge.tooltip.condition1": "When Rotated", + "block.create.stress_gauge.tooltip.behaviour1": "Indicates a color corresponding to the level of stress. _Over-stressed_ _networks_ will cease to move. Stress can be relieved by adding more _rotational_ _sources_ to the network.", + "item.create.logistical_controller_calculation.tooltip": "WIP", "item.create.logistical_controller_request.tooltip": "WIP", "item.create.logistical_controller_storage.tooltip": "WIP", diff --git a/src/main/resources/assets/create/models/block/gauge/base.json b/src/main/resources/assets/create/models/block/gauge/base.json new file mode 100644 index 000000000..00db43e7e --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/base.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "2": "create:block/gauge", + "particle": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeBody", + "from": [2, 2, 1], + "to": [14, 14, 15], + "faces": { + "north": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "east": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "west": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "up": {"uv": [9, 10, 16, 16], "rotation": 90, "texture": "#2"}, + "down": {"uv": [9, 10, 16, 16], "rotation": 270, "texture": "#2"} + } + }, + { + "name": "GuageBase", + "from": [1, 0, 0], + "to": [15, 2, 16], + "faces": { + "north": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "east": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "south": {"uv": [0, 9, 7, 10], "texture": "#2"}, + "west": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "up": {"uv": [0, 0, 8, 7], "rotation": 270, "texture": "#2"}, + "down": {"uv": [0, 0, 8, 7], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/base_wall.json b/src/main/resources/assets/create/models/block/gauge/base_wall.json new file mode 100644 index 000000000..32a8003ba --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/base_wall.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "2": "create:block/gauge", + "particle": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeBody", + "from": [2, 2, 1], + "to": [14, 14, 15], + "faces": { + "north": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "east": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "west": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "up": {"uv": [9, 10, 16, 16], "rotation": 90, "texture": "#2"}, + "down": {"uv": [9, 10, 16, 16], "rotation": 270, "texture": "#2"} + } + }, + { + "name": "GuageBase", + "from": [0, 1, 0], + "to": [2, 15, 16], + "faces": { + "north": {"uv": [0, 9, 8, 10], "rotation": 270, "texture": "#2"}, + "east": {"uv": [0, 0, 8, 7], "texture": "#2"}, + "south": {"uv": [0, 9, 7, 10], "rotation": 90, "texture": "#2"}, + "west": {"uv": [0, 0, 8, 7], "rotation": 90, "texture": "#2"}, + "up": {"uv": [0, 9, 8, 10], "rotation": 90, "texture": "#2"}, + "down": {"uv": [0, 9, 8, 10], "rotation": 90, "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/dial.json b/src/main/resources/assets/create/models/block/gauge/dial.json new file mode 100644 index 000000000..1d42dd4ca --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/dial.json @@ -0,0 +1,21 @@ +{ + "textures": { + "2": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeDial", + "from": [15.75, 5.25, 5.75], + "to": [16.45, 6.25, 10.75], + "rotation": {"angle": 0, "axis": "x", "origin": [16, 5.75, 5.75]}, + "faces": { + "north": {"uv": [13.5, 4, 14, 4.5], "rotation": 180, "texture": "#2"}, + "east": {"uv": [13.5, 4, 16, 4.5], "rotation": 180, "texture": "#2"}, + "south": {"uv": [15.5, 4, 16, 4.5], "rotation": 180, "texture": "#2"}, + "west": {"uv": [13.5, 4, 16, 4.5], "texture": "#2"}, + "up": {"uv": [13.5, 4, 16, 4.5], "rotation": 90, "texture": "#2"}, + "down": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/indicator.json b/src/main/resources/assets/create/models/block/gauge/indicator.json new file mode 100644 index 000000000..8a84fef5c --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/indicator.json @@ -0,0 +1,20 @@ +{ + "textures": { + "2": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeColorBar", + "from": [14.5, 2.9, 2.9], + "to": [15.5, 13.1, 13.1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "south": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"}, + "down": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/item_speed.json b/src/main/resources/assets/create/models/block/gauge/item_speed.json new file mode 100644 index 000000000..272337e00 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/item_speed.json @@ -0,0 +1,160 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/cube", + "textures": { + "0": "create:block/axis", + "1": "create:block/axis_top", + "2": "create:block/gauge", + "particle": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeBody", + "from": [2, 2, 1], + "to": [14, 14, 15], + "faces": { + "north": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "east": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "west": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "up": {"uv": [9, 10, 16, 16], "rotation": 90, "texture": "#2"}, + "down": {"uv": [5, 5, 12, 10], "rotation": 270, "texture": "#2"} + } + }, + { + "name": "GuageBase", + "from": [1, 0, 0], + "to": [15, 2, 16], + "faces": { + "north": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "east": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "south": {"uv": [0, 9, 7, 10], "texture": "#2"}, + "west": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "up": {"uv": [0, 0, 8, 7], "rotation": 270, "texture": "#2"}, + "down": {"uv": [0, 0, 8, 7], "texture": "#2"} + } + }, + { + "name": "Gauge", + "from": [16.075, 4, 4], + "to": [16.075, 12, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "east": {"uv": [8, 0, 12, 4], "texture": "#2"} + } + }, + { + "name": "GaugeButton", + "from": [15.5, 5.2, 5.2], + "to": [16.5, 6.3, 6.3], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 8]}, + "faces": { + "north": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "east": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "south": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "west": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "up": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "down": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"} + } + }, + { + "name": "GaugeDial", + "from": [15.75, 5.75, 5.25], + "to": [16.45, 10.75, 6.25], + "rotation": {"angle": 0, "axis": "x", "origin": [16, 5.75, 5.75]}, + "faces": { + "north": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "east": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "south": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "west": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "up": {"uv": [15.5, 4, 16, 4.5], "rotation": 180, "texture": "#2"}, + "down": {"uv": [13.5, 4, 14, 4.5], "texture": "#2"} + } + }, + { + "name": "GuageMetalBack", + "from": [14, 3, 3], + "to": [16, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "east": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "south": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [9, 5, 10, 10], "texture": "#2"}, + "down": {"uv": [9, 5, 10, 10], "texture": "#2"} + } + }, + { + "name": "GaugeColorBar", + "from": [14.5, 2.9, 2.9], + "to": [15.5, 13.1, 13.1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "south": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"}, + "down": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"} + } + }, + { + "name": "Axis", + "from": [6, 6, 0], + "to": [10, 10, 16], + "shade": false, + "faces": { + "north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"}, + "east": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "south": {"uv": [6, 6, 10, 10], "texture": "#1"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "up": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, -165, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 23, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "rotation": [0, 89, 0], + "scale": [0.5, 0.5, 0.5] + } + }, + "groups": [ + { + "name": "Gauge", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6] + }, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [7] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/item_stress.json b/src/main/resources/assets/create/models/block/gauge/item_stress.json new file mode 100644 index 000000000..923184577 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/item_stress.json @@ -0,0 +1,160 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/cube", + "textures": { + "0": "create:block/axis", + "1": "create:block/axis_top", + "2": "create:block/gauge", + "particle": "create:block/gauge" + }, + "elements": [ + { + "name": "GaugeBody", + "from": [2, 2, 1], + "to": [14, 14, 15], + "faces": { + "north": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "east": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 10, 6, 16], "texture": "#2"}, + "west": {"uv": [9, 10, 16, 16], "texture": "#2"}, + "up": {"uv": [9, 10, 16, 16], "rotation": 90, "texture": "#2"}, + "down": {"uv": [5, 5, 12, 10], "rotation": 270, "texture": "#2"} + } + }, + { + "name": "GuageBase", + "from": [1, 0, 0], + "to": [15, 2, 16], + "faces": { + "north": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "east": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "south": {"uv": [0, 9, 7, 10], "texture": "#2"}, + "west": {"uv": [0, 9, 8, 10], "texture": "#2"}, + "up": {"uv": [0, 0, 8, 7], "rotation": 270, "texture": "#2"}, + "down": {"uv": [0, 0, 8, 7], "texture": "#2"} + } + }, + { + "name": "Gauge", + "from": [16.075, 4, 4], + "to": [16.075, 12, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "east": {"uv": [12, 0, 16, 4], "texture": "#2"} + } + }, + { + "name": "GaugeButton", + "from": [15.5, 5.2, 5.2], + "to": [16.5, 6.3, 6.3], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 8]}, + "faces": { + "north": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "east": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "south": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "west": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "up": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "down": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"} + } + }, + { + "name": "GaugeDial", + "from": [15.75, 5.75, 5.25], + "to": [16.45, 10.75, 6.25], + "rotation": {"angle": 0, "axis": "x", "origin": [16, 5.75, 5.75]}, + "faces": { + "north": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "east": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "south": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "west": {"uv": [13.5, 4, 16, 4.5], "rotation": 270, "texture": "#2"}, + "up": {"uv": [15.5, 4, 16, 4.5], "rotation": 180, "texture": "#2"}, + "down": {"uv": [13.5, 4, 14, 4.5], "texture": "#2"} + } + }, + { + "name": "GuageMetalBack", + "from": [14, 3, 3], + "to": [16, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "east": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "south": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [9, 5, 10, 10], "texture": "#2"}, + "down": {"uv": [9, 5, 10, 10], "texture": "#2"} + } + }, + { + "name": "GaugeColorBar", + "from": [14.5, 2.9, 2.9], + "to": [15.5, 13.1, 13.1], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "south": {"uv": [0, 8.5, 5, 9], "rotation": 90, "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"}, + "down": {"uv": [0, 8, 5, 8.5], "rotation": 90, "texture": "#2"} + } + }, + { + "name": "Axis", + "from": [6, 6, 0], + "to": [10, 10, 16], + "shade": false, + "faces": { + "north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"}, + "east": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "south": {"uv": [6, 6, 10, 10], "texture": "#1"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "up": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, -165, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 23, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "rotation": [0, 89, 0], + "scale": [0.5, 0.5, 0.5] + } + }, + "groups": [ + { + "name": "Gauge", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6] + }, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [7] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/speed.json b/src/main/resources/assets/create/models/block/gauge/speed.json new file mode 100644 index 000000000..df0e7a4a2 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/speed.json @@ -0,0 +1,44 @@ +{ + "textures": { + "2": "create:block/gauge" + }, + "elements": [ + { + "name": "Gauge", + "from": [16.075, 4, 4], + "to": [16.075, 12, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "east": {"uv": [8, 0, 12, 4], "texture": "#2"} + } + }, + { + "name": "GaugeButton", + "from": [15.5, 5.2, 5.2], + "to": [16.5, 6.3, 6.3], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 8]}, + "faces": { + "north": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "east": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "south": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "west": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "up": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "down": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"} + } + }, + { + "name": "GuageMetalBack", + "from": [14, 3, 3], + "to": [16, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "east": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "south": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [9, 5, 10, 10], "texture": "#2"}, + "down": {"uv": [9, 5, 10, 10], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gauge/stress.json b/src/main/resources/assets/create/models/block/gauge/stress.json new file mode 100644 index 000000000..1d6329f81 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gauge/stress.json @@ -0,0 +1,44 @@ +{ + "textures": { + "2": "create:block/gauge" + }, + "elements": [ + { + "name": "Gauge", + "from": [16.075, 4, 4], + "to": [16.075, 12, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "east": {"uv": [12, 0, 16, 4], "texture": "#2"} + } + }, + { + "name": "GaugeButton", + "from": [15.5, 5.2, 5.2], + "to": [16.5, 6.3, 6.3], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 8]}, + "faces": { + "north": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "east": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "south": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "west": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "up": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"}, + "down": {"uv": [0, 9.5, 0.5, 10], "texture": "#2"} + } + }, + { + "name": "GuageMetalBack", + "from": [14, 3, 3], + "to": [16, 13, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [9, 8, 8]}, + "faces": { + "north": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "east": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "south": {"uv": [13, 5, 14, 10], "texture": "#2"}, + "west": {"uv": [9, 5, 14, 10], "texture": "#2"}, + "up": {"uv": [9, 5, 10, 10], "texture": "#2"}, + "down": {"uv": [9, 5, 10, 10], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/speed_gauge.json b/src/main/resources/assets/create/models/item/speed_gauge.json new file mode 100644 index 000000000..c7a1c8ad3 --- /dev/null +++ b/src/main/resources/assets/create/models/item/speed_gauge.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gauge/item_speed" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/stress_gauge.json b/src/main/resources/assets/create/models/item/stress_gauge.json new file mode 100644 index 000000000..6aeecf9d1 --- /dev/null +++ b/src/main/resources/assets/create/models/item/stress_gauge.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gauge/item_stress" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/gauge.png b/src/main/resources/assets/create/textures/block/gauge.png new file mode 100644 index 000000000..035ad1172 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/gauge.png differ