From 56c879420b3b43cff046618f153e27ce0170829f Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 6 Aug 2019 18:13:33 +0200 Subject: [PATCH] Added Basic Kinetic Blocks + Axis + Gear + Large Gear + Axis Tunnel + Gearshifter + Gearbox - Added related tileentites and renderers - Added related models and textures - Added the Rotation Propagator --- .../java/com/simibubi/create/AllBlocks.java | 29 +- .../com/simibubi/create/AllTileEntities.java | 45 ++- .../modules/kinetics/RotationPropagator.java | 347 ++++++++++++++++++ .../modules/kinetics/base/HalfAxisBlock.java | 23 ++ .../kinetics/base/HorizontalKineticBlock.java | 42 +++ .../create/modules/kinetics/base/IRotate.java | 16 + .../modules/kinetics/base/KineticBlock.java | 77 ++++ .../kinetics/base/KineticTileEntity.java | 133 +++++++ .../base/KineticTileEntityRenderer.java | 146 ++++++++ .../base/RotatedPillarKineticBlock.java | 49 +++ .../kinetics/generators/MotorBlock.java | 51 +++ .../kinetics/generators/MotorTileEntity.java | 24 ++ .../generators/MotorTileEntityRenderer.java | 18 + .../kinetics/receivers/TurntableBlock.java | 93 +++++ .../kinetics/receivers/TurntableHandler.java | 37 ++ .../receivers/TurntableTileEntity.java | 12 + .../modules/kinetics/relays/AxisBlock.java | 64 ++++ .../kinetics/relays/AxisTileEntity.java | 17 + .../kinetics/relays/AxisTunnelBlock.java | 54 +++ .../kinetics/relays/AxisTunnelTileEntity.java | 17 + .../relays/AxisTunnelTileEntityRenderer.java | 18 + .../kinetics/relays/CogWheelBlock.java | 68 ++++ .../modules/kinetics/relays/GearboxBlock.java | 42 +++ .../kinetics/relays/GearboxTileEntity.java | 12 + .../relays/GearboxTileEntityRenderer.java | 57 +++ .../kinetics/relays/GearshifterBlock.java | 57 +++ .../relays/GearshifterTileEntity.java | 12 + .../relays/GearshifterTileEntityRenderer.java | 51 +++ .../block/SchematicTableTileEntity.java | 2 +- .../block/SchematicannonTileEntity.java | 2 +- .../assets/create/blockstates/axis.json | 11 + .../create/blockstates/axis_tunnel.json | 11 + .../assets/create/blockstates/gear.json | 11 + .../assets/create/blockstates/gearbox.json | 11 + .../create/blockstates/gearshifter.json | 15 + .../assets/create/blockstates/half_axis.json | 14 + .../assets/create/blockstates/large_gear.json | 11 + .../assets/create/blockstates/motor.json | 12 + .../assets/create/blockstates/turntable.json | 9 + .../resources/assets/create/lang/en_us.json | 8 + .../assets/create/models/block/axis.json | 24 ++ .../assets/create/models/block/axis_half.json | 24 ++ .../create/models/block/axis_tunnel.json | 68 ++++ .../assets/create/models/block/gear.json | 106 ++++++ .../assets/create/models/block/gearbox.json | 48 +++ .../create/models/block/gearshifter_off.json | 68 ++++ .../create/models/block/gearshifter_on.json | 8 + .../create/models/block/large_gear.json | 176 +++++++++ .../assets/create/models/block/motor.json | 142 +++++++ .../assets/create/models/block/turntable.json | 51 +++ .../assets/create/models/item/axis.json | 3 + .../create/models/item/axis_tunnel.json | 3 + .../assets/create/models/item/gear.json | 3 + .../assets/create/models/item/gearbox.json | 3 + .../create/models/item/gearshifter.json | 3 + .../assets/create/models/item/large_gear.json | 3 + .../assets/create/models/item/motor.json | 3 + .../assets/create/models/item/turntable.json | 3 + .../assets/create/textures/block/axis.png | Bin 0 -> 261 bytes .../assets/create/textures/block/axis_top.png | Bin 0 -> 247 bytes .../assets/create/textures/block/gearbox.png | Bin 0 -> 426 bytes .../create/textures/block/gearbox_top.png | Bin 0 -> 361 bytes .../create/textures/block/gearshifter_off.png | Bin 0 -> 410 bytes .../create/textures/block/gearshifter_on.png | Bin 0 -> 421 bytes 64 files changed, 2457 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/RotationPropagator.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/HalfAxisBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/HorizontalKineticBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/IRotate.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/KineticBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/base/RotatedPillarKineticBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/generators/MotorBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableHandler.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/AxisBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/CogWheelBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntity.java create mode 100644 src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntityRenderer.java create mode 100644 src/main/resources/assets/create/blockstates/axis.json create mode 100644 src/main/resources/assets/create/blockstates/axis_tunnel.json create mode 100644 src/main/resources/assets/create/blockstates/gear.json create mode 100644 src/main/resources/assets/create/blockstates/gearbox.json create mode 100644 src/main/resources/assets/create/blockstates/gearshifter.json create mode 100644 src/main/resources/assets/create/blockstates/half_axis.json create mode 100644 src/main/resources/assets/create/blockstates/large_gear.json create mode 100644 src/main/resources/assets/create/blockstates/motor.json create mode 100644 src/main/resources/assets/create/blockstates/turntable.json create mode 100644 src/main/resources/assets/create/models/block/axis.json create mode 100644 src/main/resources/assets/create/models/block/axis_half.json create mode 100644 src/main/resources/assets/create/models/block/axis_tunnel.json create mode 100644 src/main/resources/assets/create/models/block/gear.json create mode 100644 src/main/resources/assets/create/models/block/gearbox.json create mode 100644 src/main/resources/assets/create/models/block/gearshifter_off.json create mode 100644 src/main/resources/assets/create/models/block/gearshifter_on.json create mode 100644 src/main/resources/assets/create/models/block/large_gear.json create mode 100644 src/main/resources/assets/create/models/block/motor.json create mode 100644 src/main/resources/assets/create/models/block/turntable.json create mode 100644 src/main/resources/assets/create/models/item/axis.json create mode 100644 src/main/resources/assets/create/models/item/axis_tunnel.json create mode 100644 src/main/resources/assets/create/models/item/gear.json create mode 100644 src/main/resources/assets/create/models/item/gearbox.json create mode 100644 src/main/resources/assets/create/models/item/gearshifter.json create mode 100644 src/main/resources/assets/create/models/item/large_gear.json create mode 100644 src/main/resources/assets/create/models/item/motor.json create mode 100644 src/main/resources/assets/create/models/item/turntable.json create mode 100644 src/main/resources/assets/create/textures/block/axis.png create mode 100644 src/main/resources/assets/create/textures/block/axis_top.png create mode 100644 src/main/resources/assets/create/textures/block/gearbox.png create mode 100644 src/main/resources/assets/create/textures/block/gearbox_top.png create mode 100644 src/main/resources/assets/create/textures/block/gearshifter_off.png create mode 100644 src/main/resources/assets/create/textures/block/gearshifter_on.png diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 10c5a8176..81d468187 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -2,6 +2,14 @@ package com.simibubi.create; import com.simibubi.create.foundation.block.IRenderUtilityBlock; import com.simibubi.create.foundation.block.RenderUtilityBlock; +import com.simibubi.create.modules.kinetics.base.HalfAxisBlock; +import com.simibubi.create.modules.kinetics.generators.MotorBlock; +import com.simibubi.create.modules.kinetics.receivers.TurntableBlock; +import com.simibubi.create.modules.kinetics.relays.AxisBlock; +import com.simibubi.create.modules.kinetics.relays.AxisTunnelBlock; +import com.simibubi.create.modules.kinetics.relays.CogWheelBlock; +import com.simibubi.create.modules.kinetics.relays.GearboxBlock; +import com.simibubi.create.modules.kinetics.relays.GearshifterBlock; import com.simibubi.create.modules.schematics.block.CreativeCrateBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock; @@ -10,23 +18,40 @@ import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock; import com.simibubi.create.modules.symmetry.block.TriplePlaneSymmetryBlock; import net.minecraft.block.Block; +import net.minecraft.block.Block.Properties; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraftforge.registries.IForgeRegistry; public enum AllBlocks { + // Schematics SCHEMATICANNON(new SchematicannonBlock()), SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()), SCHEMATICANNON_PIPE(new RenderUtilityBlock()), CREATIVE_CRATE(new CreativeCrateBlock()), - SCHEMATIC_TABLE(new SchematicTableBlock()), + + // Kinetics + AXIS(new AxisBlock(Properties.from(Blocks.ANDESITE))), + GEAR(new CogWheelBlock(false)), + LARGE_GEAR(new CogWheelBlock(true)), + AXIS_TUNNEL(new AxisTunnelBlock()), + GEARSHIFTER(new GearshifterBlock()), + TURNTABLE(new TurntableBlock()), + HALF_AXIS(new HalfAxisBlock()), + GEARBOX(new GearboxBlock()), + MOTOR(new MotorBlock()), + + // Symmetry SYMMETRY_PLANE(new PlaneSymmetryBlock()), SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()), - SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()); + SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()), + + ; public Block block; diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index a8e9ac26d..94f4c4bdb 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -2,10 +2,22 @@ package com.simibubi.create; import java.util.function.Supplier; +import com.simibubi.create.modules.kinetics.base.KineticTileEntityRenderer; +import com.simibubi.create.modules.kinetics.generators.MotorTileEntity; +import com.simibubi.create.modules.kinetics.generators.MotorTileEntityRenderer; +import com.simibubi.create.modules.kinetics.receivers.TurntableTileEntity; +import com.simibubi.create.modules.kinetics.relays.AxisTileEntity; +import com.simibubi.create.modules.kinetics.relays.AxisTunnelTileEntity; +import com.simibubi.create.modules.kinetics.relays.AxisTunnelTileEntityRenderer; +import com.simibubi.create.modules.kinetics.relays.GearboxTileEntity; +import com.simibubi.create.modules.kinetics.relays.GearboxTileEntityRenderer; +import com.simibubi.create.modules.kinetics.relays.GearshifterTileEntity; +import com.simibubi.create.modules.kinetics.relays.GearshifterTileEntityRenderer; import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity; import com.simibubi.create.modules.schematics.block.SchematicannonRenderer; import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity; +import net.minecraft.block.Block; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; @@ -21,24 +33,39 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(bus = Bus.MOD) public enum AllTileEntities { - Schematicannon(SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON), - SchematicTable(SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE); + // Schematics + SCHEMATICANNON(SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON), + SCHEMATICTABLE(SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE), + // Kinetics + AXIS(AxisTileEntity::new, AllBlocks.AXIS, AllBlocks.GEAR, AllBlocks.LARGE_GEAR, AllBlocks.AXIS_TUNNEL), + MOTOR(MotorTileEntity::new, AllBlocks.MOTOR), + GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX), + TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE), + AXIS_TUNNEL(AxisTunnelTileEntity::new, AllBlocks.AXIS_TUNNEL), + GEARSHIFTER(GearshifterTileEntity::new, AllBlocks.GEARSHIFTER), + + ; + private Supplier supplier; public TileEntityType type; - private AllBlocks block; + private AllBlocks[] blocks; - private AllTileEntities(Supplier supplier, AllBlocks block) { + private AllTileEntities(Supplier supplier, AllBlocks... blocks) { this.supplier = supplier; - this.block = block; + this.blocks = blocks; } @SubscribeEvent public static void onTileEntityRegistry(final RegistryEvent.Register> event) { for (AllTileEntities tileEntity : values()) { + Block[] blocks = new Block[tileEntity.blocks.length]; + for (int i = 0; i < blocks.length; i++) + blocks[i] = tileEntity.blocks[i].block; + ResourceLocation resourceLocation = new ResourceLocation(Create.ID, tileEntity.name().toLowerCase()); - tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, tileEntity.block.get()).build(null) + tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, blocks).build(null) .setRegistryName(resourceLocation); event.getRegistry().register(tileEntity.type); } @@ -47,6 +74,12 @@ public enum AllTileEntities { @OnlyIn(Dist.CLIENT) public static void registerRenderers() { bind(SchematicannonTileEntity.class, new SchematicannonRenderer()); + bind(AxisTileEntity.class, new KineticTileEntityRenderer()); + bind(TurntableTileEntity.class, new KineticTileEntityRenderer()); + bind(MotorTileEntity.class, new MotorTileEntityRenderer()); + bind(AxisTunnelTileEntity.class, new AxisTunnelTileEntityRenderer()); + bind(GearboxTileEntity.class, new GearboxTileEntityRenderer()); + bind(GearshifterTileEntity.class, new GearshifterTileEntityRenderer()); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/modules/kinetics/RotationPropagator.java b/src/main/java/com/simibubi/create/modules/kinetics/RotationPropagator.java new file mode 100644 index 000000000..fff93256f --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/RotationPropagator.java @@ -0,0 +1,347 @@ +package com.simibubi.create.modules.kinetics; + +import java.util.LinkedList; +import java.util.List; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.IRotate; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; +import com.simibubi.create.modules.kinetics.relays.GearboxTileEntity; +import com.simibubi.create.modules.kinetics.relays.GearshifterTileEntity; + +import net.minecraft.block.BlockState; +import net.minecraft.state.IProperty; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class RotationPropagator { + + /** + * Determines the change in rotation between two attached kinetic entities. For + * instance, an axis connection returns 1 while a 1-to-1 gear connection + * reverses the rotation and therefore returns -1. + * + * @param from + * @param to + * @return + */ + private static float getRotationSpeedModifier(KineticTileEntity from, KineticTileEntity to) { + final BlockState stateFrom = from.getBlockState(); + final BlockState stateTo = to.getBlockState(); + final IRotate definitionFrom = (IRotate) stateFrom.getBlock(); + final IRotate definitionTo = (IRotate) stateTo.getBlock(); + final BlockPos diff = to.getPos().subtract(from.getPos()); + final Direction facingFromTo = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); + final World world = from.getWorld(); + IProperty axisProperty = BlockStateProperties.AXIS; + boolean connectedByAxis = definitionFrom.isAxisTowards(world, from.getPos(), stateFrom, facingFromTo) + && definitionTo.isAxisTowards(world, to.getPos(), stateTo, facingFromTo.getOpposite()); + + // Gearbox <-> Gearbox + if (from instanceof GearboxTileEntity && to instanceof GearboxTileEntity) + return 0; + + // Gearbox -> Axis + if (from instanceof GearboxTileEntity) { + if (!connectedByAxis) + return 0; + if (!from.hasSource()) + return 1; + + Direction sourceFacing = from.getSourceFacing(); + if (facingFromTo.getAxis() == sourceFacing.getAxis()) + return facingFromTo == sourceFacing ? 1 : -1; + else + return facingFromTo.getAxisDirection() == sourceFacing.getAxisDirection() ? -1 : 1; + } + + // Axis -> Gearbox + if (to instanceof GearboxTileEntity) { + if (!connectedByAxis) + return 0; + if (!to.hasSource()) + return 1; + + Direction sourceFacing = to.getSourceFacing(); + if (facingFromTo.getAxis() == sourceFacing.getAxis()) + return facingFromTo.getOpposite() == sourceFacing ? 1 : -1; + else + return facingFromTo.getAxisDirection() == sourceFacing.getAxisDirection() ? 1 : -1; + } + + if (from instanceof GearshifterTileEntity) { + if (!connectedByAxis) + return 0; + + // Gearshifter -> Gearshifter + if (to instanceof GearshifterTileEntity) { + int fromReversed = from.hasSource() && from.getSourceFacing() != facingFromTo + && stateFrom.get(BlockStateProperties.POWERED) ? -1 : 1; + int toReversed = to.hasSource() && to.getSourceFacing() != facingFromTo.getOpposite() + && stateTo.get(BlockStateProperties.POWERED) ? -1 : 1; + return fromReversed * toReversed; + } + + // Gearshifter -> Axis + if (!from.hasSource()) + return 1; + + Direction sourceFacing = from.getSourceFacing(); + return sourceFacing == facingFromTo ? 1 : stateFrom.get(BlockStateProperties.POWERED) ? -1 : 1; + } + + // Axis -> Gearshifter + if (to instanceof GearshifterTileEntity) { + if (!connectedByAxis) + return 0; + if (!to.hasSource()) + return 1; + + Direction sourceFacing = to.getSourceFacing(); + return sourceFacing == facingFromTo.getOpposite() ? 1 : stateTo.get(BlockStateProperties.POWERED) ? -1 : 1; + } + + // Axis <-> Axis + if (connectedByAxis) + return 1; + + // Large Gear -> Gear + if (AllBlocks.LARGE_GEAR.typeOf(from.getBlockState()) && AllBlocks.GEAR.typeOf(to.getBlockState())) { + Axis axisFrom = stateFrom.get(axisProperty); + if (axisFrom == stateTo.get(axisProperty)) { + if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) == 0) { + for (Axis axis : Axis.values()) { + if (axis == axisFrom) + continue; + if (Math.abs(axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ())) != 1) + return 0; + } + return -2f; + } + } + } + + // Gear -> Large Gear + if (AllBlocks.GEAR.typeOf(from.getBlockState()) && AllBlocks.LARGE_GEAR.typeOf(to.getBlockState())) { + Axis axisFrom = stateFrom.get(axisProperty); + if (axisFrom == stateTo.get(axisProperty)) { + if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) == 0) { + for (Axis axis : Axis.values()) { + if (axis == axisFrom) + continue; + if (Math.abs(axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ())) != 1) + return 0; + } + return -.5f; + } + } + } + + // Gear <-> Gear + if (definitionFrom.isGearTowards(world, from.getPos(), stateFrom, facingFromTo) + && definitionTo.isGearTowards(world, to.getPos(), stateTo, facingFromTo.getOpposite())) { + if (diff.manhattanDistance(BlockPos.ZERO) != 1) + return 0; + if (AllBlocks.LARGE_GEAR.typeOf(to.getBlockState())) + return 0; + if (stateFrom.get(axisProperty) == stateTo.get(axisProperty)) + return -1; + } + + return 0; + } + + /** + * Insert the added position to the kinetic network. + * + * @param worldIn + * @param pos + */ + public static void handleAdded(World worldIn, BlockPos pos, KineticTileEntity addedTE) { + if (worldIn.isRemote) + return; + if (!worldIn.isAreaLoaded(pos, 1)) + return; + + if (addedTE.getSpeed() != 0) { + propagateNewSource(addedTE); + return; + } + + for (KineticTileEntity neighbourTE : getConnectedNeighbours(addedTE)) { + final float speedModifier = getRotationSpeedModifier(neighbourTE, addedTE); + + if (neighbourTE.getSpeed() == 0) + continue; + if (neighbourTE.hasSource() && neighbourTE.getSource().equals(addedTE.getPos())) { + addedTE.setSpeed(neighbourTE.getSpeed() * speedModifier); + addedTE.notifyBlockUpdate(); + continue; + } + + addedTE.setSpeed(neighbourTE.getSpeed() * speedModifier); + addedTE.setSource(neighbourTE.getPos()); + addedTE.notifyBlockUpdate(); + propagateNewSource(addedTE); + return; + } + } + + /** + * Search for sourceless networks attached to the given entity and update them. + * + * @param updateTE + */ + private static void propagateNewSource(KineticTileEntity updateTE) { + BlockPos pos = updateTE.getPos(); + World world = updateTE.getWorld(); + + for (KineticTileEntity neighbourTE : getConnectedNeighbours(updateTE)) { + final float newSpeed = updateTE.getSpeed() * getRotationSpeedModifier(updateTE, neighbourTE); + + if ((neighbourTE.isSource()) + || neighbourTE.hasSource() && !neighbourTE.getSource().equals(updateTE.getPos())) { + if (neighbourTE.getSpeed() != newSpeed) { + world.destroyBlock(pos, true); + return; + } + continue; + } + + if (neighbourTE.getSpeed() == newSpeed) + continue; + + neighbourTE.setSpeed(newSpeed); + neighbourTE.setSource(updateTE.getPos()); + neighbourTE.notifyBlockUpdate(); + propagateNewSource(neighbourTE); + + } + } + + /** + * Remove the given entity from the network. + * + * @param worldIn + * @param pos + * @param removedTE + */ + public static void handleRemoved(World worldIn, BlockPos pos, KineticTileEntity removedTE) { + if (worldIn.isRemote) + return; + if (removedTE.getSpeed() == 0) + return; + + for (BlockPos neighbourPos : getPotentialNeighbourLocations(removedTE)) { + BlockState neighbourState = worldIn.getBlockState(neighbourPos); + if (!(neighbourState.getBlock() instanceof IRotate)) + continue; + + final KineticTileEntity neighbourTE = (KineticTileEntity) worldIn.getTileEntity(neighbourPos); + if (!neighbourTE.hasSource() || !neighbourTE.getSource().equals(pos) || neighbourTE.isSource()) + continue; + + propagateMissingSource(neighbourTE); + } + + } + + /** + * Clear the entire subnetwork depending on the given entity and find a new + * source + * + * @param updateTE + */ + private static void propagateMissingSource(KineticTileEntity updateTE) { + final World world = updateTE.getWorld(); + + List potentialNewSources = new LinkedList<>(); + List frontier = new LinkedList<>(); + frontier.add(updateTE.getPos()); + + while (!frontier.isEmpty()) { + final BlockPos pos = frontier.remove(0); + final KineticTileEntity currentTE = (KineticTileEntity) world.getTileEntity(pos); + + currentTE.removeSource(); + currentTE.notifyBlockUpdate(); + + for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) { + if (neighbourTE.isSource()) { + potentialNewSources.add(neighbourTE); + continue; + } + + if (!neighbourTE.hasSource()) + continue; + + if (!neighbourTE.getSource().equals(pos)) { + potentialNewSources.add(neighbourTE); + continue; + } + + frontier.add(neighbourTE.getPos()); + } + } + + for (KineticTileEntity newSource : potentialNewSources) { + if (newSource.hasSource() || newSource.isSource()) { + propagateNewSource(newSource); + return; + } + } + } + + private static KineticTileEntity findConnectedNeighbour(KineticTileEntity te, BlockPos neighbourPos) { + BlockState neighbourState = te.getWorld().getBlockState(neighbourPos); + if (!(neighbourState.getBlock() instanceof IRotate)) + return null; + + KineticTileEntity neighbour = (KineticTileEntity) te.getWorld().getTileEntity(neighbourPos); + if (getRotationSpeedModifier(te, neighbour) == 0) + return null; + return neighbour; + } + + private static List getConnectedNeighbours(KineticTileEntity te) { + List neighbours = new LinkedList<>(); + for (BlockPos neighbourPos : getPotentialNeighbourLocations(te)) { + final KineticTileEntity neighbourTE = findConnectedNeighbour(te, neighbourPos); + if (neighbourTE == null) + continue; + + neighbours.add(neighbourTE); + } + return neighbours; + } + + private static List getPotentialNeighbourLocations(KineticTileEntity te) { + List neighbours = new LinkedList<>(); + + if (!te.getWorld().isAreaLoaded(te.getPos(), 1)) + return neighbours; + + for (Direction facing : Direction.values()) { + neighbours.add(te.getPos().offset(facing)); + } + + // gears can interface diagonally + BlockState blockState = te.getBlockState(); + if (AllBlocks.GEAR.typeOf(blockState) || AllBlocks.LARGE_GEAR.typeOf(blockState)) { + Axis axis = blockState.get(BlockStateProperties.AXIS); + BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)).forEach(offset -> { + if (axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0) + return; + if (offset.distanceSq(0, 0, 0, false) != BlockPos.ZERO.distanceSq(1, 1, 0, false)) + return; + neighbours.add(te.getPos().add(offset)); + }); + } + + return neighbours; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/HalfAxisBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/base/HalfAxisBlock.java new file mode 100644 index 000000000..334cd63a3 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/HalfAxisBlock.java @@ -0,0 +1,23 @@ +package com.simibubi.create.modules.kinetics.base; + +import com.simibubi.create.foundation.block.IRenderUtilityBlock; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.DirectionalBlock; +import net.minecraft.block.material.Material; +import net.minecraft.state.StateContainer.Builder; + +public class HalfAxisBlock extends DirectionalBlock implements IRenderUtilityBlock { + + public HalfAxisBlock() { + super(Properties.create(Material.ROCK)); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(FACING); + super.fillStateContainer(builder); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/HorizontalKineticBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/base/HorizontalKineticBlock.java new file mode 100644 index 000000000..970565a9a --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/HorizontalKineticBlock.java @@ -0,0 +1,42 @@ +package com.simibubi.create.modules.kinetics.base; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.IProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; + +public abstract class HorizontalKineticBlock extends KineticBlock { + + public static final IProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + + public HorizontalKineticBlock(Properties properties) { + super(properties); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(HORIZONTAL_FACING); + super.fillStateContainer(builder); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); + } + + @Override + public BlockState rotate(BlockState state, Rotation rot) { + return state.with(HORIZONTAL_FACING, rot.rotate(state.get(HORIZONTAL_FACING))); + } + + @Override + public BlockState mirror(BlockState state, Mirror mirrorIn) { + return state.rotate(mirrorIn.toRotation(state.get(HORIZONTAL_FACING))); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/IRotate.java b/src/main/java/com/simibubi/create/modules/kinetics/base/IRotate.java new file mode 100644 index 000000000..75a04d0e8 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/IRotate.java @@ -0,0 +1,16 @@ +package com.simibubi.create.modules.kinetics.base; + +import net.minecraft.block.BlockState; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface IRotate { + + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face); + public boolean isGearTowards(World world, BlockPos pos, BlockState state, Direction face); + + public Axis getRotationAxis(BlockState state); + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/KineticBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticBlock.java new file mode 100644 index 000000000..e5bd1afb5 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticBlock.java @@ -0,0 +1,77 @@ +package com.simibubi.create.modules.kinetics.base; + +import com.simibubi.create.modules.kinetics.RotationPropagator; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.material.PushReaction; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.World; + +public abstract class KineticBlock extends Block implements IRotate { + + public KineticBlock(Properties properties) { + super(properties); + } + + // IRotate + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return false; + } + + @Override + public boolean isGearTowards(World world, BlockPos pos, BlockState state, Direction face) { + return false; + } + + @Override + public Axis getRotationAxis(BlockState state) { + return null; + } + + // Block + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Override + public PushReaction getPushReaction(BlockState state) { + return PushReaction.BLOCK; + } + + @Override + public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); + + @Override + public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { +// RotationPropagator.handleAdded(worldIn, pos); + } + + @Override + public void updateNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags) { + RotationPropagator.handleAdded(worldIn.getWorld(), pos, (KineticTileEntity) worldIn.getTileEntity(pos)); + } + + @Override + public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) { + return hasStaticPart() && layer == BlockRenderLayer.SOLID; + } + + protected abstract boolean hasStaticPart(); + + @Override + public boolean isSolid(BlockState state) { + return false; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntity.java new file mode 100644 index 000000000..41eff530c --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntity.java @@ -0,0 +1,133 @@ +package com.simibubi.create.modules.kinetics.base; + +import java.util.Optional; +import java.util.Random; + +import com.simibubi.create.foundation.block.SyncedTileEntity; +import com.simibubi.create.modules.kinetics.RotationPropagator; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.particles.RedstoneParticleData; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; + +public abstract class KineticTileEntity extends SyncedTileEntity { + + protected float speed; + protected float force; + protected Optional source; + + public KineticTileEntity(TileEntityType typeIn) { + super(typeIn); + setSpeed(0); + setForce(0); + source = Optional.empty(); + } + + @Override + public void onLoad() { + if (!hasWorld()) + return; + super.onLoad(); + } + + @Override + public void remove() { + if (world.isRemote) { + super.remove(); + return; + } + RotationPropagator.handleRemoved(getWorld(), getPos(), this); + super.remove(); + } + + public void notifyBlockUpdate() { + this.world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 2 | 16); + } + + @Override + public CompoundNBT write(CompoundNBT compound) { + compound.putFloat("Speed", getSpeed()); + compound.putFloat("Force", getForce()); + + if (hasSource()) + compound.put("Source", NBTUtil.writeBlockPos(getSource())); + + return super.write(compound); + } + + @Override + public void read(CompoundNBT compound) { + setSpeed(compound.getFloat("Speed")); + setForce(compound.getFloat("Force")); + + setSource(null); + if (compound.contains("Source")) { + CompoundNBT tagSource = compound.getCompound("Source"); + setSource(NBTUtil.readBlockPos(tagSource)); + } + + super.read(compound); + } + + public boolean isSource() { + return false; + } + + public float getSpeed() { + return speed; + } + + public void setSpeed(float speed) { + +// if (hasWorld()) +// Minecraft.getInstance().player.sendStatusMessage( +// new StringTextComponent((getWorld().isRemote ? TextFormatting.RED : TextFormatting.GREEN) +// + "" + getClass().getSimpleName() + getPos().toString() + " to " + speed), +// false); + + this.speed = speed; + if (hasWorld() && speed != 0) { + Random r = getWorld().rand; + for (int i = 0; i < 10; i++) { + float x = getPos().getX() + (r.nextFloat() - .5f) / 2f + .5f; + float y = getPos().getY() + (r.nextFloat() - .5f) / 2f + .5f; + float z = getPos().getZ() + (r.nextFloat() - .5f) / 2f + .5f; + this.getWorld().addParticle(new RedstoneParticleData(1, 1, 1, 1), x, y, z, 0, 0, 0); + } + } + } + + public float getForce() { + return force; + } + + public void setForce(float force) { + this.force = force; + } + + public boolean hasSource() { + return source.isPresent(); + } + + public BlockPos getSource() { + return source.get(); + } + + public Direction getSourceFacing() { + BlockPos source = getSource().subtract(getPos()); + return Direction.getFacingFromVector(source.getX(), source.getY(), source.getZ()); + } + + public void setSource(BlockPos source) { + this.source = Optional.ofNullable(source); + } + + public void removeSource() { + this.source = Optional.empty(); + setSpeed(0); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntityRenderer.java new file mode 100644 index 000000000..2511da036 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/KineticTileEntityRenderer.java @@ -0,0 +1,146 @@ +package com.simibubi.create.modules.kinetics.base; + +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import org.lwjgl.opengl.GL11; + +import com.simibubi.create.AllBlocks; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.model.animation.Animation; +import net.minecraftforge.client.model.animation.TileEntityRendererFast; +import net.minecraftforge.client.model.data.EmptyModelData; + +public class KineticTileEntityRenderer extends TileEntityRendererFast { + + protected static Map cachedBuffers; + + protected class CachedByteBuffer { + ByteBuffer original; + ByteBuffer mutable; + + public CachedByteBuffer(ByteBuffer original) { + original.rewind(); + this.original = original; + + this.mutable = GLAllocation.createDirectByteBuffer(original.capacity()); + this.mutable.order(original.order()); + this.mutable.limit(original.limit()); + mutable.put(this.original); + mutable.rewind(); + } + + public ByteBuffer getTransformed(Vec3d translation, float angle, Axis axis, int packedLightCoords) { + original.rewind(); + mutable.rewind(); + final float cos = MathHelper.cos(angle); + final float sin = MathHelper.sin(angle); + final int formatLength = DefaultVertexFormats.BLOCK.getSize(); + + for (int i = 0; i < original.limit() / formatLength; i++) { + final int position = i * formatLength; + final float x = original.getFloat(position) - .5f; + final float y = original.getFloat(position + 4) - .5f; + final float z = original.getFloat(position + 8) - .5f; + + float xr = x; + float yr = y; + float zr = z; + + if (axis == Axis.X) { + yr = y * cos - z * sin; + zr = z * cos + y * sin; + } + + if (axis == Axis.Y) { + xr = x * cos + z * sin; + zr = z * cos - x * sin; + } + + if (axis == Axis.Z) { + yr = y * cos + x * sin; + xr = x * cos - y * sin; + } + + mutable.putFloat(position, (float) (xr + translation.x + .5f)); + mutable.putFloat(position + 4, (float) (yr + translation.y + .5f)); + mutable.putFloat(position + 8, (float) (zr + translation.z + .5f)); + mutable.putInt(position + 24, packedLightCoords); + } + return mutable; + } + } + + public KineticTileEntityRenderer() { + cachedBuffers = new HashMap<>(); + } + + @Override + public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + int destroyStage, BufferBuilder buffer) { + + final BlockState state = getRenderedBlockState(te); + cacheIfMissing(state); + + final Vec3d translation = new Vec3d(x, y, z); + final BlockPos pos = te.getPos(); + final Axis axis = ((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()); + float time = Animation.getWorldTime(Minecraft.getInstance().world, partialTicks); + float offset = getRotationOffsetForPosition(te, pos, axis); + float angle = (float) (((time * te.getSpeed() + offset) % 360) / 180 * (float) Math.PI); + + renderFromCache(buffer, state, translation, pos, axis, angle); + } + + protected void renderFromCache(BufferBuilder buffer, final BlockState state, final Vec3d translation, + final BlockPos pos, final Axis axis, float angle) { + int packedLightmapCoords = state.getPackedLightmapCoords(getWorld(), pos); + buffer.putBulkData(cachedBuffers.get(state).getTransformed(translation, angle, axis, packedLightmapCoords)); + } + + protected void cacheIfMissing(final BlockState state) { + if (!cachedBuffers.containsKey(state)) { + BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); + BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer(); + IBakedModel originalModel = dispatcher.getModelForState(state); + BufferBuilder builder = new BufferBuilder(0); + Random random = new Random(); + + builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + blockRenderer.renderModelFlat(getWorld(), originalModel, state, BlockPos.ZERO, builder, true, random, 42, + EmptyModelData.INSTANCE); + builder.finishDrawing(); + + cachedBuffers.put(state, new CachedByteBuffer(builder.getByteBuffer())); + } + } + + protected float getRotationOffsetForPosition(KineticTileEntity te, final BlockPos pos, final Axis axis) { + float offset = AllBlocks.LARGE_GEAR.typeOf(te.getBlockState()) ? 11.25f : 0; + double d = (((axis == Axis.X) ? 0 : pos.getX()) + ((axis == Axis.Y) ? 0 : pos.getY()) + + ((axis == Axis.Z) ? 0 : pos.getZ())) % 2; + if (d == 0) { + offset = 22.5f; + } + return offset; + } + + protected BlockState getRenderedBlockState(KineticTileEntity te) { + return te.getBlockState(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/base/RotatedPillarKineticBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/base/RotatedPillarKineticBlock.java new file mode 100644 index 000000000..fb37e46bf --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/base/RotatedPillarKineticBlock.java @@ -0,0 +1,49 @@ +package com.simibubi.create.modules.kinetics.base; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.Rotation; + +public abstract class RotatedPillarKineticBlock extends KineticBlock { + + public static final EnumProperty AXIS = BlockStateProperties.AXIS; + + public RotatedPillarKineticBlock(Properties properties) { + super(properties); + this.setDefaultState(this.getDefaultState().with(AXIS, Direction.Axis.Y)); + } + + @Override + public BlockState rotate(BlockState state, Rotation rot) { + switch (rot) { + case COUNTERCLOCKWISE_90: + case CLOCKWISE_90: + switch ((Direction.Axis) state.get(AXIS)) { + case X: + return state.with(AXIS, Direction.Axis.Z); + case Z: + return state.with(AXIS, Direction.Axis.X); + default: + return state; + } + default: + return state; + } + } + + @Override + protected void fillStateContainer(StateContainer.Builder builder) { + builder.add(AXIS); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + return this.getDefaultState().with(AXIS, context.getFace().getAxis()); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorBlock.java new file mode 100644 index 000000000..2919e8c26 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorBlock.java @@ -0,0 +1,51 @@ +package com.simibubi.create.modules.kinetics.generators; + +import com.simibubi.create.modules.kinetics.base.HorizontalKineticBlock; + +import net.minecraft.block.BlockState; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class MotorBlock extends HorizontalKineticBlock { + + protected static final VoxelShape MOTOR_X = makeCuboidShape(0, 3, 3, 16, 13, 13); + protected static final VoxelShape MOTOR_Z = makeCuboidShape(3, 3, 0, 13, 13, 16); + + public MotorBlock() { + super(Properties.create(Material.IRON)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return state.get(HORIZONTAL_FACING).getAxis() == Axis.X ? MOTOR_X : MOTOR_Z; + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new MotorTileEntity(); + } + + // IRotate: + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return face == state.get(HORIZONTAL_FACING); + } + + @Override + public Axis getRotationAxis(BlockState state) { + return state.get(HORIZONTAL_FACING).getAxis(); + } + + @Override + protected boolean hasStaticPart() { + return true; + } +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntity.java new file mode 100644 index 000000000..2547daa98 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntity.java @@ -0,0 +1,24 @@ +package com.simibubi.create.modules.kinetics.generators; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class MotorTileEntity extends KineticTileEntity { + + public MotorTileEntity() { + super(AllTileEntities.MOTOR.type); + setSpeed(50); + setForce(10); + } + + @Override + public boolean hasFastRenderer() { + return true; + } + + @Override + public boolean isSource() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntityRenderer.java new file mode 100644 index 000000000..74e0436ad --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/generators/MotorTileEntityRenderer.java @@ -0,0 +1,18 @@ +package com.simibubi.create.modules.kinetics.generators; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; +import com.simibubi.create.modules.kinetics.base.KineticTileEntityRenderer; + +import net.minecraft.block.BlockState; +import net.minecraft.state.properties.BlockStateProperties; + +public class MotorTileEntityRenderer extends KineticTileEntityRenderer { + + @Override + protected BlockState getRenderedBlockState(KineticTileEntity te) { + return AllBlocks.HALF_AXIS.get().getDefaultState().with(BlockStateProperties.FACING, + te.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableBlock.java new file mode 100644 index 000000000..7276fb568 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableBlock.java @@ -0,0 +1,93 @@ +package com.simibubi.create.modules.kinetics.receivers; + +import com.simibubi.create.modules.kinetics.base.KineticBlock; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +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.World; + +public class TurntableBlock extends KineticBlock { + + protected static final VoxelShape SHAPE = VoxelShapes.or( + Block.makeCuboidShape(1.0D, 6.0D, 1.0D, 15.0D, 8.0D, 15.0D), + Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D)); + + public TurntableBlock() { + super(Properties.create(Material.ROCK)); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new TurntableTileEntity(); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return SHAPE; + } + + @Override + public void onLanded(IBlockReader worldIn, Entity e) { + TileEntity te = worldIn.getTileEntity(e.getPosition()); + if (!(te instanceof KineticTileEntity)) + return; + + float speed = ((KineticTileEntity) te).getSpeed() / 20; + World world = e.getEntityWorld(); + + if (speed == 0) { + super.onLanded(worldIn, e); + return; + } + if (world.isRemote) { + super.onLanded(worldIn, e); + return; + } + if ((e instanceof PlayerEntity)) { + super.onLanded(worldIn, e); + return; + } + if ((e instanceof LivingEntity)) { + float offset = e.getRotationYawHead() - speed; + e.setRenderYawOffset(offset); + e.setRotationYawHead(offset); + super.onLanded(worldIn, e); + return; + } + + e.rotationYaw -= speed; + + super.onLanded(worldIn, e); + } + + // IRotate: + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return face == Direction.DOWN; + } + + @Override + public Axis getRotationAxis(BlockState state) { + return Axis.Y; + } + + @Override + protected boolean hasStaticPart() { + return false; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableHandler.java b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableHandler.java new file mode 100644 index 000000000..fc14175d1 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableHandler.java @@ -0,0 +1,37 @@ +package com.simibubi.create.modules.kinetics.receivers; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +import net.minecraft.client.Minecraft; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.event.TickEvent.RenderTickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; + +@EventBusSubscriber(value = Dist.CLIENT) +public class TurntableHandler { + + @SubscribeEvent + public static void onRenderTick(RenderTickEvent event) { + Minecraft mc = Minecraft.getInstance(); + + if (mc.world == null || mc.player == null) + return; + + if (!AllBlocks.TURNTABLE.typeOf(mc.world.getBlockState(mc.player.getPosition()))) + return; + + if (!mc.player.onGround) + return; + + if (mc.isGamePaused()) + return; + + KineticTileEntity te = (KineticTileEntity) mc.world.getTileEntity(mc.player.getPosition()); + float speed = te.getSpeed() / 19; + mc.player.rotationYaw = mc.player.prevRotationYaw - speed * mc.getRenderPartialTicks(); + mc.player.renderYawOffset = mc.player.rotationYaw; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableTileEntity.java new file mode 100644 index 000000000..3b5d737d5 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/receivers/TurntableTileEntity.java @@ -0,0 +1,12 @@ +package com.simibubi.create.modules.kinetics.receivers; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class TurntableTileEntity extends KineticTileEntity { + + public TurntableTileEntity() { + super(AllTileEntities.TURNTABLE.type); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisBlock.java new file mode 100644 index 000000000..8612e0e27 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisBlock.java @@ -0,0 +1,64 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.modules.kinetics.base.RotatedPillarKineticBlock; + +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class AxisBlock extends RotatedPillarKineticBlock { + + protected static final VoxelShape AXIS_X = makeCuboidShape(0, 5, 5, 16, 11, 11); + protected static final VoxelShape AXIS_Y = makeCuboidShape(5, 0, 5, 11, 16, 11); + protected static final VoxelShape AXIS_Z = makeCuboidShape(5, 5, 0, 11, 11, 16); + + public AxisBlock(Properties properties) { + super(properties); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new AxisTileEntity(); + } + + @Override + protected boolean hasStaticPart() { + return false; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return state.get(AXIS) == Axis.X ? AXIS_X : state.get(AXIS) == Axis.Z ? AXIS_Z : AXIS_Y; + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockState placedAgainst = context.getWorld() + .getBlockState(context.getPos().offset(context.getFace().getOpposite())); + + if (!(placedAgainst.getBlock() instanceof AxisBlock)) + return super.getStateForPlacement(context); + + return getDefaultState().with(AXIS, placedAgainst.get(AXIS)); + } + + // IRotate: + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return face.getAxis() == state.get(AXIS); + } + + @Override + public Axis getRotationAxis(BlockState state) { + return state.get(AXIS); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTileEntity.java new file mode 100644 index 000000000..a755e091e --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTileEntity.java @@ -0,0 +1,17 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class AxisTileEntity extends KineticTileEntity { + + public AxisTileEntity() { + super(AllTileEntities.AXIS.type); + } + + @Override + public boolean hasFastRenderer() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelBlock.java new file mode 100644 index 000000000..9ad83b4cf --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelBlock.java @@ -0,0 +1,54 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.modules.kinetics.base.RotatedPillarKineticBlock; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.material.PushReaction; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class AxisTunnelBlock extends RotatedPillarKineticBlock { + + public AxisTunnelBlock() { + super(Properties.from(Blocks.ANDESITE)); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new AxisTunnelTileEntity(); + } + + @Override + protected boolean hasStaticPart() { + return true; + } + + @Override + public PushReaction getPushReaction(BlockState state) { + return PushReaction.PUSH_ONLY; + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + if (context.isPlacerSneaking()) + return super.getStateForPlacement(context); + return this.getDefaultState().with(AXIS, context.getNearestLookingDirection().getAxis()); + } + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return face.getAxis() == state.get(AXIS); + } + + @Override + public Axis getRotationAxis(BlockState state) { + return state.get(AXIS); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntity.java new file mode 100644 index 000000000..7b5c0800f --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntity.java @@ -0,0 +1,17 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class AxisTunnelTileEntity extends KineticTileEntity { + + public AxisTunnelTileEntity() { + super(AllTileEntities.AXIS_TUNNEL.type); + } + + @Override + public boolean hasFastRenderer() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntityRenderer.java new file mode 100644 index 000000000..416ce23e4 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/AxisTunnelTileEntityRenderer.java @@ -0,0 +1,18 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; +import com.simibubi.create.modules.kinetics.base.KineticTileEntityRenderer; + +import net.minecraft.block.BlockState; +import net.minecraft.state.properties.BlockStateProperties; + +public class AxisTunnelTileEntityRenderer extends KineticTileEntityRenderer { + + @Override + protected BlockState getRenderedBlockState(KineticTileEntity te) { + return AllBlocks.AXIS.get().getDefaultState().with(BlockStateProperties.AXIS, + te.getBlockState().get(BlockStateProperties.AXIS)); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/CogWheelBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/CogWheelBlock.java new file mode 100644 index 000000000..be3179204 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/CogWheelBlock.java @@ -0,0 +1,68 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllBlocks; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +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 CogWheelBlock extends AxisBlock { + + private boolean isLarge; + + protected static final VoxelShape GEAR_X = makeCuboidShape(6, 2, 2, 10, 14, 14); + protected static final VoxelShape GEAR_Y = makeCuboidShape(2, 6, 2, 14, 10, 14); + protected static final VoxelShape GEAR_Z = makeCuboidShape(2, 2, 6, 14, 14, 10); + + protected static final VoxelShape LARGE_GEAR_X = makeCuboidShape(6, 0, 0, 10, 16, 16); + protected static final VoxelShape LARGE_GEAR_Y = makeCuboidShape(0, 6, 0, 16, 10, 16); + protected static final VoxelShape LARGE_GEAR_Z = makeCuboidShape(0, 0, 6, 16, 16, 10); + + public CogWheelBlock(boolean large) { + super(Properties.from(Blocks.STRIPPED_SPRUCE_LOG)); + isLarge = large; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return VoxelShapes.or(super.getShape(state, worldIn, pos, context), getGearShape(state)); + } + + @Override + public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { + for (Direction facing : Direction.values()) { + if (facing.getAxis() == state.get(AXIS)) + continue; + + BlockState blockState = worldIn.getBlockState(pos.offset(facing)); + if (AllBlocks.LARGE_GEAR.typeOf(blockState) || isLarge && AllBlocks.GEAR.typeOf(blockState)) + return false; + } + return true; + } + + private VoxelShape getGearShape(BlockState state) { + if (state.get(AXIS) == Axis.X) + return isLarge ? LARGE_GEAR_X : GEAR_X; + if (state.get(AXIS) == Axis.Z) + return isLarge ? LARGE_GEAR_Z : GEAR_Z; + + return isLarge ? LARGE_GEAR_Y : GEAR_Y; + } + + // IRotate + + @Override + public boolean isGearTowards(World world, BlockPos pos, BlockState state, Direction face) { + return !isLarge && face.getAxis() != state.get(AXIS); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxBlock.java new file mode 100644 index 000000000..1c067aa3a --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxBlock.java @@ -0,0 +1,42 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.modules.kinetics.base.RotatedPillarKineticBlock; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.material.PushReaction; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class GearboxBlock extends RotatedPillarKineticBlock { + + public GearboxBlock() { + super(Properties.from(Blocks.ANDESITE)); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new GearboxTileEntity(); + } + + @Override + public PushReaction getPushReaction(BlockState state) { + return PushReaction.PUSH_ONLY; + } + + // IRotate: + + @Override + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return face.getAxis() != state.get(AXIS); + } + + @Override + protected boolean hasStaticPart() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntity.java new file mode 100644 index 000000000..043beac35 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntity.java @@ -0,0 +1,12 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class GearboxTileEntity extends KineticTileEntity { + + public GearboxTileEntity() { + super(AllTileEntities.GEARBOX.type); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntityRenderer.java new file mode 100644 index 000000000..5a19bcb26 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearboxTileEntityRenderer.java @@ -0,0 +1,57 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; +import com.simibubi.create.modules.kinetics.base.KineticTileEntityRenderer; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +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.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.model.animation.Animation; + +public class GearboxTileEntityRenderer extends KineticTileEntityRenderer { + + @Override + public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + int destroyStage, BufferBuilder buffer) { + final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS); + final BlockPos pos = te.getPos(); + float time = Animation.getWorldTime(Minecraft.getInstance().world, partialTicks); + final Vec3d translation = new Vec3d(x, y, z); + final BlockState defaultState = AllBlocks.HALF_AXIS.get().getDefaultState(); + + for (Direction direction : Direction.values()) { + final Axis axis = direction.getAxis(); + if (boxAxis == axis) + continue; + if (AllBlocks.GEARBOX.typeOf(getWorld().getBlockState(pos.offset(direction)))) + continue; + + BlockState state = defaultState.with(BlockStateProperties.FACING, direction); + cacheIfMissing(state); + + float offset = getRotationOffsetForPosition(te, pos, axis); + float angle = (time * te.getSpeed()) % 360; + + if (te.getSpeed() != 0) { + BlockPos source = te.getSource().subtract(te.getPos()); + Direction sourceFacing = Direction.getFacingFromVector(source.getX(), source.getY(), source.getZ()); + if (sourceFacing.getAxis() == direction.getAxis()) + angle *= sourceFacing == direction ? 1 : -1; + else if (sourceFacing.getAxisDirection() == direction.getAxisDirection()) + angle *= -1; + } + + angle += offset; + angle = angle / 180f * (float) Math.PI; + + renderFromCache(buffer, state, translation, pos, axis, angle); + } + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterBlock.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterBlock.java new file mode 100644 index 000000000..c87d34302 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterBlock.java @@ -0,0 +1,57 @@ +package com.simibubi.create.modules.kinetics.relays; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class GearshifterBlock extends AxisTunnelBlock { + + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + + public GearshifterBlock() { + super(); + setDefaultState(getDefaultState().with(POWERED, false)); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new GearshifterTileEntity(); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(POWERED); + super.fillStateContainer(builder); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + return super.getStateForPlacement(context).with(POWERED, + Boolean.valueOf(context.getWorld().isBlockPowered(context.getPos()))); + } + + @Override + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, + boolean isMoving) { + if (worldIn.isRemote) + return; + + boolean previouslyPowered = state.get(POWERED); + if (previouslyPowered != worldIn.isBlockPowered(pos)) { + worldIn.setBlockState(pos, state.cycle(POWERED), 2); + } + } + + public boolean isAxisTowards(World world, BlockPos pos, BlockState state, Direction face) { + return super.isAxisTowards(world, pos, state, face); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntity.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntity.java new file mode 100644 index 000000000..e8f248c2e --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntity.java @@ -0,0 +1,12 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; + +public class GearshifterTileEntity extends KineticTileEntity { + + public GearshifterTileEntity() { + super(AllTileEntities.GEARSHIFTER.type); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntityRenderer.java new file mode 100644 index 000000000..64d6f9d45 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/kinetics/relays/GearshifterTileEntityRenderer.java @@ -0,0 +1,51 @@ +package com.simibubi.create.modules.kinetics.relays; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.kinetics.base.KineticTileEntity; +import com.simibubi.create.modules.kinetics.base.KineticTileEntityRenderer; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +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.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.model.animation.Animation; + +public class GearshifterTileEntityRenderer extends KineticTileEntityRenderer { + + @Override + public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + int destroyStage, BufferBuilder buffer) { + final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS); + final BlockPos pos = te.getPos(); + float time = Animation.getWorldTime(Minecraft.getInstance().world, partialTicks); + final Vec3d translation = new Vec3d(x, y, z); + final BlockState defaultState = AllBlocks.HALF_AXIS.get().getDefaultState(); + + for (Direction direction : Direction.values()) { + final Axis axis = direction.getAxis(); + if (boxAxis != axis) + continue; + + BlockState state = defaultState.with(BlockStateProperties.FACING, direction); + cacheIfMissing(state); + + float offset = getRotationOffsetForPosition(te, pos, axis); + float angle = (time * te.getSpeed()) % 360; + + if (te.hasSource()) { + if (direction != te.getSourceFacing() && te.getBlockState().get(BlockStateProperties.POWERED)) + angle = -angle; + } + + angle += offset; + angle = angle / 180f * (float) Math.PI; + + renderFromCache(buffer, state, translation, pos, axis, angle); + } + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java index 47793aebd..968ff81b5 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java @@ -36,7 +36,7 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka } public SchematicTableTileEntity() { - this(AllTileEntities.SchematicTable.type); + this(AllTileEntities.SCHEMATICTABLE.type); } public SchematicTableTileEntity(TileEntityType tileEntityTypeIn) { diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java index a97e6ade9..ac79c29f6 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java @@ -163,7 +163,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka } public SchematicannonTileEntity() { - this(AllTileEntities.Schematicannon.type); + this(AllTileEntities.SCHEMATICANNON.type); } @Override diff --git a/src/main/resources/assets/create/blockstates/axis.json b/src/main/resources/assets/create/blockstates/axis.json new file mode 100644 index 000000000..87251e6ec --- /dev/null +++ b/src/main/resources/assets/create/blockstates/axis.json @@ -0,0 +1,11 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/axis" + }, + "variants": { + "axis=y": { "model": "create:block/axis" }, + "axis=z": { "model": "create:block/axis", "x": 90 }, + "axis=x": { "model": "create:block/axis", "x": 90, "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/axis_tunnel.json b/src/main/resources/assets/create/blockstates/axis_tunnel.json new file mode 100644 index 000000000..539a75279 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/axis_tunnel.json @@ -0,0 +1,11 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/axis_tunnel" + }, + "variants": { + "axis=y": { "model": "create:block/axis_tunnel", "x": 90 }, + "axis=z": { "model": "create:block/axis_tunnel" }, + "axis=x": { "model": "create:block/axis_tunnel", "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/gear.json b/src/main/resources/assets/create/blockstates/gear.json new file mode 100644 index 000000000..46c1bab2c --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gear.json @@ -0,0 +1,11 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/gear" + }, + "variants": { + "axis=y": { "model": "create:block/gear" }, + "axis=z": { "model": "create:block/gear", "x": 90 }, + "axis=x": { "model": "create:block/gear", "x": 90, "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/gearbox.json b/src/main/resources/assets/create/blockstates/gearbox.json new file mode 100644 index 000000000..81109efe4 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gearbox.json @@ -0,0 +1,11 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/gearbox" + }, + "variants": { + "axis=y": { "model": "create:block/gearbox" }, + "axis=z": { "model": "create:block/gearbox", "x": 90 }, + "axis=x": { "model": "create:block/gearbox", "x": 90, "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/gearshifter.json b/src/main/resources/assets/create/blockstates/gearshifter.json new file mode 100644 index 000000000..4f5e00c5f --- /dev/null +++ b/src/main/resources/assets/create/blockstates/gearshifter.json @@ -0,0 +1,15 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/gearshifter_off" + }, + "variants": { + "powered=false,axis=y": { "model": "create:block/gearshifter_off", "x": 90 }, + "powered=false,axis=z": { "model": "create:block/gearshifter_off" }, + "powered=false,axis=x": { "model": "create:block/gearshifter_off", "y": 90 }, + + "powered=true,axis=y": { "model": "create:block/gearshifter_on", "x": 90 }, + "powered=true,axis=z": { "model": "create:block/gearshifter_on" }, + "powered=true,axis=x": { "model": "create:block/gearshifter_on", "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/half_axis.json b/src/main/resources/assets/create/blockstates/half_axis.json new file mode 100644 index 000000000..96a410029 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/half_axis.json @@ -0,0 +1,14 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/axis_half" + }, + "variants": { + "facing=up": { "model": "create:block/axis_half" }, + "facing=down": { "model": "create:block/axis_half", "x": 180 }, + "facing=north": { "model": "create:block/axis_half", "x": 90 }, + "facing=south": { "model": "create:block/axis_half", "x": 90, "y": 180 }, + "facing=east": { "model": "create:block/axis_half", "x": 90, "y": 90 }, + "facing=west": { "model": "create:block/axis_half", "x": 90, "y": 270 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/large_gear.json b/src/main/resources/assets/create/blockstates/large_gear.json new file mode 100644 index 000000000..00fe4a166 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/large_gear.json @@ -0,0 +1,11 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/large_gear" + }, + "variants": { + "axis=y": { "model": "create:block/large_gear" }, + "axis=z": { "model": "create:block/large_gear", "x": 90 }, + "axis=x": { "model": "create:block/large_gear", "x": 90, "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/motor.json b/src/main/resources/assets/create/blockstates/motor.json new file mode 100644 index 000000000..848b34a19 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/motor.json @@ -0,0 +1,12 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/motor" + }, + "variants": { + "facing=north": { "model": "create:block/motor", "y": 180 }, + "facing=south": { "model": "create:block/motor" }, + "facing=east": { "model": "create:block/motor", "y": 270 }, + "facing=west": { "model": "create:block/motor", "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/turntable.json b/src/main/resources/assets/create/blockstates/turntable.json new file mode 100644 index 000000000..334cfe1b8 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/turntable.json @@ -0,0 +1,9 @@ +{ + "forgemarker": 1, + "defaults": { + "model": "create:block/turntable" + }, + "variants": { + "": { "model": "create:block/turntable" } + } +} \ 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 30947af32..1e2f58837 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -8,6 +8,14 @@ "item.create.chorus_chrome_cube": "Chorus Chrome", "item.create.blueprint_and_quill": "Schematic and Quill", "item.create.blueprint": "Schematic", + "block.create.gear": "Cogwheel", + "block.create.large_gear": "Large Cogwheel", + "block.create.turntable": "Turntable", + "block.create.gearbox": "Gearbox", + "block.create.gearshifter": "Gearshifter", + "block.create.axis_tunnel": "Encased Axis", + "block.create.axis": "Axis", + "block.create.motor": "Motor", "block.create.schematicannon": "Schematicannon", "block.create.schematic_table": "Schematic Table", "block.create.creative_crate": "Schematicannon Creatifier", diff --git a/src/main/resources/assets/create/models/block/axis.json b/src/main/resources/assets/create/models/block/axis.json new file mode 100644 index 000000000..aa7cf7b0a --- /dev/null +++ b/src/main/resources/assets/create/models/block/axis.json @@ -0,0 +1,24 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "create:block/axis", + "0": "create:block/axis", + "1": "create:block/axis_top" + }, + "elements": [ + { + "name": "Axis", + "from": [ 6.0, 0.0, 6.0 ], + "to": [ 10.0, 16.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "up": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }, + "down": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/axis_half.json b/src/main/resources/assets/create/models/block/axis_half.json new file mode 100644 index 000000000..a5b53f30c --- /dev/null +++ b/src/main/resources/assets/create/models/block/axis_half.json @@ -0,0 +1,24 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "create:block/axis", + "0": "create:block/axis", + "1": "create:block/axis_top" + }, + "elements": [ + { + "name": "Axis", + "from": [ 6.0, 8.0, 6.0 ], + "to": [ 10.0, 16.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 8.0 ] }, + "up": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }, + "down": { "texture": "#1", "uv": [ 6.0, 6.0, 10.0, 10.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/axis_tunnel.json b/src/main/resources/assets/create/models/block/axis_tunnel.json new file mode 100644 index 000000000..3296f9ab6 --- /dev/null +++ b/src/main/resources/assets/create/models/block/axis_tunnel.json @@ -0,0 +1,68 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "0": "create:block/gearbox_top", + "1": "create:block/gearbox", + "particle": "create:block/gearbox_top" + }, + "elements": [ + { + "name": "Bottom", + "from": [ 0.0, 0.0, 0.0 ], + "to": [ 16.0, 2.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "Core", + "from": [ 1.0, 2.0, 1.0 ], + "to": [ 15.0, 14.0, 15.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] } + } + }, + { + "name": "Top", + "from": [ 0.0, 14.0, 0.0 ], + "to": [ 16.0, 16.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "SideWest", + "from": [ 0.0, 2.0, 0.0 ], + "to": [ 2.0, 14.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } + } + }, + { + "name": "SideEast", + "from": [ 14.0, 2.0, 0.0 ], + "to": [ 16.0, 14.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, + "south": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gear.json b/src/main/resources/assets/create/models/block/gear.json new file mode 100644 index 000000000..eabd28325 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gear.json @@ -0,0 +1,106 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "block/stripped_spruce_log", + "0": "create:block/axis", + "1": "block/stripped_spruce_log", + "2": "block/stripped_spruce_log_top", + "3": "create:block/axis_top" + }, + "elements": [ + { + "name": "Axis", + "from": [ 6.0, 0.0, 6.0 ], + "to": [ 10.0, 16.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "up": { "texture": "#3", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }, + "down": { "texture": "#3", "uv": [ 6.0, 6.0, 10.0, 10.0 ] } + } + }, + { + "name": "Gear", + "from": [ -1.0, 6.5, 6.5 ], + "to": [ 17.0, 9.5, 9.5 ], + "faces": { + "north": { "texture": "#1", "uv": [ 6.0, 0.0, 9.0, 16.0 ], "rotation": 90 }, + "east": { "texture": "#1", "uv": [ 1.0, 3.0, 4.0, 6.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 5.0, 10.0, 8.0, 13.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] } + } + }, + { + "name": "Gear2", + "from": [ -1.0, 6.5, 6.5 ], + "to": [ 17.0, 9.5, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] } + } + }, + { + "name": "Gear3", + "from": [ -1.0, 6.5, 6.5 ], + "to": [ 17.0, 9.5, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -45.0 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] } + } + }, + { + "name": "Gear4", + "from": [ 6.5, 6.5, -1.0 ], + "to": [ 9.5, 9.5, 17.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 16.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 16.0 ] } + } + }, + { + "name": "GearCaseInner", + "from": [ 2.0, 7.0, 2.0 ], + "to": [ 14.0, 9.0, 14.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "up": { "texture": "#2", "uv": [ 2.0, 2.0, 14.0, 14.0 ] }, + "down": { "texture": "#2", "uv": [ 2.0, 2.0, 14.0, 14.0 ] } + } + }, + { + "name": "GearCaseOuter", + "from": [ 4.0, 6.0, 4.0 ], + "to": [ 12.0, 10.0, 12.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "up": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] }, + "down": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gearbox.json b/src/main/resources/assets/create/models/block/gearbox.json new file mode 100644 index 000000000..d84cf1ca3 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gearbox.json @@ -0,0 +1,48 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "0": "create:block/gearbox_top", + "1": "create:block/gearbox", + "particle": "create:block/gearbox_top" + }, + "elements": [ + { + "name": "Bottom", + "from": [ 0.0, 0.0, 0.0 ], + "to": [ 16.0, 2.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "Core", + "from": [ 1.0, 2.0, 1.0 ], + "to": [ 15.0, 14.0, 15.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, + "east": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, + "west": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] } + } + }, + { + "name": "Top", + "from": [ 0.0, 14.0, 0.0 ], + "to": [ 16.0, 16.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gearshifter_off.json b/src/main/resources/assets/create/models/block/gearshifter_off.json new file mode 100644 index 000000000..83471c17e --- /dev/null +++ b/src/main/resources/assets/create/models/block/gearshifter_off.json @@ -0,0 +1,68 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "0": "create:block/gearshifter_off", + "1": "create:block/gearbox", + "particle": "create:block/gearshifter_off" + }, + "elements": [ + { + "name": "Bottom", + "from": [ 0.0, 0.0, 0.0 ], + "to": [ 16.0, 2.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ], "rotation": 270 } + } + }, + { + "name": "Core", + "from": [ 1.0, 2.0, 1.0 ], + "to": [ 15.0, 14.0, 15.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] } + } + }, + { + "name": "Top", + "from": [ 0.0, 14.0, 0.0 ], + "to": [ 16.0, 16.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, + "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ], "rotation": 90 }, + "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "SideWest", + "from": [ 0.0, 2.0, 0.0 ], + "to": [ 2.0, 14.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, + "south": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } + } + }, + { + "name": "SideEast", + "from": [ 14.0, 2.0, 0.0 ], + "to": [ 16.0, 14.0, 16.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, + "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, + "south": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, + "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gearshifter_on.json b/src/main/resources/assets/create/models/block/gearshifter_on.json new file mode 100644 index 000000000..a74b273b6 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gearshifter_on.json @@ -0,0 +1,8 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "create:block/gearshifter_off", + "textures": { + "0": "create:block/gearshifter_on", + "particle": "create:block/gearshifter_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/large_gear.json b/src/main/resources/assets/create/models/block/large_gear.json new file mode 100644 index 000000000..00aee3e14 --- /dev/null +++ b/src/main/resources/assets/create/models/block/large_gear.json @@ -0,0 +1,176 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "block/stripped_spruce_log", + "0": "create:block/axis", + "1": "block/stripped_spruce_log", + "2": "block/stripped_spruce_log_top", + "3": "create:block/axis_top" + }, + "elements": [ + { + "name": "Axis", + "from": [ 6.0, 0.0, 6.0 ], + "to": [ 10.0, 16.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, + "up": { "texture": "#3", "uv": [ 6.0, 6.0, 10.0, 10.0 ] }, + "down": { "texture": "#3", "uv": [ 6.0, 6.0, 10.0, 10.0 ] } + } + }, + { + "name": "Gear2", + "from": [ -7.0, 6.5, 6.5 ], + "to": [ 23.0, 9.5, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 2.0, 16.0, 5.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 5.0, 16.0, 8.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] } + } + }, + { + "name": "Gear3", + "from": [ -7.0, 6.5, 6.5 ], + "to": [ 23.0, 9.5, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -22.5 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 5.0, 16.0, 8.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 3.0, 16.0, 6.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 2.0, 16.0, 5.0 ] } + } + }, + { + "name": "Gear4", + "from": [ 6.5, 6.5, -7.0 ], + "to": [ 9.5, 9.5, 23.0 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 3.0, 16.0, 6.0 ], "rotation": 90 }, + "down": { "texture": "#1", "uv": [ 0.0, 5.0, 16.0, 8.0 ], "rotation": 90 } + } + }, + { + "name": "GearCaseInner", + "from": [ -2.0, 7.0, -2.0 ], + "to": [ 18.0, 9.0, 18.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + }, + { + "name": "GearCaseOuter", + "from": [ 1.0, 5.5, 1.0 ], + "to": [ 15.0, 10.5, 15.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 5.0 ] }, + "east": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 5.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 5.0 ] }, + "west": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 5.0 ] }, + "up": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, + "down": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } + } + }, + { + "name": "Gear", + "from": [ 6.5, 6.5, -7.0 ], + "to": [ 9.5, 9.5, 23.0 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": -22.5 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 8.0, 16.0, 11.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ], "rotation": 90 }, + "down": { "texture": "#1", "uv": [ 0.0, 5.0, 16.0, 8.0 ], "rotation": 90 } + } + }, + { + "name": "Gear5", + "from": [ -7.0, 6.5, 6.5 ], + "to": [ 23.0, 9.5, 9.5 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 4.0, 16.0, 7.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 4.0, 16.0, 7.0 ] } + } + }, + { + "name": "Gear6", + "from": [ 6.5, 6.5, -7.0 ], + "to": [ 9.5, 9.5, 23.0 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ], "rotation": 90 }, + "down": { "texture": "#1", "uv": [ 0.0, 5.0, 16.0, 8.0 ], "rotation": 90 } + } + }, + { + "name": "Gear7", + "from": [ -7.0, 6.5, 6.500000007450581 ], + "to": [ 23.0, 9.5, 9.50000000745058 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 4.0, 16.0, 7.0 ] }, + "down": { "texture": "#1", "uv": [ 0.0, 3.0, 16.0, 6.0 ] } + } + }, + { + "name": "Gear8", + "from": [ 6.5, 6.5, -7.0 ], + "to": [ 9.5, 9.5, 23.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 9.0, 16.0, 12.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 3.0, 3.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 6.0, 16.0, 9.0 ] }, + "up": { "texture": "#1", "uv": [ 0.0, 8.0, 16.0, 11.0 ], "rotation": 90 }, + "down": { "texture": "#1", "uv": [ 0.0, 7.0, 16.0, 10.0 ], "rotation": 90 } + } + }, + { + "name": "GearCaseInnerRotated", + "from": [ -2.0, 6.9, -2.0 ], + "to": [ 18.0, 8.9, 18.0 ], + "rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 }, + "faces": { + "north": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "east": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "south": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "west": { "texture": "#1", "uv": [ 0.0, 0.0, 12.0, 2.0 ] }, + "up": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, + "down": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/motor.json b/src/main/resources/assets/create/models/block/motor.json new file mode 100644 index 000000000..58b5ba9c6 --- /dev/null +++ b/src/main/resources/assets/create/models/block/motor.json @@ -0,0 +1,142 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "block/iron_block", + "0": "block/chiseled_stone_bricks", + "1": "block/stone_bricks", + "2": "block/anvil", + "3": "block/iron_block", + "4": "block/stone" + }, + "elements": [ + { + "name": "Base", + "from": [ 1.0, 0.0, 2.0 ], + "to": [ 15.0, 1.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 0.0, 4.0, 14.0, 5.0 ] }, + "east": { "texture": "#0", "uv": [ 4.0, 12.0, 12.0, 13.0 ] }, + "south": { "texture": "#0", "uv": [ 1.0, 10.0, 15.0, 11.0 ] }, + "west": { "texture": "#0", "uv": [ 3.0, 15.0, 11.0, 16.0 ] }, + "up": { "texture": "#0", "uv": [ 1.0, 3.0, 15.0, 11.0 ] }, + "down": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 8.0 ], "rotation": 180 } + } + }, + { + "name": "BaseTop", + "from": [ 4.0, 1.0, 2.0 ], + "to": [ 12.0, 4.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 4.0, 0.0, 12.0, 3.0 ] }, + "east": { "texture": "#0", "uv": [ 4.0, 0.0, 12.0, 3.0 ] }, + "south": { "texture": "#0", "uv": [ 4.0, 0.0, 12.0, 3.0 ] }, + "west": { "texture": "#0", "uv": [ 4.0, 0.0, 12.0, 3.0 ] } + } + }, + { + "name": "Back", + "from": [ 3.0, 3.0, 0.0 ], + "to": [ 13.0, 13.0, 2.0 ], + "faces": { + "north": { "texture": "#2", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "east": { "texture": "#2", "uv": [ 1.0, 3.0, 3.0, 13.0 ] }, + "south": { "texture": "#2", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "west": { "texture": "#2", "uv": [ 13.0, 3.0, 15.0, 13.0 ] }, + "up": { "texture": "#2", "uv": [ 3.0, 1.0, 13.0, 3.0 ] }, + "down": { "texture": "#2", "uv": [ 3.0, 13.0, 13.0, 15.0 ] } + } + }, + { + "name": "Front Rim", + "from": [ 3.0, 3.0, 13.0 ], + "to": [ 13.0, 13.0, 14.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "east": { "texture": "#0", "uv": [ 12.0, 3.0, 13.0, 13.0 ] }, + "south": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "west": { "texture": "#0", "uv": [ 3.0, 3.0, 4.0, 13.0 ] }, + "up": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 4.0 ] }, + "down": { "texture": "#0", "uv": [ 3.0, 12.0, 13.0, 13.0 ] } + } + }, + { + "name": "Back Rim", + "from": [ 3.0, 3.0, 10.0 ], + "to": [ 13.0, 13.0, 11.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "east": { "texture": "#0", "uv": [ 12.0, 3.0, 13.0, 13.0 ] }, + "south": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 13.0 ] }, + "west": { "texture": "#0", "uv": [ 3.0, 3.0, 4.0, 13.0 ] }, + "up": { "texture": "#0", "uv": [ 3.0, 3.0, 13.0, 4.0 ] }, + "down": { "texture": "#0", "uv": [ 3.0, 12.0, 13.0, 13.0 ] } + } + }, + { + "name": "Between Rims", + "from": [ 5.0, 5.0, 11.0 ], + "to": [ 11.0, 11.0, 13.0 ], + "faces": { + "east": { "texture": "#2", "uv": [ 0.0, 4.0, 2.0, 10.0 ] }, + "west": { "texture": "#2", "uv": [ 14.0, 4.0, 16.0, 10.0 ] }, + "up": { "texture": "#2", "uv": [ 4.0, 0.0, 10.0, 2.0 ] }, + "down": { "texture": "#2", "uv": [ 4.0, 14.0, 10.0, 16.0 ] } + } + }, + { + "name": "Body", + "from": [ 4.0, 4.0, 2.0 ], + "to": [ 12.0, 12.0, 10.0 ], + "faces": { + "east": { "texture": "#3", "uv": [ 0.0, 4.0, 8.0, 12.0 ] }, + "west": { "texture": "#3", "uv": [ 0.0, 4.0, 8.0, 12.0 ], "rotation": 180 }, + "up": { "texture": "#3", "uv": [ 0.0, 4.0, 8.0, 12.0 ], "rotation": 270 } + } + }, + { + "name": "Corner Top Left", + "from": [ 3.5, 11.5, 2.0 ], + "to": [ 4.5, 12.5, 13.0 ], + "rotation": { "origin": [ 4.0, 12.0, 8.0 ], "axis": "z", "angle": 45.0 }, + "faces": { + "east": { "texture": "#4", "uv": [ 2.0, 3.0, 13.0, 4.0 ] }, + "west": { "texture": "#4", "uv": [ 2.0, 2.0, 9.0, 1.0 ] }, + "up": { "texture": "#4", "uv": [ 2.0, 8.0, 13.0, 9.0 ], "rotation": 90 } + } + }, + { + "name": "Corner Top Right", + "from": [ 11.5, 11.5, 2.0 ], + "to": [ 12.5, 12.5, 13.0 ], + "rotation": { "origin": [ 12.0, 12.0, 8.0 ], "axis": "z", "angle": 45.0 }, + "faces": { + "east": { "texture": "#4", "uv": [ 2.0, 8.0, 13.0, 9.0 ] }, + "up": { "texture": "#4", "uv": [ 3.0, 3.0, 14.0, 4.0 ], "rotation": 90 }, + "down": { "texture": "#4", "uv": [ 3.0, 6.0, 14.0, 7.0 ], "rotation": 90 } + } + }, + { + "name": "Corner Bottom Right", + "from": [ 11.5, 3.5, 2.0 ], + "to": [ 12.5, 4.5, 13.0 ], + "rotation": { "origin": [ 12.0, 4.0, 8.0 ], "axis": "z", "angle": 45.0 }, + "faces": { + "east": { "texture": "#4", "uv": [ 3.0, 6.0, 14.0, 7.0 ] }, + "west": { "texture": "#4", "uv": [ 3.0, 4.0, 14.0, 5.0 ] }, + "down": { "texture": "#4", "uv": [ 3.0, 5.0, 14.0, 6.0 ], "rotation": 90 } + } + }, + { + "name": "Corner Bottom Left", + "from": [ 3.5, 3.5, 2.0 ], + "to": [ 4.5, 4.5, 13.0 ], + "rotation": { "origin": [ 4.0, 4.0, 8.0 ], "axis": "z", "angle": 45.0 }, + "faces": { + "west": { "texture": "#4", "uv": [ 2.0, 5.0, 13.0, 6.0 ] }, + "up": { "texture": "#4", "uv": [ 2.0, 3.0, 13.0, 4.0 ], "rotation": 90 }, + "down": { "texture": "#4", "uv": [ 2.0, 7.0, 13.0, 8.0 ], "rotation": 90 } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/turntable.json b/src/main/resources/assets/create/models/block/turntable.json new file mode 100644 index 000000000..8f8fc240b --- /dev/null +++ b/src/main/resources/assets/create/models/block/turntable.json @@ -0,0 +1,51 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "parent": "block/cube", + "textures": { + "particle": "block/stripped_spruce_log", + "0": "create:block/axis", + "1": "block/stripped_spruce_log", + "2": "block/stripped_spruce_log_top", + "3": "create:block/axis_top" + }, + "elements": [ + { + "name": "Axis", + "from": [ 6.0, 0.0, 6.0 ], + "to": [ 10.0, 7.0, 10.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 7.0 ] }, + "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 7.0 ] }, + "south": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 7.0 ] }, + "west": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 7.0 ] }, + "down": { "texture": "#3", "uv": [ 6.0, 6.0, 10.0, 10.0 ] } + } + }, + { + "name": "GearCaseInner", + "from": [ 1.0, 6.0, 1.0 ], + "to": [ 15.0, 8.0, 15.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 2.0 ] }, + "east": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 2.0 ] }, + "south": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 2.0 ] }, + "west": { "texture": "#1", "uv": [ 1.0, 0.0, 15.0, 2.0 ] }, + "up": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, + "down": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } + } + }, + { + "name": "GearCaseOuter", + "from": [ 4.0, 5.0, 4.0 ], + "to": [ 12.0, 6.0, 12.0 ], + "faces": { + "north": { "texture": "#1", "uv": [ 4.0, 0.0, 12.0, 1.0 ] }, + "east": { "texture": "#1", "uv": [ 4.0, 0.0, 12.0, 1.0 ] }, + "south": { "texture": "#1", "uv": [ 4.0, 0.0, 12.0, 1.0 ] }, + "west": { "texture": "#1", "uv": [ 4.0, 0.0, 12.0, 1.0 ] }, + "up": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] }, + "down": { "texture": "#2", "uv": [ 4.0, 4.0, 12.0, 12.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/axis.json b/src/main/resources/assets/create/models/item/axis.json new file mode 100644 index 000000000..00bfafdd8 --- /dev/null +++ b/src/main/resources/assets/create/models/item/axis.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/axis" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/axis_tunnel.json b/src/main/resources/assets/create/models/item/axis_tunnel.json new file mode 100644 index 000000000..a4f421dc7 --- /dev/null +++ b/src/main/resources/assets/create/models/item/axis_tunnel.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/axis_tunnel" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/gear.json b/src/main/resources/assets/create/models/item/gear.json new file mode 100644 index 000000000..0ccb84ad6 --- /dev/null +++ b/src/main/resources/assets/create/models/item/gear.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gear" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/gearbox.json b/src/main/resources/assets/create/models/item/gearbox.json new file mode 100644 index 000000000..c9a04a2b5 --- /dev/null +++ b/src/main/resources/assets/create/models/item/gearbox.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gearbox" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/gearshifter.json b/src/main/resources/assets/create/models/item/gearshifter.json new file mode 100644 index 000000000..25662231e --- /dev/null +++ b/src/main/resources/assets/create/models/item/gearshifter.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gearshifter_off" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/large_gear.json b/src/main/resources/assets/create/models/item/large_gear.json new file mode 100644 index 000000000..777756cab --- /dev/null +++ b/src/main/resources/assets/create/models/item/large_gear.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/large_gear" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/motor.json b/src/main/resources/assets/create/models/item/motor.json new file mode 100644 index 000000000..2d331b158 --- /dev/null +++ b/src/main/resources/assets/create/models/item/motor.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/motor" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/turntable.json b/src/main/resources/assets/create/models/item/turntable.json new file mode 100644 index 000000000..6a20ae7a2 --- /dev/null +++ b/src/main/resources/assets/create/models/item/turntable.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/turntable" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/axis.png b/src/main/resources/assets/create/textures/block/axis.png new file mode 100644 index 0000000000000000000000000000000000000000..dff6ac6982ea44596736f4d6d0d432981f208599 GIT binary patch literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3( zJ+r@loG*ZC$~;{hLoEE4PTI)Jpvc2Kb7q&CDzgE@W~sa0nF9AMT3NlGD6`F4vb^ej zRCeY$&2Q!QUv(B49!u9_RC21$=Wmb{Jj`ZLSINY%1}wuOaF7j%CRo2ez*ew}_kq01 ufvQ%chK-C0(i7GvxN9&PB(i0#LT=By}Z;C1rt3( zJ+r@loG*ZCGCW-zLoEE4o;Tz=pdjFKan8+q%n?zyBCAhw3U8PgZ?U98p+54W`z3t| zVK`iSZPmTqQQ4n<&dHZJ+nud@)^dOMxu0zp_dI!OcN2bZe?^J zG%hhNHvLWs=l}o#C`m*?R5(wCkv~hrP!z=jeu{Q>7K(+&HV&0YAcl}grUxB5xCnxf zL6AblL5m{v19a5QN&JBR+7s?;wCdyVa{rxs?tKYf-&UU=@4A1&;xe9JRso-f#p7&# zCtwTpO)Z1qlR@jwhgnPc%(a>bjlI-sWH&_If}HTE;8TDM=EFf~|vl8pot4;2FLv z(4NLk?dISTw2{2RzXTMXmP^012yFSsNPcPU0D(6dh9N~X=3r!577hkBQbS-eDbR`Z zaTMiw&Ljvz(6hFdwvoh&F9zrl~hvl?gv$Qcxuy(W-m2dteS)yhuX7yG9h UI(Ld}_W%F@07*qoM6N<$f*TsFB>(^b literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/gearbox_top.png b/src/main/resources/assets/create/textures/block/gearbox_top.png new file mode 100644 index 0000000000000000000000000000000000000000..bcc6cefa62863b019eed3a114ec5c80dbfeabb2c GIT binary patch literal 361 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QJXZF{R^94}Nb59q? z5DWj(iF>&YIS91WN@QzGuYLPQhhIl0hsDuDv138R3XLZIgq3rr{%ELs$X)%J2cq*iC$o+;D&JhD_6|Eo2< zmp$X~w_T<)oA-m{0iA^SI4+6J%xlDY?3Nw=!W8zy>bzh`>uI2u89ZJ6T-G@yGywoA C4T97F literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/gearshifter_off.png b/src/main/resources/assets/create/textures/block/gearshifter_off.png new file mode 100644 index 0000000000000000000000000000000000000000..5021d1490f600047b7280dd2020b35574d2d23f2 GIT binary patch literal 410 zcmV;L0cHM)P)N2bZe?^J zG%hhNHvLWs=l}o#7)eAyR5(wKk;_U0K@df!&94YI2NbfBj)P8!2#O%g zBH#mqf(a2JACRT)vJyWqXSku;ZW9m=o$9(%U3DwT=hy7#d#>{@F0bJIW0vsqHXc1b z4+XKP29*Mm*SD1 zk1wDX_voVtjf5HR;p|}R;%EnC~IX11lQ!v)3|M)bKoe=r*54 z<`McgDTqCg(zy;l5^Htv44^rbS6mk$&(QOHeDPEdT%j07*qoM6N<$ Ef~`QLcmMzZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/gearshifter_on.png b/src/main/resources/assets/create/textures/block/gearshifter_on.png new file mode 100644 index 0000000000000000000000000000000000000000..fcb0a9aa4479acb76c50b8c5f20fa381b7f85704 GIT binary patch literal 421 zcmV;W0b2fvP)N2bZe?^J zG%hhNHvLWs=l}o#BS}O-R5(wKk-ZlZBPr{x#`mGqzmyk{3lPmVa7xY!eMe}ZtlE!GxjkzeK#EFPcavRvk>fJ-Cjwin=Rvl=~GCsPKfr9jbJf_`_|bLA4R3Dhbu$DRcN z>VyEbm^XfEpd-;tRbg*sZhtj8Oy`f*VmRL@L7c9~Sb}Q^6%Nc^%%*0aW|Qxc=}(Qt zzM%q3@{|$Mj9BdWI2whfFWT`iOP+U=qLU0di=O+PO_YEh2v5SJ*CbHuLGQ0|7U4)-tA}j>&!cteGJs7Fs6WA~xtaR{NPsi@g7DgM P00000NkvXXu0mjfmD8