From 374f3c9547e6858c5c160a106b74df219e2bae22 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Thu, 4 Feb 2021 21:02:30 +0100 Subject: [PATCH] Climb or Convey - Added Gantry shafts and Gantry pinions - Further attempts at stabilizing kinetic propagation - Contraption types can now be added from external code - Kinetic tile entities now have more control over kinetic propagation rules - Added backend for loading schematic configurations globally for any component to see - Encased chain drives are less likely to create a kinetic source loop when wrenched - Piston and Pulley contraptions are less likely to overshoot targets at high speeds --- src/generated/resources/.cache/cache | 44 ++- .../create/blockstates/gantry_pinion.json | 52 +++ .../create/blockstates/gantry_shaft.json | 212 +++++++++++ .../resources/assets/create/lang/en_ud.json | 3 + .../resources/assets/create/lang/en_us.json | 3 + .../assets/create/lang/unfinished/de_de.json | 5 +- .../assets/create/lang/unfinished/fr_fr.json | 5 +- .../assets/create/lang/unfinished/it_it.json | 5 +- .../assets/create/lang/unfinished/ja_jp.json | 5 +- .../assets/create/lang/unfinished/ko_kr.json | 5 +- .../assets/create/lang/unfinished/nl_nl.json | 5 +- .../assets/create/lang/unfinished/pt_br.json | 5 +- .../assets/create/lang/unfinished/ru_ru.json | 5 +- .../assets/create/lang/unfinished/zh_cn.json | 5 +- .../block/gantry_shaft_end_flipped.json | 6 + .../block/gantry_shaft_end_powered.json | 6 + .../gantry_shaft_end_powered_flipped.json | 6 + .../block/gantry_shaft_middle_flipped.json | 6 + .../block/gantry_shaft_middle_powered.json | 6 + .../gantry_shaft_middle_powered_flipped.json | 6 + .../block/gantry_shaft_single_flipped.json | 6 + .../block/gantry_shaft_single_powered.json | 6 + .../gantry_shaft_single_powered_flipped.json | 6 + .../block/gantry_shaft_start_flipped.json | 6 + .../block/gantry_shaft_start_powered.json | 6 + .../gantry_shaft_start_powered_flipped.json | 6 + .../create/models/item/gantry_pinion.json | 3 + .../create/models/item/gantry_shaft.json | 3 + .../crafting/kinetics/gantry_pinion.json | 32 ++ .../crafting/kinetics/gantry_shaft.json | 32 ++ .../loot_tables/blocks/gantry_pinion.json | 19 + .../loot_tables/blocks/gantry_shaft.json | 19 + .../crafting/kinetics/gantry_pinion.json | 25 ++ .../crafting/kinetics/gantry_shaft.json | 20 + .../com/simibubi/create/AllBlockPartials.java | 2 + .../java/com/simibubi/create/AllBlocks.java | 36 ++ .../com/simibubi/create/AllEntityTypes.java | 25 +- .../com/simibubi/create/AllTileEntities.java | 17 +- src/main/java/com/simibubi/create/Create.java | 2 + .../contraptions/RotationPropagator.java | 46 +-- .../contraptions/base/KineticBlock.java | 32 +- .../contraptions/base/KineticTileEntity.java | 90 ++++- .../motor/CreativeMotorTileEntity.java | 27 +- .../AbstractContraptionEntity.java | 6 +- .../AllContraptionTypes.java | 39 -- .../structureMovement/Contraption.java | 49 ++- .../ContraptionCollider.java | 2 +- .../structureMovement/ContraptionType.java | 49 +++ .../ControlledContraptionEntity.java | 6 - .../OrientedContraptionEntityRenderer.java | 2 +- .../TranslatingContraption.java | 2 +- .../bearing/BearingContraption.java | 6 +- .../bearing/ClockworkContraption.java | 6 +- .../bearing/StabilizedContraption.java | 6 +- .../gantry/GantryContraption.java | 63 ++++ .../gantry/GantryContraptionEntity.java | 203 ++++++++++ .../GantryContraptionEntityRenderer.java | 18 + .../gantry/GantryContraptionUpdatePacket.java | 46 +++ .../gantry/GantryPinionBlock.java | 121 ++++++ .../gantry/GantryPinionRenderer.java | 78 ++++ .../gantry/GantryPinionTileEntity.java | 138 +++++++ .../mounted/MountedContraption.java | 6 +- .../piston/LinearActuatorTileEntity.java | 6 +- .../piston/MechanicalPistonTileEntity.java | 2 +- .../piston/PistonContraption.java | 6 +- .../pulley/PulleyContraption.java | 6 +- .../relays/advanced/GantryShaftBlock.java | 236 ++++++++++++ .../advanced/GantryShaftTileEntity.java | 103 ++++++ .../sequencer/SequencedGearshiftBlock.java | 5 + .../contraptions/relays/belt/BeltBlock.java | 6 + .../relays/belt/BeltTileEntity.java | 19 +- .../elementary/SimpleKineticTileEntity.java | 17 + .../relays/encased/AdjustablePulleyBlock.java | 12 +- .../relays/encased/EncasedBeltBlock.java | 38 +- .../contraptions/wrench/IWrenchable.java | 3 +- .../content/schematics/SchematicWorld.java | 2 +- .../schematics/client/SchematicHandler.java | 2 + .../filtering/SchematicInstances.java | 90 +++++ .../schematics/item/SchematicItem.java | 2 + .../packet/SchematicSyncPacket.java | 2 + .../data/recipe/StandardRecipeGen.java | 17 + .../foundation/networking/AllPackets.java | 2 + .../block/gantry_pinion/horizontal.json | 153 ++++++++ .../models/block/gantry_pinion/item.json | 346 ++++++++++++++++++ .../models/block/gantry_pinion/vertical.json | 153 ++++++++ .../models/block/gantry_pinion/wheels.json | 224 ++++++++++++ .../models/block/gantry_shaft/block_end.json | 69 ++++ .../block/gantry_shaft/block_middle.json | 40 ++ .../block/gantry_shaft/block_single.json | 103 ++++++ .../block/gantry_shaft/block_start.json | 69 ++++ .../assets/create/textures/block/cogwheel.png | Bin 561 -> 373 bytes .../create/textures/block/gantry_shaft.png | Bin 0 -> 234 bytes .../textures/block/gantry_shaft_flipped.png | Bin 0 -> 233 bytes .../textures/block/gantry_shaft_powered.png | Bin 0 -> 227 bytes .../block/gantry_shaft_powered_flipped.png | Bin 0 -> 231 bytes .../assets/create/textures/block/pinion.png | Bin 0 -> 514 bytes 96 files changed, 3258 insertions(+), 182 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/gantry_pinion.json create mode 100644 src/generated/resources/assets/create/blockstates/gantry_shaft.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_end_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_end_powered.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_end_powered_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_middle_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_single_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_single_powered.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_single_powered_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_start_flipped.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_start_powered.json create mode 100644 src/generated/resources/assets/create/models/block/gantry_shaft_start_powered_flipped.json create mode 100644 src/generated/resources/assets/create/models/item/gantry_pinion.json create mode 100644 src/generated/resources/assets/create/models/item/gantry_shaft.json create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_pinion.json create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_shaft.json create mode 100644 src/generated/resources/data/create/loot_tables/blocks/gantry_pinion.json create mode 100644 src/generated/resources/data/create/loot_tables/blocks/gantry_shaft.json create mode 100644 src/generated/resources/data/create/recipes/crafting/kinetics/gantry_pinion.json create mode 100644 src/generated/resources/data/create/recipes/crafting/kinetics/gantry_shaft.json delete mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AllContraptionTypes.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionType.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionTileEntity.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java create mode 100644 src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java create mode 100644 src/main/resources/assets/create/models/block/gantry_pinion/horizontal.json create mode 100644 src/main/resources/assets/create/models/block/gantry_pinion/item.json create mode 100644 src/main/resources/assets/create/models/block/gantry_pinion/vertical.json create mode 100644 src/main/resources/assets/create/models/block/gantry_pinion/wheels.json create mode 100644 src/main/resources/assets/create/models/block/gantry_shaft/block_end.json create mode 100644 src/main/resources/assets/create/models/block/gantry_shaft/block_middle.json create mode 100644 src/main/resources/assets/create/models/block/gantry_shaft/block_single.json create mode 100644 src/main/resources/assets/create/models/block/gantry_shaft/block_start.json create mode 100644 src/main/resources/assets/create/textures/block/gantry_shaft.png create mode 100644 src/main/resources/assets/create/textures/block/gantry_shaft_flipped.png create mode 100644 src/main/resources/assets/create/textures/block/gantry_shaft_powered.png create mode 100644 src/main/resources/assets/create/textures/block/gantry_shaft_powered_flipped.png create mode 100644 src/main/resources/assets/create/textures/block/pinion.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 0dfe925ea..279e708c6 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -157,6 +157,8 @@ afff479c0e5284771afa9e7ce513595fe65860ee assets/create/blockstates/gabbro_cobble a1f31a194129cfb65e335b3b96490f9275f9c564 assets/create/blockstates/gabbro_cobblestone_stairs.json a64d8d0924c0b5b192f355343dd9b3a440875f6a assets/create/blockstates/gabbro_cobblestone_wall.json a6b44e8a1c4ce0c7442b2384b41ad36dd133f19b assets/create/blockstates/gabbro_pillar.json +2d7ffcb339b0a38b98935a382ac2a164866255b1 assets/create/blockstates/gantry_pinion.json +9fa39a44bba30c5ae8fa245b122a837c705462b4 assets/create/blockstates/gantry_shaft.json eca1f0e56efdadb241f42dc6ebb036f1d52213a9 assets/create/blockstates/gearbox.json f34814b17cde3231a1dfb271f3dabf8d6de4fbf6 assets/create/blockstates/gearshift.json 93f8bdc22d9a5e04268964e35e4285c8cbf2b89d assets/create/blockstates/glass_fluid_pipe.json @@ -398,17 +400,17 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 6801fa1f466f172700e573e5b8ee8ee5f9ca4583 assets/create/blockstates/yellow_valve_handle.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json -df67c2c11fa22487d3a0fdc9b008056e593d14e3 assets/create/lang/en_ud.json -3ad443f44eb33fe8c3ac092d1532dcbd27e49c84 assets/create/lang/en_us.json -612a63d73f7f4b8e79dce3f53ddbe3345f0e74d8 assets/create/lang/unfinished/de_de.json -2e37dc718a8dea2af85daba7266c877ce80ff35b assets/create/lang/unfinished/fr_fr.json -f843761728c403276b7a47282f4fdd039b5b6854 assets/create/lang/unfinished/it_it.json -8b90c66fd5974c993e83bfa5733ca03187211d28 assets/create/lang/unfinished/ja_jp.json -59db0a3cff42707ecb828b975ef1fcba2a21a521 assets/create/lang/unfinished/ko_kr.json -b1900a6cce7216a4baa844affa169cfb32ff645c assets/create/lang/unfinished/nl_nl.json -d3f09a37b1f4ec5d53effc2b87efbccf2df2b7c7 assets/create/lang/unfinished/pt_br.json -16c92dab525ba20e85b65ee084f7b760432dcb73 assets/create/lang/unfinished/ru_ru.json -c8b5c2a3a65468950aa713a56bf1c930eef81305 assets/create/lang/unfinished/zh_cn.json +e3f618c5b622d21880de858678d1802cbf65e615 assets/create/lang/en_ud.json +acc852d80378b426d7ee6cb59c169e06b6d63b25 assets/create/lang/en_us.json +1f5803d0479848c114b3c2b55956dabac01accad assets/create/lang/unfinished/de_de.json +c81d5b374365ca8fcce1ff7a199b28e3c969c878 assets/create/lang/unfinished/fr_fr.json +5ba7a1a73fb3d08b3777325266c8ed0360302eba assets/create/lang/unfinished/it_it.json +b7d067002e833c3f9864de2cdb401b30e6569600 assets/create/lang/unfinished/ja_jp.json +23aaf879d07a24775aeba3b98c355c992b24f28b assets/create/lang/unfinished/ko_kr.json +7372533759001f094dbcad787f01f3de7422d8c0 assets/create/lang/unfinished/nl_nl.json +0d1e5d79ef196a06b273962d5ac8f2013f91209c assets/create/lang/unfinished/pt_br.json +6568b0bd677b4b94e98d598852c90dcee07bf4a5 assets/create/lang/unfinished/ru_ru.json +1a3cd22ab046498269f80247cf6d6251f4b3dc36 assets/create/lang/unfinished/zh_cn.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json @@ -751,6 +753,18 @@ f278ec09c13f98ccbce1a8488d4d51c72f398ed4 assets/create/models/block/gabbro_cobbl 5e50c62a9db350f3a2c0e4b1c37a8dc0d149f287 assets/create/models/block/gabbro_cobblestone_wall_post.json 820235f51e7c3b4c05a327c3aa66618ea1e89c9c assets/create/models/block/gabbro_cobblestone_wall_side.json ede9c9209f9cee3d8e1ffc5008b1b8b026aee998 assets/create/models/block/gabbro_pillar.json +f7f55d8107d9128f7be42b2a07fd99aeeba44954 assets/create/models/block/gantry_shaft_end_flipped.json +33196bb0c2f7ca356fc62854349a3ab5fdf2d119 assets/create/models/block/gantry_shaft_end_powered.json +410c0ae1995a079766cab96a3545bb61159feba3 assets/create/models/block/gantry_shaft_end_powered_flipped.json +d66f23d811a09c7e3dad5900f9851282be2f64b7 assets/create/models/block/gantry_shaft_middle_flipped.json +9551abd37c295fe2541f2aee01dd72bfb71b8ae1 assets/create/models/block/gantry_shaft_middle_powered.json +deff4f1163284c22a60d403000c0cd7553d6caff assets/create/models/block/gantry_shaft_middle_powered_flipped.json +16eb7950f81e7242d277f5b0b2710ade820f5645 assets/create/models/block/gantry_shaft_single_flipped.json +78b51bdfa1d26f909e2d3a3ddb70a5631f4fa75f assets/create/models/block/gantry_shaft_single_powered.json +c81b86c2186cbe9867ea041776c8e70059d70f7e assets/create/models/block/gantry_shaft_single_powered_flipped.json +347430ecc316d502cea2e0f90d43ff106e9cb15c assets/create/models/block/gantry_shaft_start_flipped.json +0e1a5a8f38cd6cd3e2f7d2c0d147d924414b0560 assets/create/models/block/gantry_shaft_start_powered.json +4b2f2e9eb3d426b56bb2e0f530b249469200afd0 assets/create/models/block/gantry_shaft_start_powered_flipped.json 392dd57e5b96214335867799347e21ac0d05457a assets/create/models/block/granite_bricks.json 0ee90049ce09f1f1c96063bc7239cd1fadbdb947 assets/create/models/block/granite_bricks_slab.json 37737d6767ba08b6bd96de1ff3b920522dc3cd51 assets/create/models/block/granite_bricks_slab_top.json @@ -1316,6 +1330,8 @@ b10971277417369f421324b28f0a4b47ce4c8625 assets/create/models/item/gabbro_bricks b3d7398dbc16c450928bd76b772c273382687447 assets/create/models/item/gabbro_cobblestone_stairs.json 5680f24b43838cb6632bfcedba282a244bd24db0 assets/create/models/item/gabbro_cobblestone_wall.json 20950b692eecfccd77d96678bb3d909d51f6d787 assets/create/models/item/gabbro_pillar.json +b10f1b188f2bf380628377bd42af2b8f8ffe5611 assets/create/models/item/gantry_pinion.json +b4bfd5041b62f3a0a955fa4872d178b590614f22 assets/create/models/item/gantry_shaft.json 6ab0d17f3d02678ed992e188ff09f6b2c00b5b03 assets/create/models/item/gearbox.json 2fe29893d74c176ea35aed73a169c13dd4ddb2a8 assets/create/models/item/gearshift.json 52108a61865dab38133b9f916496ca680ae364ea assets/create/models/item/golden_sheet.json @@ -1727,6 +1743,8 @@ b42213bffce4e51618e1bba481959208d247c120 data/create/advancements/recipes/create 11d89eca0ccb0f1a8cd27acc9fc0c10d7bf83285 data/create/advancements/recipes/create.base/crafting/kinetics/fluid_pipe.json a2b33e972c7130cbf105f34d88dd7a9a53d5465c data/create/advancements/recipes/create.base/crafting/kinetics/fluid_tank.json a91b11ae44d9b1f479c6dee1f1a4580104059287 data/create/advancements/recipes/create.base/crafting/kinetics/fluid_valve.json +e17c45fc17e1a8e1e618b6eae02fa0aba3247495 data/create/advancements/recipes/create.base/crafting/kinetics/gantry_pinion.json +d1d2fc2f5c4e89393808c65e015917eabb50dffe data/create/advancements/recipes/create.base/crafting/kinetics/gantry_shaft.json dae9e65a089955c0367dc1453e104c3153ebad79 data/create/advancements/recipes/create.base/crafting/kinetics/gearbox.json 8f9819912605cb2499cb3e79ecb0e709b0e38c19 data/create/advancements/recipes/create.base/crafting/kinetics/gearboxfrom_conversion.json 94b8a1f976b9f853cb6e24b0cef72d2e16c3282f data/create/advancements/recipes/create.base/crafting/kinetics/gearshift.json @@ -2435,6 +2453,8 @@ e51893e1601c470da466b35b17251238e15d0361 data/create/loot_tables/blocks/gabbro_b 54879fe6ca3b7271fbb94ec26bef1c3031942d4d data/create/loot_tables/blocks/gabbro_cobblestone_stairs.json ae19749df10663efc51b8b27af310164f250ed38 data/create/loot_tables/blocks/gabbro_cobblestone_wall.json e8d09c919e3b8125d7da0f38383c01bcfc61c7a8 data/create/loot_tables/blocks/gabbro_pillar.json +04e42ba63002ed8ba67780123413f6ff3fb85b02 data/create/loot_tables/blocks/gantry_pinion.json +f2883656e417a78e5e4093002eb1e36ffa1157e9 data/create/loot_tables/blocks/gantry_shaft.json b0109b4a4f0f738cbbe6b5911e8c3c0310b76f99 data/create/loot_tables/blocks/gearbox.json 5f39461c5c9d3ad8d84195b06b9468fe2b0fb269 data/create/loot_tables/blocks/gearshift.json c8aa9bbed8fd703eb1853de0b7c9e04dffb7a511 data/create/loot_tables/blocks/glass_fluid_pipe.json @@ -2782,6 +2802,8 @@ f4ae37f736d06ccda5fbba7831a7a174ec916a05 data/create/recipes/crafting/kinetics/f 86ad4d2820e8e2b01de8d977af7796119dfb7430 data/create/recipes/crafting/kinetics/fluid_tank.json 3dad2a849796df268cd3a06ed37376f2cc529957 data/create/recipes/crafting/kinetics/fluid_valve.json 84153bd478c0e63a04c77579d6595043f604b7ab data/create/recipes/crafting/kinetics/furnace_minecart_from_contraption_cart.json +5299a12e9272089e64073c8e151b70a5bc57b53c data/create/recipes/crafting/kinetics/gantry_pinion.json +21095a156547d4a7d215964be793f1e960b81c09 data/create/recipes/crafting/kinetics/gantry_shaft.json 5eb05cdf88bccdaddfe7ebfbd8b70d1196d422a6 data/create/recipes/crafting/kinetics/gearbox.json b5da8c58f6b8aba525ae8a12ad906db37b78a566 data/create/recipes/crafting/kinetics/gearboxfrom_conversion.json 4d4124b4f1df38d892cb19da19c6464522d3e37d data/create/recipes/crafting/kinetics/gearshift.json diff --git a/src/generated/resources/assets/create/blockstates/gantry_pinion.json b/src/generated/resources/assets/create/blockstates/gantry_pinion.json new file mode 100644 index 000000000..1280e18d4 --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/gantry_pinion.json @@ -0,0 +1,52 @@ +{ + "variants": { + "axis_along_first=false,facing=down": { + "model": "create:block/gantry_pinion/horizontal", + "x": 270, + "y": 90 + }, + "axis_along_first=true,facing=down": { + "model": "create:block/gantry_pinion/horizontal", + "x": 270 + }, + "axis_along_first=false,facing=up": { + "model": "create:block/gantry_pinion/horizontal", + "x": 90, + "y": 90 + }, + "axis_along_first=true,facing=up": { + "model": "create:block/gantry_pinion/horizontal", + "x": 90 + }, + "axis_along_first=false,facing=north": { + "model": "create:block/gantry_pinion/vertical", + "y": 180 + }, + "axis_along_first=true,facing=north": { + "model": "create:block/gantry_pinion/horizontal", + "y": 180 + }, + "axis_along_first=false,facing=south": { + "model": "create:block/gantry_pinion/vertical" + }, + "axis_along_first=true,facing=south": { + "model": "create:block/gantry_pinion/horizontal" + }, + "axis_along_first=false,facing=west": { + "model": "create:block/gantry_pinion/horizontal", + "y": 90 + }, + "axis_along_first=true,facing=west": { + "model": "create:block/gantry_pinion/vertical", + "y": 90 + }, + "axis_along_first=false,facing=east": { + "model": "create:block/gantry_pinion/horizontal", + "y": 270 + }, + "axis_along_first=true,facing=east": { + "model": "create:block/gantry_pinion/vertical", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/gantry_shaft.json b/src/generated/resources/assets/create/blockstates/gantry_shaft.json new file mode 100644 index 000000000..379d7a3da --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/gantry_shaft.json @@ -0,0 +1,212 @@ +{ + "variants": { + "facing=down,part=start,powered=false": { + "model": "create:block/gantry_shaft_start_flipped", + "x": 180 + }, + "facing=up,part=start,powered=false": { + "model": "create:block/gantry_shaft/block_start" + }, + "facing=north,part=start,powered=false": { + "model": "create:block/gantry_shaft_start_flipped", + "x": 90 + }, + "facing=south,part=start,powered=false": { + "model": "create:block/gantry_shaft/block_start", + "x": 90, + "y": 180 + }, + "facing=west,part=start,powered=false": { + "model": "create:block/gantry_shaft_start_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=start,powered=false": { + "model": "create:block/gantry_shaft/block_start", + "x": 90, + "y": 90 + }, + "facing=down,part=middle,powered=false": { + "model": "create:block/gantry_shaft_middle_flipped", + "x": 180 + }, + "facing=up,part=middle,powered=false": { + "model": "create:block/gantry_shaft/block_middle" + }, + "facing=north,part=middle,powered=false": { + "model": "create:block/gantry_shaft_middle_flipped", + "x": 90 + }, + "facing=south,part=middle,powered=false": { + "model": "create:block/gantry_shaft/block_middle", + "x": 90, + "y": 180 + }, + "facing=west,part=middle,powered=false": { + "model": "create:block/gantry_shaft_middle_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=middle,powered=false": { + "model": "create:block/gantry_shaft/block_middle", + "x": 90, + "y": 90 + }, + "facing=down,part=end,powered=false": { + "model": "create:block/gantry_shaft_end_flipped", + "x": 180 + }, + "facing=up,part=end,powered=false": { + "model": "create:block/gantry_shaft/block_end" + }, + "facing=north,part=end,powered=false": { + "model": "create:block/gantry_shaft_end_flipped", + "x": 90 + }, + "facing=south,part=end,powered=false": { + "model": "create:block/gantry_shaft/block_end", + "x": 90, + "y": 180 + }, + "facing=west,part=end,powered=false": { + "model": "create:block/gantry_shaft_end_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=end,powered=false": { + "model": "create:block/gantry_shaft/block_end", + "x": 90, + "y": 90 + }, + "facing=down,part=single,powered=false": { + "model": "create:block/gantry_shaft_single_flipped", + "x": 180 + }, + "facing=up,part=single,powered=false": { + "model": "create:block/gantry_shaft/block_single" + }, + "facing=north,part=single,powered=false": { + "model": "create:block/gantry_shaft_single_flipped", + "x": 90 + }, + "facing=south,part=single,powered=false": { + "model": "create:block/gantry_shaft/block_single", + "x": 90, + "y": 180 + }, + "facing=west,part=single,powered=false": { + "model": "create:block/gantry_shaft_single_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=single,powered=false": { + "model": "create:block/gantry_shaft/block_single", + "x": 90, + "y": 90 + }, + "facing=down,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered_flipped", + "x": 180 + }, + "facing=up,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered" + }, + "facing=north,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered_flipped", + "x": 90 + }, + "facing=south,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered", + "x": 90, + "y": 180 + }, + "facing=west,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=start,powered=true": { + "model": "create:block/gantry_shaft_start_powered", + "x": 90, + "y": 90 + }, + "facing=down,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered_flipped", + "x": 180 + }, + "facing=up,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered" + }, + "facing=north,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered_flipped", + "x": 90 + }, + "facing=south,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered", + "x": 90, + "y": 180 + }, + "facing=west,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=middle,powered=true": { + "model": "create:block/gantry_shaft_middle_powered", + "x": 90, + "y": 90 + }, + "facing=down,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered_flipped", + "x": 180 + }, + "facing=up,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered" + }, + "facing=north,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered_flipped", + "x": 90 + }, + "facing=south,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered", + "x": 90, + "y": 180 + }, + "facing=west,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=end,powered=true": { + "model": "create:block/gantry_shaft_end_powered", + "x": 90, + "y": 90 + }, + "facing=down,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered_flipped", + "x": 180 + }, + "facing=up,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered" + }, + "facing=north,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered_flipped", + "x": 90 + }, + "facing=south,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered", + "x": 90, + "y": 180 + }, + "facing=west,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered_flipped", + "x": 90, + "y": 270 + }, + "facing=east,part=single,powered=true": { + "model": "create:block/gantry_shaft_single_powered", + "x": 90, + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index b49565761..65c0554be 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -158,6 +158,8 @@ "block.create.gabbro_cobblestone_stairs": "s\u0279\u0131\u0250\u0287S \u01DDuo\u0287s\u01DD\u05DFqqo\u0186 o\u0279qq\u0250\u2141", "block.create.gabbro_cobblestone_wall": "\u05DF\u05DF\u0250M \u01DDuo\u0287s\u01DD\u05DFqqo\u0186 o\u0279qq\u0250\u2141", "block.create.gabbro_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 o\u0279qq\u0250\u2141", + "block.create.gantry_pinion": "uo\u0131u\u0131\u0500 \u028E\u0279\u0287u\u0250\u2141", + "block.create.gantry_shaft": "\u0287\u025F\u0250\u0265S \u028E\u0279\u0287u\u0250\u2141", "block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141", "block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141", "block.create.glass_fluid_pipe": "\u01DDd\u0131\u0500 p\u0131n\u05DF\u2132 ss\u0250\u05DF\u2141", @@ -400,6 +402,7 @@ "block.create.zinc_block": "\u029E\u0254o\u05DF\u15FA \u0254u\u0131Z", "block.create.zinc_ore": "\u01DD\u0279O \u0254u\u0131Z", "entity.create.contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186", + "entity.create.gantry_contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 \u028E\u0279\u0287u\u0250\u2141", "entity.create.seat": "\u0287\u0250\u01DDS", "entity.create.stationary_contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 \u028E\u0279\u0250uo\u0131\u0287\u0250\u0287S", "entity.create.super_glue": "\u01DDn\u05DF\u2141 \u0279\u01DDdnS", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index a7b48ea0c..fb30e864a 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -161,6 +161,8 @@ "block.create.gabbro_cobblestone_stairs": "Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "Gabbro Pillar", + "block.create.gantry_pinion": "Gantry Pinion", + "block.create.gantry_shaft": "Gantry Shaft", "block.create.gearbox": "Gearbox", "block.create.gearshift": "Gearshift", "block.create.glass_fluid_pipe": "Glass Fluid Pipe", @@ -404,6 +406,7 @@ "block.create.zinc_ore": "Zinc Ore", "entity.create.contraption": "Contraption", + "entity.create.gantry_contraption": "Gantry Contraption", "entity.create.seat": "Seat", "entity.create.stationary_contraption": "Stationary Contraption", "entity.create.super_glue": "Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index ab2ac6851..763c4468d 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1211", + "_": "Missing Localizations: 1214", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Getriebe", "block.create.gearshift": "Gangschaltung", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "UNLOCALIZED: Zinc Ore", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index 24cd8a5b7..96e48c700 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 862", + "_": "Missing Localizations: 865", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Boîte à roue dentée", "block.create.gearshift": "Décaleur de rotation", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "Minerai de zinc", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index 7de389b9f..5df2cb28b 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 846", + "_": "Missing Localizations: 849", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Riduttore", "block.create.gearshift": "Cambio", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "Zinco Grezzo", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index 9b31a9385..10510018e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 845", + "_": "Missing Localizations: 848", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "ギアボックス", "block.create.gearshift": "ギアシフト", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "亜鉛鉱石", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index bec923df7..f9779a768 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 52", + "_": "Missing Localizations: 55", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "반려암 조약돌 계단", "block.create.gabbro_cobblestone_wall": "반려암 조약돌 담장", "block.create.gabbro_pillar": "반려암 기둥", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "기어박스", "block.create.gearshift": "기어쉬프트", "block.create.glass_fluid_pipe": "액체 파이프", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "아연 광석", "entity.create.contraption": "장치", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "좌석", "entity.create.stationary_contraption": "고정된 장치", "entity.create.super_glue": "강력 접착제", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index 0b8b4afb2..cbd42c8a8 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1152", + "_": "Missing Localizations: 1155", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Versnellingsbak", "block.create.gearshift": "Versnellingspook", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "UNLOCALIZED: Zinc Ore", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index e0eb5b879..a967dbbe6 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1218", + "_": "Missing Localizations: 1221", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "UNLOCALIZED: Gabbro Cobblestone Stairs", "block.create.gabbro_cobblestone_wall": "UNLOCALIZED: Gabbro Cobblestone Wall", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Caixa de Transmissão", "block.create.gearshift": "Câmbio", "block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "UNLOCALIZED: Zinc Ore", "entity.create.contraption": "UNLOCALIZED: Contraption", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "UNLOCALIZED: Seat", "entity.create.stationary_contraption": "UNLOCALIZED: Stationary Contraption", "entity.create.super_glue": "UNLOCALIZED: Super Glue", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 2085aa34a..17e6ae242 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 2", + "_": "Missing Localizations: 5", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "Ступени из габбро-булыжника", "block.create.gabbro_cobblestone_wall": "Стена из габбро-булыжника", "block.create.gabbro_pillar": "Габбро колонна", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "Коробка передач", "block.create.gearshift": "Реверсивный механизм", "block.create.glass_fluid_pipe": "Стеклянная жидкостная труба", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "Цинковая руда", "entity.create.contraption": "Штуковина", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "сиденье", "entity.create.stationary_contraption": "Стационарная штуковина", "entity.create.super_glue": "Супер-клей", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 783cb9fb2..641ba6d17 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 5", + "_": "Missing Localizations: 8", "_": "->------------------------] Game Elements [------------------------<-", @@ -162,6 +162,8 @@ "block.create.gabbro_cobblestone_stairs": "辉长岩圆石楼梯", "block.create.gabbro_cobblestone_wall": "辉长岩圆石墙", "block.create.gabbro_pillar": "竖纹辉长岩", + "block.create.gantry_pinion": "UNLOCALIZED: Gantry Pinion", + "block.create.gantry_shaft": "UNLOCALIZED: Gantry Shaft", "block.create.gearbox": "十字齿轮箱", "block.create.gearshift": "换挡齿轮箱", "block.create.glass_fluid_pipe": "玻璃流体管道", @@ -405,6 +407,7 @@ "block.create.zinc_ore": "锌矿石", "entity.create.contraption": "结构", + "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", "entity.create.seat": "坐垫", "entity.create.stationary_contraption": "固定结构", "entity.create.super_glue": "强力胶", diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_end_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_end_flipped.json new file mode 100644 index 000000000..647d961f4 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_end_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_end", + "textures": { + "2": "create:block/gantry_shaft_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered.json b/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered.json new file mode 100644 index 000000000..3d3ab236c --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_end", + "textures": { + "2": "create:block/gantry_shaft_powered" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered_flipped.json new file mode 100644 index 000000000..7c009239c --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_end_powered_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_end", + "textures": { + "2": "create:block/gantry_shaft_powered_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_middle_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_flipped.json new file mode 100644 index 000000000..15c145bd7 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_middle", + "textures": { + "2": "create:block/gantry_shaft_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered.json b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered.json new file mode 100644 index 000000000..a62bb0956 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_middle", + "textures": { + "2": "create:block/gantry_shaft_powered" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered_flipped.json new file mode 100644 index 000000000..599fb899d --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_middle_powered_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_middle", + "textures": { + "2": "create:block/gantry_shaft_powered_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_single_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_single_flipped.json new file mode 100644 index 000000000..b042aca12 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_single_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_single", + "textures": { + "2": "create:block/gantry_shaft_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered.json b/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered.json new file mode 100644 index 000000000..25312c6b7 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_single", + "textures": { + "2": "create:block/gantry_shaft_powered" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered_flipped.json new file mode 100644 index 000000000..aeb471f49 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_single_powered_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_single", + "textures": { + "2": "create:block/gantry_shaft_powered_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_start_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_start_flipped.json new file mode 100644 index 000000000..60db07967 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_start_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_start", + "textures": { + "2": "create:block/gantry_shaft_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered.json b/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered.json new file mode 100644 index 000000000..87145ad41 --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_start", + "textures": { + "2": "create:block/gantry_shaft_powered" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered_flipped.json b/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered_flipped.json new file mode 100644 index 000000000..208acae8b --- /dev/null +++ b/src/generated/resources/assets/create/models/block/gantry_shaft_start_powered_flipped.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/gantry_shaft/block_start", + "textures": { + "2": "create:block/gantry_shaft_powered_flipped" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/gantry_pinion.json b/src/generated/resources/assets/create/models/item/gantry_pinion.json new file mode 100644 index 000000000..55924eb15 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/gantry_pinion.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gantry_pinion/item" +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/gantry_shaft.json b/src/generated/resources/assets/create/models/item/gantry_shaft.json new file mode 100644 index 000000000..926e58831 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/gantry_shaft.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gantry_shaft/block_single" +} \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_pinion.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_pinion.json new file mode 100644 index 000000000..b0d383da3 --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_pinion.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/kinetics/gantry_pinion" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:andesite_casing" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/kinetics/gantry_pinion" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_shaft.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_shaft.json new file mode 100644 index 000000000..fda6afd2b --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/gantry_shaft.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/kinetics/gantry_shaft" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:andesite_alloy" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/kinetics/gantry_shaft" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/gantry_pinion.json b/src/generated/resources/data/create/loot_tables/blocks/gantry_pinion.json new file mode 100644 index 000000000..9631215af --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/gantry_pinion.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:gantry_pinion" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/gantry_shaft.json b/src/generated/resources/data/create/loot_tables/blocks/gantry_shaft.json new file mode 100644 index 000000000..63718c8f4 --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/gantry_shaft.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:gantry_shaft" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_pinion.json b/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_pinion.json new file mode 100644 index 000000000..9bb723b76 --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_pinion.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " B ", + "ICI", + " S " + ], + "key": { + "B": { + "tag": "minecraft:planks" + }, + "S": { + "item": "create:cogwheel" + }, + "C": { + "item": "create:andesite_casing" + }, + "I": { + "item": "create:shaft" + } + }, + "result": { + "item": "create:gantry_pinion" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_shaft.json b/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_shaft.json new file mode 100644 index 000000000..0443296ab --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/gantry_shaft.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "A", + "R", + "A" + ], + "key": { + "A": { + "item": "create:andesite_alloy" + }, + "R": { + "tag": "forge:dusts/redstone" + } + }, + "result": { + "item": "create:gantry_shaft", + "count": 8 + } +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java index ebc1b3389..54122026a 100644 --- a/src/main/java/com/simibubi/create/AllBlockPartials.java +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -71,6 +71,8 @@ public class AllBlockPartials { CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), CUCKOO_PIG = get("cuckoo_clock/pig"), CUCKOO_CREEPER = get("cuckoo_clock/creeper"), + GANTRY_COGS = get("gantry_pinion/wheels"), + ROPE_COIL = get("rope_pulley/rope_coil"), ROPE_HALF = get("rope_pulley/rope_half"), ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"), diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index c1354318a..3446861fb 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -54,6 +54,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.bea import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock.ChassisCTBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock.MinecartAnchorBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlockItem; @@ -90,6 +91,7 @@ import com.simibubi.create.content.contraptions.processing.BasinMovementBehaviou import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlockItem; import com.simibubi.create.content.contraptions.processing.burner.LitBlazeBurnerBlock; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftGenerator; @@ -171,8 +173,10 @@ import net.minecraft.item.Item; import net.minecraft.state.properties.PistonType; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; +import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.generators.ConfiguredModel; +import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.common.Tags; import net.minecraftforge.common.ToolType; @@ -686,6 +690,38 @@ public class AllBlocks { .getName() + "/head")))) .register(); + public static final BlockEntry GANTRY_PINION = + REGISTRATE.block("gantry_pinion", GantryPinionBlock::new) + .initialProperties(SharedProperties::stone) + .properties(Block.Properties::nonOpaque) + .blockstate(BlockStateGen.directionalAxisBlockProvider()) + .item() + .transform(customItemModel()) + .register(); + + public static final BlockEntry GANTRY_SHAFT = + REGISTRATE.block("gantry_shaft", GantryShaftBlock::new) + .initialProperties(SharedProperties::stone) + .blockstate((c, p) -> p.directionalBlock(c.get(), s -> { + boolean isPowered = s.get(GantryShaftBlock.POWERED); + boolean isFlipped = s.get(GantryShaftBlock.FACING) + .getAxisDirection() == AxisDirection.NEGATIVE; + String partName = s.get(GantryShaftBlock.PART) + .getName(); + String flipped = isFlipped ? "_flipped" : ""; + String powered = isPowered ? "_powered" : ""; + ModelFile existing = AssetLookup.partialBaseModel(c, p, partName); + if (!isPowered && !isFlipped) + return existing; + return p.models() + .withExistingParent("block/" + c.getName() + "_" + partName + powered + flipped, + existing.getLocation()) + .texture("2", p.modLoc("block/" + c.getName() + powered + flipped)); + })) + .item() + .transform(customItemModel("_", "block_single")) + .register(); + public static final BlockEntry WINDMILL_BEARING = REGISTRATE.block("windmill_bearing", WindmillBearingBlock::new) .transform(BuilderTransformers.bearing("windmill", "gearbox", true)) diff --git a/src/main/java/com/simibubi/create/AllEntityTypes.java b/src/main/java/com/simibubi/create/AllEntityTypes.java index 08a1a8d1a..061e0507d 100644 --- a/src/main/java/com/simibubi/create/AllEntityTypes.java +++ b/src/main/java/com/simibubi/create/AllEntityTypes.java @@ -6,6 +6,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntityRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntityRenderer; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionEntityRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueRenderer; import com.simibubi.create.foundation.utility.Lang; @@ -23,16 +25,27 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry; public class AllEntityTypes { public static final RegistryEntry> ORIENTED_CONTRAPTION = - register("contraption", OrientedContraptionEntity::new, EntityClassification.MISC, 5, 3, true, - AbstractContraptionEntity::build); + contraption("contraption", OrientedContraptionEntity::new, 5, 3, true); public static final RegistryEntry> CONTROLLED_CONTRAPTION = - register("stationary_contraption", ControlledContraptionEntity::new, EntityClassification.MISC, 20, 40, false, - AbstractContraptionEntity::build); + contraption("stationary_contraption", ControlledContraptionEntity::new, 20, 40, false); + public static final RegistryEntry> GANTRY_CONTRAPTION = + contraption("gantry_contraption", GantryContraptionEntity::new, 10, 40, false); + public static final RegistryEntry> SUPER_GLUE = register("super_glue", SuperGlueEntity::new, EntityClassification.MISC, 10, Integer.MAX_VALUE, false, SuperGlueEntity::build); public static final RegistryEntry> SEAT = register("seat", SeatEntity::new, EntityClassification.MISC, 0, Integer.MAX_VALUE, false, SeatEntity::build); + // + + public static void register() {} + + private static RegistryEntry> contraption(String name, IFactory factory, + int range, int updateFrequency, boolean sendVelocity) { + return register(name, factory, EntityClassification.MISC, range, updateFrequency, sendVelocity, + AbstractContraptionEntity::build); + } + private static RegistryEntry> register(String name, IFactory factory, EntityClassification group, int range, int updateFrequency, boolean sendVelocity, NonNullConsumer> propertyBuilder) { @@ -46,14 +59,14 @@ public class AllEntityTypes { .register(); } - public static void register() {} - @OnlyIn(value = Dist.CLIENT) public static void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(CONTROLLED_CONTRAPTION.get(), ControlledContraptionEntityRenderer::new); RenderingRegistry.registerEntityRenderingHandler(ORIENTED_CONTRAPTION.get(), OrientedContraptionEntityRenderer::new); + RenderingRegistry.registerEntityRenderingHandler(GANTRY_CONTRAPTION.get(), + GantryContraptionEntityRenderer::new); RenderingRegistry.registerEntityRenderingHandler(SUPER_GLUE.get(), SuperGlueRenderer::new); RenderingRegistry.registerEntityRenderingHandler(SEAT.get(), SeatEntity.Render::new); } diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index bc644e746..9cf3b8fb2 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -40,6 +40,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.bea import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionRenderer; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonTileEntity; @@ -68,6 +70,7 @@ import com.simibubi.create.content.contraptions.processing.BasinRenderer; import com.simibubi.create.content.contraptions.processing.BasinTileEntity; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerRenderer; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerTileEntity; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerRenderer; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.SequencedGearshiftTileEntity; @@ -203,6 +206,18 @@ public class AllTileEntities { .validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK) .renderer(() -> CuckooClockRenderer::new) .register(); + + public static final TileEntityEntry GANTRY_SHAFT = Create.registrate() + .tileEntity("gantry_shaft", GantryShaftTileEntity::new) + .validBlocks(AllBlocks.GANTRY_SHAFT) + .renderer(() -> KineticTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry GANTRY_PINION = Create.registrate() + .tileEntity("gantry_pinion", GantryPinionTileEntity::new) + .validBlocks(AllBlocks.GANTRY_PINION) + .renderer(() -> GantryPinionRenderer::new) + .register(); public static final TileEntityEntry MECHANICAL_PUMP = Create.registrate() .tileEntity("mechanical_pump", PumpTileEntity::new) @@ -279,7 +294,7 @@ public class AllTileEntities { .validBlocks(AllBlocks.CHUTE) .renderer(() -> ChuteRenderer::new) .register(); - + public static final TileEntityEntry SMART_CHUTE = Create.registrate() .tileEntity("smart_chute", SmartChuteTileEntity::new) .validBlocks(AllBlocks.SMART_CHUTE) diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index a48b53492..af28f62f3 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -14,6 +14,7 @@ import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.content.palettes.AllPaletteBlocks; import com.simibubi.create.content.palettes.PalettesItemGroup; import com.simibubi.create.content.schematics.ServerSchematicLoader; +import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.command.ChunkUtil; @@ -99,6 +100,7 @@ public class Create { public static void init(final FMLCommonSetupEvent event) { CapabilityMinecartController.register(); + SchematicInstances.register(); schematicReceiver = new ServerSchematicLoader(); redstoneLinkNetworkHandler = new RedstoneLinkNetworkHandler(); torquePropagator = new TorquePropagator(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java index 6ef43c17c..dd29f947e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java +++ b/src/main/java/com/simibubi/create/content/contraptions/RotationPropagator.java @@ -11,7 +11,6 @@ import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity; -import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.content.contraptions.relays.encased.DirectionalShaftHalvesTileEntity; import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock; @@ -70,11 +69,9 @@ public class RotationPropagator { boolean connectedByGears = definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom) && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo); - // Belt <-> Belt - if (from instanceof BeltTileEntity && to instanceof BeltTileEntity && !connectedByAxis) { - return ((BeltTileEntity) from).getController() - .equals(((BeltTileEntity) to).getController()) ? 1 : 0; - } + float custom = from.propagateRotationTo(to, stateFrom, stateTo, diff, connectedByAxis, connectedByGears); + if (custom != 0) + return custom; // Axis <-> Axis if (connectedByAxis) { @@ -230,6 +227,9 @@ public class RotationPropagator { float newSpeed = getConveyedSpeed(currentTE, neighbourTE); float oppositeSpeed = getConveyedSpeed(neighbourTE, currentTE); + if (newSpeed == 0 && oppositeSpeed == 0) + continue; + boolean incompatible = Math.signum(newSpeed) != Math.signum(speedOfNeighbour) && (newSpeed != 0 && speedOfNeighbour != 0); @@ -395,7 +395,7 @@ public class RotationPropagator { if (!(neighbourKTE.getBlockState() .getBlock() instanceof IRotate)) return null; - if (!isConnected(currentTE, neighbourKTE)) + if (!isConnected(currentTE, neighbourKTE) && !isConnected(neighbourKTE, currentTE)) return null; return neighbourKTE; } @@ -403,14 +403,9 @@ public class RotationPropagator { public static boolean isConnected(KineticTileEntity from, KineticTileEntity to) { final BlockState stateFrom = from.getBlockState(); final BlockState stateTo = to.getBlockState(); - - if (isLargeCogToSpeedController(stateFrom, stateTo, to.getPos() - .subtract(from.getPos()))) - return true; - if (isLargeCogToSpeedController(stateTo, stateFrom, from.getPos() - .subtract(to.getPos()))) - return true; - return getRotationSpeedModifier(from, to) != 0; + return isLargeCogToSpeedController(stateFrom, stateTo, to.getPos() + .subtract(from.getPos())) || getRotationSpeedModifier(from, to) != 0 + || from.isCustomConnection(to, stateFrom, stateTo); } private static List getConnectedNeighbours(KineticTileEntity te) { @@ -436,30 +431,11 @@ public class RotationPropagator { neighbours.add(te.getPos() .offset(facing)); - // Some Blocks can interface diagonally BlockState blockState = te.getBlockState(); - boolean isLargeWheel = isLargeCog(blockState); - if (!(blockState.getBlock() instanceof IRotate)) return neighbours; IRotate block = (IRotate) blockState.getBlock(); - - if (block.hasIntegratedCogwheel(te.getWorld(), te.getPos(), blockState) || isLargeWheel - || AllBlocks.BELT.has(blockState)) { - Axis axis = block.getRotationAxis(blockState); - - BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) - .forEach(offset -> { - if (!isLargeWheel && 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; + return te.addPropagationLocations(block, blockState, neighbours); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java index 24d713f28..ee0734ae3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java @@ -31,7 +31,8 @@ public abstract class KineticBlock extends Block implements IRotate { @Override public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { - for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) { + for (ToolType toolType : player.getHeldItemMainhand() + .getToolTypes()) { if (isToolEffective(state, toolType)) return true; } @@ -46,6 +47,24 @@ public abstract class KineticBlock extends Block implements IRotate { @Override public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { // onBlockAdded is useless for init, as sometimes the TE gets re-instantiated + + // however, if a block change occurs that does not change kinetic connections, + // we can prevent a major re-propagation here + + TileEntity tileEntity = worldIn.getTileEntity(pos); + if (tileEntity instanceof KineticTileEntity) { + KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity; + kineticTileEntity.preventSpeedUpdate = false; + + if (oldState.getBlock() != state.getBlock()) + return; + if (state.hasTileEntity() != oldState.hasTileEntity()) + return; + if (!areStatesKineticallyEquivalent(oldState, state)) + return; + + kineticTileEntity.preventSpeedUpdate = true; + } } @Override @@ -63,6 +82,10 @@ public abstract class KineticBlock extends Block implements IRotate { return true; } + protected boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState newState) { + return getRotationAxis(newState) == getRotationAxis(oldState); + } + @Override public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); @@ -76,9 +99,14 @@ public abstract class KineticBlock extends Block implements IRotate { TileEntity tileEntity = worldIn.getTileEntity(pos); if (!(tileEntity instanceof KineticTileEntity)) return; + KineticTileEntity kte = (KineticTileEntity) tileEntity; + + if (kte.preventSpeedUpdate) { + kte.preventSpeedUpdate = false; + return; + } // Remove previous information when block is added - KineticTileEntity kte = (KineticTileEntity) tileEntity; kte.warnOfMovement(); kte.clearKineticInformation(); kte.updateSpeed = true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 8df6884c4..a7d96c5be 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -30,6 +30,7 @@ import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; @@ -42,6 +43,7 @@ public abstract class KineticTileEntity extends SmartTileEntity public @Nullable BlockPos source; public boolean networkDirty; public boolean updateSpeed; + public boolean preventSpeedUpdate; protected KineticEffectHandler effects; protected float speed; @@ -361,11 +363,15 @@ public abstract class KineticTileEntity extends SmartTileEntity } KineticTileEntity tileEntity = (KineticTileEntity) tileEntityIn; - if (tileEntity.hasNetwork()) - tileEntity.getOrCreateNetwork() - .remove(tileEntity); - tileEntity.detachKinetics(); - tileEntity.removeSource(); + if (state.getBlock() instanceof KineticBlock + && !((KineticBlock) state.getBlock()).areStatesKineticallyEquivalent(currentState, state)) { + if (tileEntity.hasNetwork()) + tileEntity.getOrCreateNetwork() + .remove(tileEntity); + tileEntity.detachKinetics(); + tileEntity.removeSource(); + } + world.setBlockState(pos, state, 3); } @@ -404,7 +410,7 @@ public abstract class KineticTileEntity extends SmartTileEntity return false; } - @Override + @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { boolean added = false; float stressAtBase = calculateStressApplied(); @@ -417,8 +423,8 @@ public abstract class KineticTileEntity extends SmartTileEntity String stressString = spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s"; - tooltip.add(" " + String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressTotal), - Lang.translate("gui.goggles.at_current_speed"))); + tooltip.add(" " + String.format(stressString, TextFormatting.AQUA, + IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed"))); added = true; } @@ -454,4 +460,72 @@ public abstract class KineticTileEntity extends SmartTileEntity return overStressed; } + // Custom Propagation + + /** + * Specify ratio of transferred rotation from this kinetic component to a + * specific other. + * + * @param target other Kinetic TE to transfer to + * @param stateFrom this TE's blockstate + * @param stateTo other TE's blockstate + * @param diff difference in position (to.pos - from.pos) + * @param connectedViaAxes whether these kinetic blocks are connected via mutual + * IRotate.hasShaftTowards() + * @param connectedViaCogs whether these kinetic blocks are connected via mutual + * IRotate.hasIntegratedCogwheel() + * @return factor of rotation speed from this TE to other. 0 if no rotation is + * transferred, or the standard rules apply (integrated shafts/cogs) + */ + public float propagateRotationTo(KineticTileEntity target, BlockState stateFrom, BlockState stateTo, BlockPos diff, + boolean connectedViaAxes, boolean connectedViaCogs) { + return 0; + } + + /** + * Specify additional locations the rotation propagator should look for + * potentially connected components. Neighbour list contains offset positions in + * all 6 directions by default. + * + * @param block + * @param state + * @param neighbours + * @return + */ + public List addPropagationLocations(IRotate block, BlockState state, List neighbours) { + if (!canPropagateDiagonally(block, state)) + return neighbours; + + Axis axis = block.getRotationAxis(state); + 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(pos.add(offset)); + }); + return neighbours; + } + + /** + * Specify whether this component can propagate speed to the other in any + * circumstance. Shaft and cogwheel connections are already handled by internal + * logic. Does not have to be specified on both ends, it is assumed that this + * relation is symmetrical. + * + * @param other + * @param state + * @param otherState + * @return true if this and the other component should check their propagation + * factor and are not already connected via integrated cogs or shafts + */ + public boolean isCustomConnection(KineticTileEntity other, BlockState state, BlockState otherState) { + return false; + } + + protected boolean canPropagateDiagonally(IRotate block, BlockState state) { + return block.hasIntegratedCogwheel(world, pos, state); + } + } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/motor/CreativeMotorTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/motor/CreativeMotorTileEntity.java index 79d4268b9..1f0168b87 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/motor/CreativeMotorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/motor/CreativeMotorTileEntity.java @@ -27,8 +27,8 @@ public class CreativeMotorTileEntity extends GeneratingKineticTileEntity { super.addBehaviours(behaviours); Integer max = AllConfigs.SERVER.kinetics.maxMotorSpeed.get(); - CenteredSideValueBoxTransform slot = - new CenteredSideValueBoxTransform((motor, side) -> motor.get(CreativeMotorBlock.FACING) == side.getOpposite()); + CenteredSideValueBoxTransform slot = new CenteredSideValueBoxTransform( + (motor, side) -> motor.get(CreativeMotorBlock.FACING) == side.getOpposite()); generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot); generatedSpeed.between(-max, max); @@ -55,20 +55,21 @@ public class CreativeMotorTileEntity extends GeneratingKineticTileEntity { } public static int step(StepContext context) { - if (context.shift) - return 1; - int current = context.currentValue; - int magnitude = Math.abs(current) - (context.forward == current > 0 ? 0 : 1); int step = 1; - if (magnitude >= 4) - step *= 4; - if (magnitude >= 32) - step *= 4; - if (magnitude >= 128) - step *= 4; - return step; + if (!context.shift) { + int magnitude = Math.abs(current) - (context.forward == current > 0 ? 0 : 1); + + if (magnitude >= 4) + step *= 4; + if (magnitude >= 32) + step *= 4; + if (magnitude >= 128) + step *= 4; + } + + return (int) (current + (context.forward ? step : -step) == 0 ? step + 1 : step); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index 84b7f8b64..c863f4372 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -73,6 +73,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; contraption.onEntityCreated(this); } + + public boolean supportsTerrainCollision() { + return contraption instanceof TranslatingContraption; + } protected void contraptionInitialize() { contraption.onEntityInitialize(world, this); @@ -594,7 +598,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } public static class ContraptionRotationState { - static final ContraptionRotationState NONE = new ContraptionRotationState(); + public static final ContraptionRotationState NONE = new ContraptionRotationState(); float xRotation = 0; float yRotation = 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AllContraptionTypes.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AllContraptionTypes.java deleted file mode 100644 index 7fc1b3483..000000000 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AllContraptionTypes.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.simibubi.create.content.contraptions.components.structureMovement; - -import java.util.function.Supplier; - -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyContraption; -import com.simibubi.create.foundation.utility.Lang; - -public enum AllContraptionTypes { - - PISTON(PistonContraption::new), - BEARING(BearingContraption::new), - PULLEY(PulleyContraption::new), - CLOCKWORK(ClockworkContraption::new), - MOUNTED(MountedContraption::new), - STABILIZED(StabilizedContraption::new), - - ; - - Supplier factory; - String id; - - private AllContraptionTypes(Supplier factory) { - this.factory = factory; - id = Lang.asId(name()); - } - - public static Contraption fromType(String type) { - for (AllContraptionTypes allContraptionTypes : values()) - if (type.equals(allContraptionTypes.id)) - return allContraptionTypes.factory.get(); - return null; - } - -} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index bf4a6124f..67d6b929d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -30,6 +30,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.bea import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionBlock; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueHandler; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock; @@ -40,6 +41,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.RopeBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; @@ -136,7 +138,7 @@ public abstract class Contraption { protected abstract boolean canAxisBeStabilized(Axis axis); - protected abstract AllContraptionTypes getType(); + protected abstract ContraptionType getType(); protected boolean customBlockPlacement(IWorld world, BlockPos pos, BlockState state) { return false; @@ -153,7 +155,7 @@ public abstract class Contraption { public static Contraption fromNBT(World world, CompoundNBT nbt, boolean spawnData) { String type = nbt.getString("Type"); - Contraption contraption = AllContraptionTypes.fromType(type); + Contraption contraption = ContraptionType.fromType(type); contraption.readNBT(world, nbt, spawnData); return contraption; } @@ -264,6 +266,26 @@ public abstract class Contraption { if (AllBlocks.BELT.has(state)) moveBelt(pos, frontier, visited, state); + if (AllBlocks.GANTRY_PINION.has(state)) { + BlockPos offset = pos.offset(state.get(GantryPinionBlock.FACING)); + if (!visited.contains(offset)) + frontier.add(offset); + } + + if (AllBlocks.GANTRY_SHAFT.has(state)) + for (Direction d : Iterate.directions) { + BlockPos offset = pos.offset(d); + if (!visited.contains(offset)) { + BlockState offsetState = world.getBlockState(offset); + Direction facing = state.get(GantryShaftBlock.FACING); + if (d.getAxis() == facing.getAxis() && AllBlocks.GANTRY_SHAFT.has(offsetState) + && offsetState.get(GantryShaftBlock.FACING) == facing) + frontier.add(offset); + else if (AllBlocks.GANTRY_PINION.has(offsetState) && offsetState.get(GantryPinionBlock.FACING) == d) + frontier.add(offset); + } + } + // Bearings potentially create stabilized sub-contraptions if (AllBlocks.MECHANICAL_BEARING.has(state)) moveBearing(pos, frontier, visited, state); @@ -726,7 +748,8 @@ public abstract class Contraption { if (brittles != BlockMovementTraits.isBrittle(block.state)) continue; - BlockPos add = block.pos.add(anchor).add(offset); + BlockPos add = block.pos.add(anchor) + .add(offset); if (customBlockRemoval(world, add, block.state)) continue; BlockState oldState = world.getBlockState(add); @@ -735,7 +758,8 @@ public abstract class Contraption { iterator.remove(); world.getWorld() .removeTileEntity(add); - int flags = BlockFlags.IS_MOVING | BlockFlags.NO_NEIGHBOR_DROPS | BlockFlags.UPDATE_NEIGHBORS; + int flags = BlockFlags.IS_MOVING | BlockFlags.NO_NEIGHBOR_DROPS | BlockFlags.UPDATE_NEIGHBORS + | BlockFlags.BLOCK_UPDATE; if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED) .booleanValue()) { @@ -746,8 +770,12 @@ public abstract class Contraption { } } for (BlockInfo block : blocks.values()) { - BlockPos add = block.pos.add(anchor).add(offset); - world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), BlockFlags.IS_MOVING | BlockFlags.DEFAULT); + BlockPos add = block.pos.add(anchor) + .add(offset); + if (!shouldUpdateAfterMovement(block)) + continue; + world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), + BlockFlags.IS_MOVING | BlockFlags.DEFAULT); } } @@ -828,7 +856,10 @@ public abstract class Contraption { } for (BlockInfo block : blocks.values()) { BlockPos targetPos = transform.apply(block.pos); - world.markAndNotifyBlock(targetPos, null, block.state, block.state, BlockFlags.IS_MOVING | BlockFlags.DEFAULT); + if (!shouldUpdateAfterMovement(block)) + continue; + world.markAndNotifyBlock(targetPos, null, block.state, block.state, + BlockFlags.IS_MOVING | BlockFlags.DEFAULT); } for (int i = 0; i < inventory.getSlots(); i++) @@ -888,6 +919,10 @@ public abstract class Contraption { callBack.accept(AllMovementBehaviours.of(pair.getLeft().state), pair.getRight()); } + protected boolean shouldUpdateAfterMovement(BlockInfo info) { + return true; + } + public void expandBoundsAroundAxis(Axis axis) { AxisAlignedBB bb = bounds; double maxXDiff = Math.max(bb.maxX - 1, -bb.minX); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java index d3ffcca36..4f8e5f812 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java @@ -348,7 +348,7 @@ public class ContraptionCollider { return potentialHits; } - public static boolean collideBlocks(ControlledContraptionEntity contraptionEntity) { + public static boolean collideBlocks(AbstractContraptionEntity contraptionEntity) { if (!contraptionEntity.supportsTerrainCollision()) return false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionType.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionType.java new file mode 100644 index 000000000..5ddf9e9bf --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionType.java @@ -0,0 +1,49 @@ +package com.simibubi.create.content.contraptions.components.structureMovement; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Supplier; + +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyContraption; + +public class ContraptionType { + + public static Map entries = new HashMap<>(); + public static ContraptionType + PISTON = register("piston", PistonContraption::new), + BEARING = register("bearing", BearingContraption::new), + PULLEY = register("pulley", PulleyContraption::new), + CLOCKWORK = register("clockwork", ClockworkContraption::new), + MOUNTED = register("mounted", MountedContraption::new), + STABILIZED = register("stabilized", StabilizedContraption::new), + GANTRY = register("gantry", GantryContraption::new); + + Supplier factory; + String id; + + public static ContraptionType register(String id, Supplier factory) { + ContraptionType value = new ContraptionType(id, factory); + entries.put(id, value); + return value; + } + + private ContraptionType(String id, Supplier factory) { + this.factory = factory; + this.id = id; + } + + public static Contraption fromType(String type) { + for (Entry allContraptionTypes : entries.entrySet()) + if (type.equals(allContraptionTypes.getKey())) + return allContraptionTypes.getValue().factory.get(); + return null; + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index cc3496b24..5ef894acb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -46,10 +46,6 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { return entity; } - public boolean supportsTerrainCollision() { - return contraption instanceof TranslatingContraption; - } - @Override public Vec3d getContactPointMotion(Vec3d globalContactPoint) { if (contraption instanceof TranslatingContraption) @@ -151,8 +147,6 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { } Vec3d motion = getMotion(); - if (motion.length() < 1 / 4098f) - setMotion(Vec3d.ZERO); move(motion.x, motion.y, motion.z); if (ContraptionCollider.collideBlocks(this)) getController().collided(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntityRenderer.java index 78604cfb8..bbef43c57 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntityRenderer.java @@ -22,7 +22,7 @@ public class OrientedContraptionEntityRenderer extends AbstractContraptionEntity if (!super.shouldRender(entity, p_225626_2_, p_225626_3_, p_225626_5_, p_225626_7_)) return false; if (entity.getContraption() - .getType() == AllContraptionTypes.MOUNTED && entity.getRidingEntity() == null) + .getType() == ContraptionType.MOUNTED && entity.getRidingEntity() == null) return false; return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java index 7e473df3b..82d1f89ce 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/TranslatingContraption.java @@ -17,7 +17,7 @@ public abstract class TranslatingContraption extends Contraption { public Set getColliders(World world, Direction movementDirection) { if (getBlocks() == null) - return Collections.EMPTY_SET; + return Collections.emptySet(); if (cachedColliders == null || cachedColliderDirection != movementDirection) { cachedColliders = new HashSet<>(); cachedColliderDirection = movementDirection; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java index 76db5bd8b..fc99cd432 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.AllTags.AllBlockTags; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import net.minecraft.nbt.CompoundNBT; @@ -43,8 +43,8 @@ public class BearingContraption extends Contraption { } @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.BEARING; + protected ContraptionType getType() { + return ContraptionType.BEARING; } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java index 31b7709f3..94f889bd3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java @@ -6,7 +6,7 @@ import java.util.Set; import org.apache.commons.lang3.tuple.Pair; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.foundation.utility.NBTHelper; @@ -24,8 +24,8 @@ public class ClockworkContraption extends Contraption { private Set ignoreBlocks = new HashSet<>(); @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.CLOCKWORK; + protected ContraptionType getType() { + return ContraptionType.CLOCKWORK; } private void ignoreBlocks(Set blocks, BlockPos anchor) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java index f54d09beb..15f8b40d7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import net.minecraft.nbt.CompoundNBT; @@ -37,8 +37,8 @@ public class StabilizedContraption extends Contraption { } @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.STABILIZED; + protected ContraptionType getType() { + return ContraptionType.STABILIZED; } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java new file mode 100644 index 000000000..58ddcadcb --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java @@ -0,0 +1,63 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; +import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.template.Template.BlockInfo; + +public class GantryContraption extends TranslatingContraption { + + protected Direction facing; + + public GantryContraption() {} + + public GantryContraption(Direction facing) { + this.facing = facing; + } + + @Override + public boolean assemble(World world, BlockPos pos) { + if (!searchMovedStructure(world, pos, null)) + return false; + startMoving(world); + return true; + } + + @Override + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); + tag.putInt("Facing", facing.getIndex()); + return tag; + } + + @Override + public void readNBT(World world, CompoundNBT tag, boolean spawnData) { + facing = Direction.byIndex(tag.getInt("Facing")); + super.readNBT(world, tag, spawnData); + } + + @Override + protected boolean isAnchoringBlockAt(BlockPos pos) { + return super.isAnchoringBlockAt(pos.offset(facing)); + } + + @Override + protected ContraptionType getType() { + return ContraptionType.GANTRY; + } + + public Direction getFacing() { + return facing; + } + + @Override + protected boolean shouldUpdateAfterMovement(BlockInfo info) { + return super.shouldUpdateAfterMovement(info) && !AllBlocks.GANTRY_PINION.has(info.state); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java new file mode 100644 index 000000000..ac2aacbc7 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java @@ -0,0 +1,203 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllEntityTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider; +import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity; +import com.simibubi.create.foundation.networking.AllPackets; +import com.simibubi.create.foundation.utility.NBTHelper; +import com.simibubi.create.foundation.utility.ServerSpeedProvider; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.network.PacketDistributor; + +public class GantryContraptionEntity extends AbstractContraptionEntity { + + Direction movementAxis; + double clientOffsetDiff; + double axisMotion; + + public GantryContraptionEntity(EntityType entityTypeIn, World worldIn) { + super(entityTypeIn, worldIn); + } + + public static GantryContraptionEntity create(World world, Contraption contraption, Direction movementAxis) { + GantryContraptionEntity entity = new GantryContraptionEntity(AllEntityTypes.GANTRY_CONTRAPTION.get(), world); + entity.setContraption(contraption); + entity.movementAxis = movementAxis; + return entity; + } + + @Override + protected void tickContraption() { + if (!(contraption instanceof GantryContraption)) + return; + + double prevAxisMotion = axisMotion; + if (world.isRemote) { + clientOffsetDiff *= .75f; + updateClientMotion(); + } + + checkPinionShaft(); + tickActors(); + Vec3d movementVec = getMotion(); + + if (ContraptionCollider.collideBlocks(this)) { + if (!world.isRemote) + disassemble(); + return; + } + + if (!isStalled() && ticksExisted > 2) + move(movementVec.x, movementVec.y, movementVec.z); + + if (!world.isRemote && (prevAxisMotion != axisMotion || ticksExisted % 3 == 0)) + sendPacket(); + } + + protected void checkPinionShaft() { + Vec3d movementVec; + Direction facing = ((GantryContraption) contraption).getFacing(); + Vec3d currentPosition = getAnchorVec().add(.5, .5, .5); + BlockPos gantryShaftPos = new BlockPos(currentPosition).offset(facing.getOpposite()); + + TileEntity te = world.getTileEntity(gantryShaftPos); + if (!(te instanceof GantryShaftTileEntity) || !AllBlocks.GANTRY_SHAFT.has(te.getBlockState())) { + if (!world.isRemote) { + setContraptionMotion(Vec3d.ZERO); + disassemble(); + } + return; + } + + BlockState blockState = te.getBlockState(); + Direction direction = blockState.get(GantryShaftBlock.FACING); + GantryShaftTileEntity gantryShaftTileEntity = (GantryShaftTileEntity) te; + + float pinionMovementSpeed = gantryShaftTileEntity.getPinionMovementSpeed(); + movementVec = new Vec3d(direction.getDirectionVec()).scale(pinionMovementSpeed); + + if (blockState.get(GantryShaftBlock.POWERED) || pinionMovementSpeed == 0) { + setContraptionMotion(Vec3d.ZERO); + if (!world.isRemote) + disassemble(); + return; + } + + Vec3d nextPosition = currentPosition.add(movementVec); + double currentCoord = direction.getAxis() + .getCoordinate(currentPosition.x, currentPosition.y, currentPosition.z); + double nextCoord = direction.getAxis() + .getCoordinate(nextPosition.x, nextPosition.y, nextPosition.z); + + if ((MathHelper.floor(currentCoord) + .5f < nextCoord != (pinionMovementSpeed * direction.getAxisDirection() + .getOffset() < 0))) + if (!gantryShaftTileEntity.canAssembleOn()) { + setContraptionMotion(Vec3d.ZERO); + if (!world.isRemote) + disassemble(); + return; + } + + if (world.isRemote) + return; + + axisMotion = pinionMovementSpeed; + setContraptionMotion(movementVec); + } + + @Override + protected void writeAdditional(CompoundNBT compound, boolean spawnPacket) { + NBTHelper.writeEnum(compound, "GantryAxis", movementAxis); + super.writeAdditional(compound, spawnPacket); + } + + protected void readAdditional(CompoundNBT compound, boolean spawnData) { + movementAxis = NBTHelper.readEnum(compound, "GantryAxis", Direction.class); + super.readAdditional(compound, spawnData); + } + + @Override + public Vec3d applyRotation(Vec3d localPos, float partialTicks) { + return localPos; + } + + @Override + public Vec3d reverseRotation(Vec3d localPos, float partialTicks) { + return localPos; + } + + @Override + protected StructureTransform makeStructureTransform() { + return new StructureTransform(new BlockPos(getAnchorVec().add(.5, .5, .5)), 0, 0, 0); + } + + @Override + protected float getStalledAngle() { + return 0; + } + + @Override + public void setPositionAndUpdate(double p_70634_1_, double p_70634_3_, double p_70634_5_) {} + + @Override + @OnlyIn(Dist.CLIENT) + public void setPositionAndRotationDirect(double x, double y, double z, float yw, float pt, int inc, boolean t) {} + + @Override + protected void handleStallInformation(float x, float y, float z, float angle) { + setPos(x, y, z); + clientOffsetDiff = 0; + } + + @Override + public ContraptionRotationState getRotationState() { + return ContraptionRotationState.NONE; + } + + public void updateClientMotion() { + float modifier = movementAxis.getAxisDirection() + .getOffset(); + setContraptionMotion(new Vec3d(movementAxis.getDirectionVec()) + .scale((axisMotion + clientOffsetDiff * modifier / 2f) * ServerSpeedProvider.get())); + } + + public double getAxisCoord() { + Vec3d anchorVec = getAnchorVec(); + return movementAxis.getAxis() + .getCoordinate(anchorVec.x, anchorVec.y, anchorVec.z); + } + + public void sendPacket() { + AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this), + new GantryContraptionUpdatePacket(getEntityId(), getAxisCoord(), axisMotion)); + } + + @OnlyIn(Dist.CLIENT) + public static void handlePacket(GantryContraptionUpdatePacket packet) { + Entity entity = Minecraft.getInstance().world.getEntityByID(packet.entityID); + if (!(entity instanceof GantryContraptionEntity)) + return; + GantryContraptionEntity ce = (GantryContraptionEntity) entity; + ce.axisMotion = packet.motion; + ce.clientOffsetDiff = packet.coord - ce.getAxisCoord(); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntityRenderer.java new file mode 100644 index 000000000..b7eafa361 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntityRenderer.java @@ -0,0 +1,18 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntityRenderer; + +import net.minecraft.client.renderer.entity.EntityRendererManager; + +public class GantryContraptionEntityRenderer extends AbstractContraptionEntityRenderer { + + public GantryContraptionEntityRenderer(EntityRendererManager p_i46179_1_) { + super(p_i46179_1_); + } + + @Override + protected void transform(GantryContraptionEntity contraptionEntity, float partialTicks, + MatrixStack[] matrixStacks) {} + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java new file mode 100644 index 000000000..1e0637497 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionUpdatePacket.java @@ -0,0 +1,46 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import java.util.function.Supplier; + +import com.simibubi.create.foundation.networking.SimplePacketBase; + +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.network.NetworkEvent.Context; + +public class GantryContraptionUpdatePacket extends SimplePacketBase { + + int entityID; + double coord; + double motion; + + public GantryContraptionUpdatePacket(int entityID, double coord, double motion) { + this.entityID = entityID; + this.coord = coord; + this.motion = motion; + } + + public GantryContraptionUpdatePacket(PacketBuffer buffer) { + entityID = buffer.readInt(); + coord = buffer.readFloat(); + motion = buffer.readFloat(); + } + + @Override + public void write(PacketBuffer buffer) { + buffer.writeInt(entityID); + buffer.writeFloat((float) coord); + buffer.writeFloat((float) motion); + } + + @Override + public void handle(Supplier context) { + context.get() + .enqueueWork( + () -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> GantryContraptionEntity.handlePacket(this))); + context.get() + .setPacketHandled(true); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java new file mode 100644 index 000000000..5f8874bcf --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java @@ -0,0 +1,121 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; +import com.simibubi.create.content.contraptions.base.IRotate; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; +import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.Iterate; + +import net.minecraft.block.Block; +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.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; + +public class GantryPinionBlock extends DirectionalAxisKineticBlock implements ITE { + + public GantryPinionBlock(Properties properties) { + super(properties); + } + + @Override + public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) { + Direction direction = state.get(FACING); + BlockState shaft = world.getBlockState(pos.offset(direction.getOpposite())); + return AllBlocks.GANTRY_SHAFT.has(shaft) && shaft.get(GantryShaftBlock.FACING) + .getAxis() != direction.getAxis(); + } + + @Override + public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + super.onBlockAdded(state, worldIn, pos, oldState, isMoving); + withTileEntityDo(worldIn, pos, GantryPinionTileEntity::checkValidGantryShaft); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return AllTileEntities.GANTRY_PINION.create(); + } + + @Override + protected Direction getFacingForPlacement(BlockItemUseContext context) { + return context.getFace(); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockState stateForPlacement = super.getStateForPlacement(context); + Direction opposite = stateForPlacement.get(FACING) + .getOpposite(); + return cycleAxisIfNecessary(stateForPlacement, opposite, context.getWorld() + .getBlockState(context.getPos() + .offset(opposite))); + } + + @Override + public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_, BlockPos p_220069_5_, + boolean p_220069_6_) { + if (!isValidPosition(state, world, pos)) + world.destroyBlock(pos, true); + } + + @Override + public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState otherState, IWorld world, + BlockPos pos, BlockPos p_196271_6_) { + if (state.get(FACING) != direction.getOpposite()) + return state; + return cycleAxisIfNecessary(state, direction, otherState); + } + + protected BlockState cycleAxisIfNecessary(BlockState state, Direction direction, BlockState otherState) { + if (!AllBlocks.GANTRY_SHAFT.has(otherState)) + return state; + if (otherState.get(GantryShaftBlock.FACING) + .getAxis() == direction.getAxis()) + return state; + if (isValidGantryShaftAxis(state, otherState)) + return state; + return state.cycle(AXIS_ALONG_FIRST_COORDINATE); + } + + public static boolean isValidGantryShaftAxis(BlockState pinionState, BlockState gantryState) { + return getValidGantryShaftAxis(pinionState) == gantryState.get(GantryShaftBlock.FACING) + .getAxis(); + } + + public static Axis getValidGantryShaftAxis(BlockState state) { + if (!(state.getBlock() instanceof GantryPinionBlock)) + return Axis.Y; + IRotate block = (IRotate) state.getBlock(); + Axis rotationAxis = block.getRotationAxis(state); + Axis facingAxis = state.get(FACING) + .getAxis(); + for (Axis axis : Iterate.axes) + if (axis != rotationAxis && axis != facingAxis) + return axis; + return Axis.Y; + } + + public static Axis getValidGantryPinionAxis(BlockState state, Axis shaftAxis) { + Axis facingAxis = state.get(FACING) + .getAxis(); + for (Axis axis : Iterate.axes) + if (axis != shaftAxis && axis != facingAxis) + return axis; + return Axis.Y; + } + + @Override + public Class getTileEntityClass() { + return GantryPinionTileEntity.class; + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java new file mode 100644 index 000000000..86a498d12 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java @@ -0,0 +1,78 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.MatrixStacker; + +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Direction.AxisDirection; +import net.minecraft.util.math.BlockPos; + +public class GantryPinionRenderer extends KineticTileEntityRenderer { + + public GantryPinionRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + + @Override + protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { + super.renderSafe(te, partialTicks, ms, buffer, light, overlay); + BlockState state = te.getBlockState(); + Direction facing = state.get(GantryPinionBlock.FACING); + Boolean alongFirst = state.get(GantryPinionBlock.AXIS_ALONG_FIRST_COORDINATE); + Axis rotationAxis = getRotationAxisOf(te); + BlockPos visualPos = facing.getAxisDirection() == AxisDirection.POSITIVE ? te.getPos() + : te.getPos() + .offset(facing.getOpposite()); + float angleForTe = getAngleForTe(te, visualPos, rotationAxis); + + Axis gantryAxis = Axis.X; + for (Axis axis : Iterate.axes) + if (axis != rotationAxis && axis != facing.getAxis()) + gantryAxis = axis; + + if (gantryAxis == Axis.Z) + if (facing == Direction.DOWN) + angleForTe *= -1; + if (gantryAxis == Axis.Y) + if (facing == Direction.NORTH || facing == Direction.EAST) + angleForTe *= -1; + + ms.push(); + + MatrixStacker msr = MatrixStacker.of(ms); + + msr.centre() + .rotateY(AngleHelper.horizontalAngle(facing)) + .rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90) + .rotateY(alongFirst ^ facing.getAxis() == Axis.Z ? 90 : 0); + + ms.translate(0, -9 / 16f, 0); + ms.multiply(Vector3f.POSITIVE_X.getRadialQuaternion(-angleForTe / 2f)); + ms.translate(0, 9 / 16f, 0); + + msr.unCentre(); + AllBlockPartials.GANTRY_COGS.renderOn(state) + .light(light) + .renderInto(ms, buffer.getBuffer(RenderType.getSolid())); + + ms.pop(); + } + + @Override + protected BlockState getRenderedBlockState(KineticTileEntity te) { + return shaft(getRotationAxisOf(te)); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionTileEntity.java new file mode 100644 index 000000000..3c2b6f437 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionTileEntity.java @@ -0,0 +1,138 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.gantry; + +import static net.minecraft.state.properties.BlockStateProperties.FACING; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; +import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity; + +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; + +public class GantryPinionTileEntity extends KineticTileEntity { + + boolean assembleNextTick; + + public GantryPinionTileEntity(TileEntityType typeIn) { + super(typeIn); + } + + @Override + public void onSpeedChanged(float previousSpeed) { + super.onSpeedChanged(previousSpeed); + } + + public void checkValidGantryShaft() { + if (shouldAssemble()) + queueAssembly(); + } + + public void queueAssembly() { + assembleNextTick = true; + } + + @Override + public void tick() { + super.tick(); + + if (world.isRemote) + return; + + if (assembleNextTick) { + tryAssemble(); + assembleNextTick = false; + } + } + + private void tryAssemble() { + BlockState blockState = getBlockState(); + if (!(blockState.getBlock() instanceof GantryPinionBlock)) + return; + + Direction direction = blockState.get(FACING); + GantryContraption contraption = new GantryContraption(direction); + + TileEntity shaftTe = world.getTileEntity(pos.offset(direction.getOpposite())); + if (!(shaftTe instanceof GantryShaftTileEntity)) + return; + BlockState shaftState = shaftTe.getBlockState(); + if (!AllBlocks.GANTRY_SHAFT.has(shaftState)) + return; + + float pinionMovementSpeed = ((GantryShaftTileEntity) shaftTe).getPinionMovementSpeed(); + Direction shaftOrientation = shaftState.get(GantryShaftBlock.FACING); + Direction movementDirection = shaftOrientation; + if (pinionMovementSpeed < 0) + movementDirection = movementDirection.getOpposite(); + + if (!contraption.assemble(world, pos)) + return; + if (ContraptionCollider.isCollidingWithWorld(world, contraption, pos.offset(movementDirection), + movementDirection)) + return; + + contraption.removeBlocksFromWorld(world, BlockPos.ZERO); + GantryContraptionEntity movedContraption = + GantryContraptionEntity.create(world, contraption, shaftOrientation); + BlockPos anchor = pos; + movedContraption.setPosition(anchor.getX(), anchor.getY(), anchor.getZ()); + world.addEntity(movedContraption); + } + + @Override + public float propagateRotationTo(KineticTileEntity target, BlockState stateFrom, BlockState stateTo, BlockPos diff, + boolean connectedViaAxes, boolean connectedViaCogs) { + float defaultModifier = + super.propagateRotationTo(target, stateFrom, stateTo, diff, connectedViaAxes, connectedViaCogs); + + if (connectedViaAxes) + return defaultModifier; + if (!AllBlocks.GANTRY_SHAFT.has(stateTo)) + return defaultModifier; + if (!stateTo.get(GantryShaftBlock.POWERED)) + return defaultModifier; + + Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); + if (stateFrom.get(GantryPinionBlock.FACING) != direction.getOpposite()) + return defaultModifier; + return getGantryPinionModifier(stateTo.get(GantryShaftBlock.FACING), stateFrom.get(GantryPinionBlock.FACING)); + } + + public static float getGantryPinionModifier(Direction shaft, Direction pinionDirection) { + Axis shaftAxis = shaft.getAxis(); + float directionModifier = shaft.getAxisDirection() + .getOffset(); + if (shaftAxis == Axis.Y) + if (pinionDirection == Direction.NORTH || pinionDirection == Direction.EAST) + return -directionModifier; + if (shaftAxis == Axis.X) + if (pinionDirection == Direction.DOWN || pinionDirection == Direction.SOUTH) + return -directionModifier; + if (shaftAxis == Axis.Z) + if (pinionDirection == Direction.UP || pinionDirection == Direction.WEST) + return -directionModifier; + return directionModifier; + } + + private boolean shouldAssemble() { + BlockState blockState = getBlockState(); + if (!(blockState.getBlock() instanceof GantryPinionBlock)) + return false; + Direction facing = blockState.get(GantryPinionBlock.FACING) + .getOpposite(); + BlockState shaftState = world.getBlockState(pos.offset(facing)); + if (!(shaftState.getBlock() instanceof GantryShaftBlock)) + return false; + if (shaftState.get(GantryShaftBlock.POWERED)) + return false; + TileEntity te = world.getTileEntity(pos.offset(facing)); + return te instanceof GantryShaftTileEntity && ((GantryShaftTileEntity) te).canAssembleOn(); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java index 3d6a28dd8..8386ae8f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java @@ -7,7 +7,7 @@ import java.util.List; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.AllBlocks; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode; import com.simibubi.create.foundation.utility.Iterate; @@ -47,8 +47,8 @@ public class MountedContraption extends Contraption { } @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.MOUNTED; + protected ContraptionType getType() { + return ContraptionType.MOUNTED; } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java index 603f5b5e6..c60e181a3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java @@ -154,7 +154,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme compound.putBoolean("Waiting", waitingForSpeedChange); compound.putFloat("Offset", offset); super.write(compound, clientPacket); - + if (clientPacket && forceMove) { compound.putBoolean("ForceMovement", forceMove); forceMove = false; @@ -247,7 +247,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme } public float getMovementSpeed() { - float movementSpeed = getSpeed() / 512f + clientOffsetDiff / 2f; + float movementSpeed = MathHelper.clamp(getSpeed() / 512f, -.49f, .49f) + clientOffsetDiff / 2f; if (world.isRemote) movementSpeed *= ServerSpeedProvider.get(); return movementSpeed; @@ -283,7 +283,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme public boolean isAttachedTo(AbstractContraptionEntity contraption) { return movedContraption == contraption; } - + @Override public BlockPos getBlockPosition() { return pos; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java index f84a04b97..a24d004fe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java @@ -112,7 +112,7 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity { @Override public float getMovementSpeed() { - float movementSpeed = getSpeed() / 512f; + float movementSpeed = MathHelper.clamp(getSpeed() / 512f, -.49f, .49f); if (world.isRemote) movementSpeed *= ServerSpeedProvider.get(); Direction pistonDirection = getBlockState().get(BlockStateProperties.FACING); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java index 2895fb9bd..bcca6e574 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.piston; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits; import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; @@ -38,8 +38,8 @@ public class PistonContraption extends TranslatingContraption { private boolean retract; @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.PISTON; + protected ContraptionType getType() { + return ContraptionType.PISTON; } public PistonContraption() {} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java index d4a48a889..d12cecad5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pulley; -import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption; import net.minecraft.nbt.CompoundNBT; @@ -12,8 +12,8 @@ public class PulleyContraption extends TranslatingContraption { int initialOffset; @Override - protected AllContraptionTypes getType() { - return AllContraptionTypes.PULLEY; + protected ContraptionType getType() { + return ContraptionType.PULLEY; } public PulleyContraption() {} diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java new file mode 100644 index 000000000..d231d00be --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java @@ -0,0 +1,236 @@ +package com.simibubi.create.content.contraptions.relays.advanced; + +import java.util.ArrayList; +import java.util.List; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllShapes; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.Lang; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemUseContext; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.IProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.IStringSerializable; +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.IWorld; +import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; + +public class GantryShaftBlock extends DirectionalKineticBlock { + + public static final IProperty PART = EnumProperty.create("part", Part.class); + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + + public enum Part implements IStringSerializable { + START, MIDDLE, END, SINGLE; + + @Override + public String getName() { + return Lang.asId(name()); + } + } + + @Override + protected void fillStateContainer(Builder builder) { + super.fillStateContainer(builder.add(PART, POWERED)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, + ISelectionContext p_220053_4_) { + return AllShapes.EIGHT_VOXEL_POLE.get(state.get(FACING) + .getAxis()); + } + + @Override + public BlockRenderType getRenderType(BlockState state) { + return BlockRenderType.ENTITYBLOCK_ANIMATED; + } + + @Override + public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState neighbour, IWorld world, + BlockPos pos, BlockPos neighbourPos) { + Direction facing = state.get(FACING); + Axis axis = facing.getAxis(); + if (direction.getAxis() != axis) + return state; + boolean connect = AllBlocks.GANTRY_SHAFT.has(neighbour) && neighbour.get(FACING) == facing; + + Part part = state.get(PART); + if (direction.getAxisDirection() == facing.getAxisDirection()) { + if (connect) { + if (part == Part.END) + part = Part.MIDDLE; + if (part == Part.SINGLE) + part = Part.START; + } else { + if (part == Part.MIDDLE) + part = Part.END; + if (part == Part.START) + part = Part.SINGLE; + } + } else { + if (connect) { + if (part == Part.START) + part = Part.MIDDLE; + if (part == Part.SINGLE) + part = Part.END; + } else { + if (part == Part.MIDDLE) + part = Part.START; + if (part == Part.END) + part = Part.SINGLE; + } + } + + return state.with(PART, part); + } + + public GantryShaftBlock(Properties properties) { + super(properties); + setDefaultState(getDefaultState().with(POWERED, false) + .with(PART, Part.SINGLE)); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockState state = super.getStateForPlacement(context); + Direction face = context.getFace(); + BlockState blockState = context.getWorld() + .getBlockState(context.getPos() + .offset(face.getOpposite())); + if (AllBlocks.GANTRY_SHAFT.has(blockState) && blockState.get(FACING) + .getAxis() == face.getAxis()) { + Direction facing = blockState.get(FACING); + state = state.with(FACING, context.getPlayer() == null || !context.getPlayer() + .isSneaking() ? facing : facing.getOpposite()); + } + return state.with(POWERED, shouldBePowered(state, context.getWorld(), context.getPos())); + } + + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + ActionResultType onWrenched = super.onWrenched(state, context); + if (onWrenched.isAccepted()) { + BlockPos pos = context.getPos(); + World world = context.getWorld(); + neighborChanged(world.getBlockState(pos), world, pos, state.getBlock(), pos, false); + } + return onWrenched; + } + + @Override + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block p_220069_4_, BlockPos p_220069_5_, + boolean p_220069_6_) { + if (worldIn.isRemote) + return; + boolean previouslyPowered = state.get(POWERED); + boolean shouldPower = worldIn.isBlockPowered(pos); // shouldBePowered(state, worldIn, pos); + + if (!previouslyPowered && !shouldPower && shouldBePowered(state, worldIn, pos)) { + worldIn.setBlockState(pos, state.with(POWERED, true), 3); + return; + } + + if (previouslyPowered == shouldPower) + return; + + // Collect affected gantry shafts + List toUpdate = new ArrayList<>(); + Direction facing = state.get(FACING); + Axis axis = facing.getAxis(); + for (Direction d : Iterate.directionsInAxis(axis)) { + BlockPos currentPos = pos.offset(d); + while (true) { + if (!worldIn.isBlockPresent(currentPos)) + break; + BlockState currentState = worldIn.getBlockState(currentPos); + if (!(currentState.getBlock() instanceof GantryShaftBlock)) + break; + if (currentState.get(FACING) != facing) + break; + if (!shouldPower && currentState.get(POWERED) && worldIn.isBlockPowered(currentPos)) + return; + if (currentState.get(POWERED) == shouldPower) + break; + toUpdate.add(currentPos); + currentPos = currentPos.offset(d); + } + } + + toUpdate.add(pos); + for (BlockPos blockPos : toUpdate) { + BlockState blockState = worldIn.getBlockState(blockPos); + + if (!shouldPower) { + TileEntity te = worldIn.getTileEntity(blockPos); + if (te instanceof KineticTileEntity) + ((KineticTileEntity) te).detachKinetics(); + } + + if (blockState.getBlock() instanceof GantryShaftBlock) + worldIn.setBlockState(blockPos, blockState.with(POWERED, shouldPower), 2); + } + } + + protected boolean shouldBePowered(BlockState state, World worldIn, BlockPos pos) { + boolean shouldPower = worldIn.isBlockPowered(pos); + + Direction facing = state.get(FACING); + for (Direction d : Iterate.directionsInAxis(facing.getAxis())) { + BlockPos neighbourPos = pos.offset(d); + if (!worldIn.isBlockPresent(neighbourPos)) + continue; + BlockState neighbourState = worldIn.getBlockState(neighbourPos); + if (!(neighbourState.getBlock() instanceof GantryShaftBlock)) + continue; + if (neighbourState.get(FACING) != facing) + continue; + shouldPower |= neighbourState.get(POWERED); + } + + return shouldPower; + } + + @Override + public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { + return face.getAxis() == state.get(FACING) + .getAxis(); + } + + @Override + public Axis getRotationAxis(BlockState state) { + return state.get(FACING) + .getAxis(); + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return AllTileEntities.GANTRY_SHAFT.create(); + } + + @Override + protected boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState newState) { + return super.areStatesKineticallyEquivalent(oldState, newState) + && oldState.get(POWERED) == newState.get(POWERED); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java new file mode 100644 index 000000000..338123dc8 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java @@ -0,0 +1,103 @@ +package com.simibubi.create.content.contraptions.relays.advanced; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryPinionTileEntity; +import com.simibubi.create.foundation.utility.Iterate; + +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; + +public class GantryShaftTileEntity extends KineticTileEntity { + + public GantryShaftTileEntity(TileEntityType typeIn) { + super(typeIn); + } + + @Override + public void onSpeedChanged(float previousSpeed) { + super.onSpeedChanged(previousSpeed); + + if (!canAssembleOn()) + return; + for (Direction d : Iterate.directions) { + if (d.getAxis() == getBlockState().get(GantryShaftBlock.FACING) + .getAxis()) + continue; + BlockPos offset = pos.offset(d); + BlockState pinionState = world.getBlockState(offset); + if (!AllBlocks.GANTRY_PINION.has(pinionState)) + continue; + if (pinionState.get(GantryPinionBlock.FACING) != d) + continue; + TileEntity tileEntity = world.getTileEntity(offset); + if (tileEntity instanceof GantryPinionTileEntity) + ((GantryPinionTileEntity) tileEntity).queueAssembly(); + } + + } + + @Override + public float propagateRotationTo(KineticTileEntity target, BlockState stateFrom, BlockState stateTo, BlockPos diff, + boolean connectedViaAxes, boolean connectedViaCogs) { + float defaultModifier = + super.propagateRotationTo(target, stateFrom, stateTo, diff, connectedViaAxes, connectedViaCogs); + + if (connectedViaAxes) + return defaultModifier; + if (!stateFrom.get(GantryShaftBlock.POWERED)) + return defaultModifier; + if (!AllBlocks.GANTRY_PINION.has(stateTo)) + return defaultModifier; + + Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); + if (stateTo.get(GantryPinionBlock.FACING) != direction) + return defaultModifier; + return GantryPinionTileEntity.getGantryPinionModifier(stateFrom.get(GantryShaftBlock.FACING), + stateTo.get(GantryPinionBlock.FACING)); + } + + @Override + public boolean isCustomConnection(KineticTileEntity other, BlockState state, BlockState otherState) { + if (!AllBlocks.GANTRY_PINION.has(otherState)) + return false; + final BlockPos diff = other.getPos() + .subtract(pos); + Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); + return otherState.get(GantryPinionBlock.FACING) == direction; + } + + public boolean canAssembleOn() { + BlockState blockState = getBlockState(); + if (!AllBlocks.GANTRY_SHAFT.has(blockState)) + return false; + if (blockState.get(GantryShaftBlock.POWERED)) + return false; + float speed = getPinionMovementSpeed(); + + switch (blockState.get(GantryShaftBlock.PART)) { + case END: + return speed < 0; + case MIDDLE: + return speed != 0; + case START: + return speed > 0; + case SINGLE: + default: + return false; + } + } + + public float getPinionMovementSpeed() { + BlockState blockState = getBlockState(); + if (!AllBlocks.GANTRY_SHAFT.has(blockState)) + return 0; + return MathHelper.clamp(-getSpeed() / 512f, -.49f, .49f); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java index 3341651f4..2974f2a3a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java @@ -68,6 +68,11 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen withTileEntityDo(worldIn, pos, SequencedGearshiftTileEntity::onRedstoneUpdate); } + @Override + protected boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState newState) { + return false; + } + @Override public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { if (state.get(VERTICAL)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java index 3da812121..4d09a55d0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java @@ -87,6 +87,12 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE addPropagationLocations(IRotate block, BlockState state, List neighbours) { + if (!AllBlocks.LARGE_COGWHEEL.has(state)) + return super.addPropagationLocations(block, state, neighbours); + + BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) + .forEach(offset -> { + if (offset.distanceSq(0, 0, 0, false) == BlockPos.ZERO.distanceSq(1, 1, 0, false)) + neighbours.add(pos.add(offset)); + }); + return neighbours; + } + } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyBlock.java index 9627a008f..7cb0e02b7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyBlock.java @@ -36,6 +36,7 @@ public class AdjustablePulleyBlock extends EncasedBeltBlock implements ITE r.setActive(false)); active = false; markDirty(); diff --git a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java new file mode 100644 index 000000000..f8b612b61 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java @@ -0,0 +1,90 @@ +package com.simibubi.create.content.schematics.filtering; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +import javax.annotation.Nullable; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.simibubi.create.content.schematics.SchematicWorld; +import com.simibubi.create.content.schematics.item.SchematicItem; +import com.simibubi.create.foundation.utility.Debug; +import com.simibubi.create.foundation.utility.WorldAttached; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.template.PlacementSettings; +import net.minecraft.world.gen.feature.template.Template; + +public class SchematicInstances { + + public static WorldAttached> loadedSchematics; + + static { + loadedSchematics = new WorldAttached<>(() -> CacheBuilder.newBuilder() + .expireAfterAccess(5, TimeUnit.MINUTES) + .build()); + } + + public static void register() {} + + @Nullable + public static SchematicWorld get(World world, ItemStack schematic) { + Cache map = loadedSchematics.get(world); + int hash = getHash(schematic); + try { + return map.get(hash, () -> loadWorld(world, schematic)); + } catch (ExecutionException e) { + e.printStackTrace(); + } + return null; + } + + private static SchematicWorld loadWorld(World wrapped, ItemStack schematic) { + if (schematic == null || !schematic.hasTag()) + return null; + if (!schematic.getTag() + .getBoolean("Deployed")) + return null; + + Template activeTemplate = SchematicItem.loadSchematic(schematic); + + if (activeTemplate.getSize() + .equals(BlockPos.ZERO)) + return null; + + BlockPos anchor = NBTUtil.readBlockPos(schematic.getTag() + .getCompound("Anchor")); + SchematicWorld world = new SchematicWorld(anchor, wrapped); + PlacementSettings settings = SchematicItem.getSettings(schematic); + activeTemplate.addBlocksToWorld(world, anchor, settings); + + Debug.debugChat("Loading Schematic Instance of " + schematic.getTag() + .getString("File") + ". Total active instances: " + (loadedSchematics.get(wrapped).size() + 1)); + + + return world; + } + + public static void clearHash(ItemStack schematic) { + if (schematic == null || !schematic.hasTag()) + return; + schematic.getTag() + .remove("SchematicHash"); + } + + public static int getHash(ItemStack schematic) { + if (schematic == null || !schematic.hasTag()) + return -1; + CompoundNBT tag = schematic.getTag(); + if (!tag.contains("SchematicHash")) + tag.putInt("SchematicHash", tag.toString() + .hashCode()); + return tag.getInt("SchematicHash"); + } + +} diff --git a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java index 2ddf14b10..71bad1d97 100644 --- a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java @@ -13,6 +13,7 @@ import org.apache.commons.io.IOUtils; import com.simibubi.create.AllItems; import com.simibubi.create.content.schematics.client.SchematicEditScreen; +import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.utility.Lang; @@ -87,6 +88,7 @@ public class SchematicItem extends Item { Template t = loadSchematic(blueprint); tag.put("Bounds", NBTUtil.writeBlockPos(t.getSize())); blueprint.setTag(tag); + SchematicInstances.clearHash(blueprint); } public static PlacementSettings getSettings(ItemStack blueprint) { diff --git a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java index 1e7c6f861..030f66a93 100644 --- a/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java +++ b/src/main/java/com/simibubi/create/content/schematics/packet/SchematicSyncPacket.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.schematics.packet; import java.util.function.Supplier; import com.simibubi.create.AllItems; +import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.entity.player.ServerPlayerEntity; @@ -70,6 +71,7 @@ public class SchematicSyncPacket extends SimplePacketBase { tag.put("Anchor", NBTUtil.writeBlockPos(anchor)); tag.putString("Rotation", rotation.name()); tag.putString("Mirror", mirror.name()); + SchematicInstances.clearHash(stack); }); context.get().setPacketHandled(true); } diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 498d58552..0463ca346 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -317,6 +317,23 @@ public class StandardRecipeGen extends CreateRecipeProvider { .patternLine("P") .patternLine("A") .patternLine("P")), + + GANTRY_PINION = create(AllBlocks.GANTRY_PINION).unlockedBy(I::andesiteCasing) + .viaShaped(b -> b.key('B', ItemTags.PLANKS) + .key('S', I.cog()) + .key('C', I.andesiteCasing()) + .key('I', I.shaft()) + .patternLine(" B ") + .patternLine("ICI") + .patternLine(" S ")), + + GANTRY_SHAFT = create(AllBlocks.GANTRY_SHAFT).returns(8) + .unlockedBy(I::andesite) + .viaShaped(b -> b.key('A', I.andesite()) + .key('R', I.redstone()) + .patternLine("A") + .patternLine("R") + .patternLine("A")), ANALOG_LEVER = create(AllBlocks.ANALOG_LEVER).unlockedBy(I::andesite) .viaShaped(b -> b.key('S', I.andesiteCasing()) diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index 94222fb36..0b5790915 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -7,6 +7,7 @@ import java.util.function.Supplier; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionDisassemblyPacket; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket; +import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryContraptionUpdatePacket; import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionFluidPacket; @@ -79,6 +80,7 @@ public enum AllPackets { MINECART_CONTROLLER(MinecartControllerUpdatePacket.class, MinecartControllerUpdatePacket::new), FLUID_SPLASH(FluidSplashPacket.class, FluidSplashPacket::new), CONTRAPTION_FLUID(ContraptionFluidPacket.class, ContraptionFluidPacket::new), + GANTRY_UPDATE(GantryContraptionUpdatePacket.class, GantryContraptionUpdatePacket::new), ; diff --git a/src/main/resources/assets/create/models/block/gantry_pinion/horizontal.json b/src/main/resources/assets/create/models/block/gantry_pinion/horizontal.json new file mode 100644 index 000000000..a35a3b443 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_pinion/horizontal.json @@ -0,0 +1,153 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "8": "create:block/bearing_top_wooden", + "9": "create:block/windmill_bearing_side", + "10": "create:block/pinion", + "particle": "create:block/andesite_casing", + "opening": "create:block/gearbox" + }, + "elements": [ + { + "name": "Bottom", + "from": [0, 0, 0], + "to": [16, 16, 4], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#8"}, + "east": {"uv": [0, 0, 16, 4], "rotation": 270, "texture": "#9"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#8"}, + "west": {"uv": [0, 0, 16, 4], "rotation": 90, "texture": "#9"}, + "up": {"uv": [0, 8, 16, 12], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0, 8, 16, 12], "texture": "#10"} + } + }, + { + "name": "Bottom", + "from": [6, 0, -4], + "to": [10, 16, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 6]}, + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 12, 10, 16], "rotation": 180, "texture": "#10"}, + "down": {"uv": [6, 12, 10, 16], "texture": "#10"} + } + }, + { + "name": "Bottom", + "from": [0, 6, -4], + "to": [16, 10, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 6]}, + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "east": {"uv": [10, 12, 14, 16], "rotation": 270, "texture": "#10"}, + "west": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#10"}, + "up": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "name": "Core", + "from": [1, 1, 2], + "to": [15, 15, 12], + "faces": { + "north": {"uv": [0, 0, 0, 0], "rotation": 90, "texture": "#opening"}, + "east": {"uv": [1, 4, 15, 14], "rotation": 270, "texture": "#opening"}, + "south": {"uv": [0, 0, 0, 0], "rotation": 90, "texture": "#opening"}, + "west": {"uv": [1, 4, 15, 14], "rotation": 90, "texture": "#opening"}, + "up": {"uv": [0, 0, 0, 0], "rotation": 180, "texture": "#opening"}, + "down": {"uv": [0, 0, 0, 0], "texture": "#opening"} + } + }, + { + "name": "Top", + "from": [0, 0, 12], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#8"}, + "east": {"uv": [0, 0, 16, 4], "rotation": 270, "texture": "#9"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#8"}, + "west": {"uv": [0, 0, 16, 4], "rotation": 90, "texture": "#9"}, + "up": {"uv": [0, 0, 16, 4], "rotation": 180, "texture": "#9"}, + "down": {"uv": [0, 0, 16, 4], "texture": "#9"} + } + }, + { + "name": "SideWest", + "from": [0, 14, 4], + "to": [16, 16, 12], + "faces": { + "east": {"uv": [14, 0, 16, 8], "rotation": 270, "texture": "#10"}, + "west": {"uv": [0, 0, 2, 8], "rotation": 90, "texture": "#10"}, + "up": {"uv": [0, 0, 16, 8], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0, 0, 16, 8], "texture": "#10"} + } + }, + { + "name": "SideEast", + "from": [0, 0, 4], + "to": [16, 2, 12], + "faces": { + "east": {"uv": [0, 0, 2, 8], "rotation": 270, "texture": "#10"}, + "west": {"uv": [14, 0, 16, 8], "rotation": 90, "texture": "#10"}, + "up": {"uv": [0, 0, 16, 8], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0, 0, 16, 8], "texture": "#10"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, 2.25, 0], + "scale": [0.45, 0.45, 0.45] + } + }, + "groups": [ + { + "name": "item_andesite", + "origin": [8, 8, 8], + "children": [] + }, + { + "name": "item", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_pinion/item.json b/src/main/resources/assets/create/models/block/gantry_pinion/item.json new file mode 100644 index 000000000..1e2349978 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_pinion/item.json @@ -0,0 +1,346 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "3": "create:block/cogwheel", + "8": "create:block/bearing_top_wooden", + "9": "create:block/windmill_bearing_side", + "10": "create:block/pinion", + "11": "create:block/axis_top", + "particle": "create:block/andesite_casing", + "opening": "create:block/gearbox" + }, + "elements": [ + { + "name": "Gear", + "from": [10.5, -10, 6.5], + "to": [13.5, 8, 9.5], + "rotation": {"angle": -22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear2", + "from": [10.5, -2.5, -1], + "to": [13.5, 0.5, 17], + "rotation": {"angle": 22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 180, "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear3", + "from": [10.5, -10, 6.5], + "to": [13.5, 8, 9.5], + "rotation": {"angle": 22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear4", + "from": [10.5, -2.5, -1], + "to": [13.5, 0.5, 17], + "rotation": {"angle": -22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseInner", + "from": [11, -7, 2], + "to": [13, 5, 14], + "rotation": {"angle": -22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 7], "rotation": 90, "texture": "#3"}, + "east": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "west": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseOuter", + "from": [10, -5, 4], + "to": [14, 3, 12], + "rotation": {"angle": -22.5, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [0, 4, 4, 6], "rotation": 90, "texture": "#3"}, + "east": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "west": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear", + "from": [2.5, -10, 6.5], + "to": [5.5, 8, 9.5], + "rotation": {"angle": -22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear3", + "from": [2.5, -2.5, -1], + "to": [5.5, 0.5, 17], + "rotation": {"angle": 22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 180, "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear4", + "from": [2.5, -10, 6.5], + "to": [5.5, 8, 9.5], + "rotation": {"angle": 22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear5", + "from": [2.5, -2.5, -1], + "to": [5.5, 0.5, 17], + "rotation": {"angle": -22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseInner", + "from": [3, -7, 2], + "to": [5, 5, 14], + "rotation": {"angle": -22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 7], "rotation": 90, "texture": "#3"}, + "east": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "west": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseOuter", + "from": [2, -5, 4], + "to": [6, 3, 12], + "rotation": {"angle": -22.5, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [0, 4, 4, 6], "rotation": 90, "texture": "#3"}, + "east": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "west": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Bottom", + "from": [0, 0, 0], + "to": [16, 4, 16], + "faces": { + "north": {"uv": [0, 8, 16, 12], "texture": "#10"}, + "east": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "south": {"uv": [0, 8, 16, 12], "texture": "#10"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "up": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#8"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#8"} + } + }, + { + "name": "Bottom", + "from": [6, -4, 0], + "to": [10, 0, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 6, 8]}, + "faces": { + "north": {"uv": [6, 12, 10, 16], "texture": "#10"}, + "east": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "south": {"uv": [6, 12, 10, 16], "texture": "#10"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "texture": "#0"} + } + }, + { + "name": "Bottom", + "from": [0, -4, 6], + "to": [16, 0, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 6, 8]}, + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "east": {"uv": [10, 12, 14, 16], "texture": "#10"}, + "south": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "west": {"uv": [6, 12, 10, 16], "texture": "#10"}, + "down": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "name": "Core", + "from": [1, 2, 1], + "to": [15, 12, 15], + "faces": { + "north": {"uv": [0, 0, 0, 0], "texture": "#opening"}, + "east": {"uv": [1, 4, 15, 14], "texture": "#opening"}, + "south": {"uv": [0, 0, 0, 0], "texture": "#opening"}, + "west": {"uv": [1, 4, 15, 14], "texture": "#opening"}, + "up": {"uv": [0, 0, 0, 0], "rotation": 90, "texture": "#opening"}, + "down": {"uv": [0, 0, 0, 0], "rotation": 270, "texture": "#opening"} + } + }, + { + "name": "Top", + "from": [0, 12, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "east": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "south": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#9"}, + "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#8"}, + "down": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#8"} + } + }, + { + "name": "SideWest", + "from": [0, 4, 0], + "to": [16, 12, 2], + "faces": { + "north": {"uv": [0, 0, 16, 8], "texture": "#10"}, + "east": {"uv": [14, 0, 16, 8], "texture": "#10"}, + "south": {"uv": [0, 0, 16, 8], "texture": "#10"}, + "west": {"uv": [0, 0, 2, 8], "texture": "#10"} + } + }, + { + "name": "SideEast", + "from": [0, 4, 14], + "to": [16, 12, 16], + "faces": { + "north": {"uv": [0, 0, 16, 8], "texture": "#10"}, + "east": {"uv": [0, 0, 2, 8], "texture": "#10"}, + "south": {"uv": [0, 0, 16, 8], "texture": "#10"}, + "west": {"uv": [14, 0, 16, 8], "texture": "#10"} + } + }, + { + "name": "Axis", + "from": [0, 6, 6], + "to": [16, 10, 10], + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "east": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#11"}, + "south": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "west": {"uv": [6, 6, 10, 10], "texture": "#11"}, + "up": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 135, 0], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, 2.25, 0], + "scale": [0.45, 0.45, 0.45] + } + }, + "groups": [ + { + "name": "cogwheel_shaftless", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5] + }, + { + "name": "cogwheel_shaftless", + "origin": [8, 8, 8], + "children": [6, 7, 8, 9, 10, 11] + }, + { + "name": "item_andesite", + "origin": [8, 8, 8], + "children": [] + }, + { + "name": "item", + "origin": [8, 8, 8], + "children": [12, 13, 14, 15, 16, 17, 18, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [19] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_pinion/vertical.json b/src/main/resources/assets/create/models/block/gantry_pinion/vertical.json new file mode 100644 index 000000000..9c7ed51bf --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_pinion/vertical.json @@ -0,0 +1,153 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "8": "create:block/bearing_top_wooden", + "9": "create:block/windmill_bearing_side", + "10": "create:block/pinion", + "particle": "create:block/andesite_casing", + "opening": "create:block/gearbox" + }, + "elements": [ + { + "name": "Bottom", + "from": [0, 0, 0], + "to": [16, 16, 4], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#8"}, + "east": {"uv": [0, 8, 16, 12], "rotation": 270, "texture": "#10"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#8"}, + "west": {"uv": [0, 8, 16, 12], "rotation": 90, "texture": "#10"}, + "up": {"uv": [0, 0, 16, 4], "rotation": 180, "texture": "#9"}, + "down": {"uv": [0, 0, 16, 4], "texture": "#9"} + } + }, + { + "name": "Bottom", + "from": [0, 6, -4], + "to": [16, 10, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 6]}, + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "east": {"uv": [6, 12, 10, 16], "rotation": 270, "texture": "#10"}, + "west": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#10"}, + "up": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"}, + "down": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"} + } + }, + { + "name": "Bottom", + "from": [6, 0, -4], + "to": [10, 16, 0], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 6]}, + "faces": { + "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "up": {"uv": [10, 12, 14, 16], "rotation": 180, "texture": "#10"}, + "down": {"uv": [6, 12, 10, 16], "texture": "#10"} + } + }, + { + "name": "Core", + "from": [1, 1, 2], + "to": [15, 15, 12], + "faces": { + "north": {"uv": [0, 0, 0, 0], "rotation": 180, "texture": "#opening"}, + "east": {"uv": [0, 0, 0, 0], "rotation": 270, "texture": "#opening"}, + "south": {"uv": [0, 0, 0, 0], "texture": "#opening"}, + "west": {"uv": [0, 0, 0, 0], "rotation": 90, "texture": "#opening"}, + "up": {"uv": [1, 4, 15, 14], "rotation": 180, "texture": "#opening"}, + "down": {"uv": [1, 4, 15, 14], "texture": "#opening"} + } + }, + { + "name": "Top", + "from": [0, 0, 12], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#8"}, + "east": {"uv": [0, 0, 16, 4], "rotation": 270, "texture": "#9"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#8"}, + "west": {"uv": [0, 0, 16, 4], "rotation": 90, "texture": "#9"}, + "up": {"uv": [0, 0, 16, 4], "rotation": 180, "texture": "#9"}, + "down": {"uv": [0, 0, 16, 4], "texture": "#9"} + } + }, + { + "name": "SideWest", + "from": [0, 0, 4], + "to": [2, 16, 12], + "faces": { + "east": {"uv": [0, 0, 16, 8], "rotation": 270, "texture": "#10"}, + "west": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#10"}, + "up": {"uv": [14, 0, 16, 8], "rotation": 180, "texture": "#10"}, + "down": {"uv": [0, 0, 2, 8], "texture": "#10"} + } + }, + { + "name": "SideEast", + "from": [14, 0, 4], + "to": [16, 16, 12], + "faces": { + "east": {"uv": [0, 0, 16, 8], "rotation": 270, "texture": "#10"}, + "west": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#10"}, + "up": {"uv": [0, 0, 2, 8], "rotation": 180, "texture": "#10"}, + "down": {"uv": [14, 0, 16, 8], "texture": "#10"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, 2.25, 0], + "scale": [0.45, 0.45, 0.45] + } + }, + "groups": [ + { + "name": "item_andesite", + "origin": [8, 8, 8], + "children": [] + }, + { + "name": "item", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_pinion/wheels.json b/src/main/resources/assets/create/models/block/gantry_pinion/wheels.json new file mode 100644 index 000000000..7c54b4893 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_pinion/wheels.json @@ -0,0 +1,224 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "3": "create:block/cogwheel", + "particle": "create:block/andesite_casing" + }, + "elements": [ + { + "name": "Gear", + "from": [10.5, -10, 6.5], + "to": [13.5, 8, 9.5], + "rotation": {"angle": 0, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear2", + "from": [10.5, -2.5, -1], + "to": [13.5, 0.5, 17], + "rotation": {"angle": 45, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 180, "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear3", + "from": [10.5, -10, 6.5], + "to": [13.5, 8, 9.5], + "rotation": {"angle": 45, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear4", + "from": [10.5, -2.5, -1], + "to": [13.5, 0.5, 17], + "rotation": {"angle": 0, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseInner", + "from": [11, -7, 2], + "to": [13, 5, 14], + "rotation": {"angle": 0, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 7], "rotation": 90, "texture": "#3"}, + "east": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "west": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseOuter", + "from": [10, -5, 4], + "to": [14, 3, 12], + "rotation": {"angle": 0, "axis": "x", "origin": [12, -1, 8]}, + "faces": { + "north": {"uv": [0, 4, 4, 6], "rotation": 90, "texture": "#3"}, + "east": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "west": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear", + "from": [2.5, -10, 6.5], + "to": [5.5, 8, 9.5], + "rotation": {"angle": 0, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear3", + "from": [2.5, -2.5, -1], + "to": [5.5, 0.5, 17], + "rotation": {"angle": 45, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 180, "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear4", + "from": [2.5, -10, 6.5], + "to": [5.5, 8, 9.5], + "rotation": {"angle": 45, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [7, 7.5, 16, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "south": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "rotation": 270, "texture": "#3"}, + "up": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "Gear5", + "from": [2.5, -2.5, -1], + "to": [5.5, 0.5, 17], + "rotation": {"angle": 0, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [5.5, 7.5, 7, 9], "rotation": 90, "texture": "#3"}, + "east": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "south": {"uv": [5.5, 7.5, 7, 9], "rotation": 270, "texture": "#3"}, + "west": {"uv": [7, 6, 16, 7.5], "texture": "#3"}, + "up": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"}, + "down": {"uv": [7, 7.5, 16, 9], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseInner", + "from": [3, -7, 2], + "to": [5, 5, 14], + "rotation": {"angle": 0, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [0, 6, 6, 7], "rotation": 90, "texture": "#3"}, + "east": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "west": {"uv": [4, 0, 10, 6], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 6, 6, 7], "rotation": 270, "texture": "#3"} + } + }, + { + "name": "GearCaseOuter", + "from": [2, -5, 4], + "to": [6, 3, 12], + "rotation": {"angle": 0, "axis": "x", "origin": [4, -1, 8]}, + "faces": { + "north": {"uv": [0, 4, 4, 6], "rotation": 90, "texture": "#3"}, + "east": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "west": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"}, + "down": {"uv": [0, 4, 4, 6], "rotation": 270, "texture": "#3"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, 2.25, 0], + "scale": [0.45, 0.45, 0.45] + } + }, + "groups": [ + { + "name": "cogwheel_shaftless", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5] + }, + { + "name": "cogwheel_shaftless", + "origin": [8, 8, 8], + "children": [6, 7, 8, 9, 10, 11] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json new file mode 100644 index 000000000..a459fd12b --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json @@ -0,0 +1,69 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "1": "create:block/axis_top", + "2": "create:block/gantry_shaft", + "3": "create:block/cogwheel", + "particle": "#2" + }, + "elements": [ + { + "from": [4, 11, 4], + "to": [12, 14, 12], + "faces": { + "north": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "east": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "south": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "west": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 0, 4, 4], "texture": "#3"}, + "down": {"uv": [0, 0, 4, 4], "rotation": 180, "texture": "#3"} + } + }, + { + "from": [5, 0, 5], + "to": [11, 11, 11], + "shade": false, + "faces": { + "north": {"uv": [8, 5, 14, 16], "texture": "#2"}, + "east": {"uv": [2, 5, 8, 16], "texture": "#2"}, + "south": {"uv": [4, 5, 10, 16], "texture": "#2"}, + "west": {"uv": [6, 5, 12, 16], "texture": "#2"} + } + }, + { + "name": "Axis", + "from": [6, 0, 6], + "to": [10, 16, 10], + "shade": false, + "faces": { + "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "south": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#1"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "rack", + "origin": [8, 8, 8], + "children": [ + { + "name": "end", + "origin": [8, 8, 8], + "children": [0, 1, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [2] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_middle.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_middle.json new file mode 100644 index 000000000..8d4416d92 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_middle.json @@ -0,0 +1,40 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "2": "create:block/gantry_shaft", + "particle": "#2" + }, + "elements": [ + { + "from": [5, 0, 5], + "to": [11, 16, 11], + "shade": false, + "faces": { + "north": {"uv": [0, 0, 6, 16], "texture": "#2"}, + "east": {"uv": [2, 0, 8, 16], "texture": "#2"}, + "south": {"uv": [4, 0, 10, 16], "texture": "#2"}, + "west": {"uv": [6, 0, 12, 16], "texture": "#2"} + } + } + ], + "groups": [ + { + "name": "rack", + "origin": [8, 8, 8], + "children": [ + { + "name": "middle", + "origin": [8, 8, 8], + "children": [0, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json new file mode 100644 index 000000000..cccb1fd78 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json @@ -0,0 +1,103 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "1": "create:block/axis_top", + "2": "create:block/gantry_shaft", + "3": "create:block/cogwheel", + "particle": "#2" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [12, 5, 12], + "faces": { + "north": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "east": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "west": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "up": {"uv": [0, 0, 4, 4], "rotation": 180, "texture": "#3"}, + "down": {"uv": [0, 0, 4, 4], "texture": "#3"} + } + }, + { + "name": "Axis", + "from": [6, 0, 6], + "to": [10, 16, 10], + "shade": false, + "faces": { + "north": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "south": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#1"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#1"} + } + }, + { + "from": [4, 11, 4], + "to": [12, 14, 12], + "faces": { + "north": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "east": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "south": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "west": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "up": {"uv": [0, 0, 4, 4], "rotation": 180, "texture": "#3"}, + "down": {"uv": [0, 0, 4, 4], "texture": "#3"} + } + }, + { + "from": [5, 5, 5], + "to": [11, 11, 11], + "shade": false, + "faces": { + "north": {"uv": [4, 5, 10, 11], "rotation": 180, "texture": "#2"}, + "east": {"uv": [3, 5, 9, 11], "rotation": 180, "texture": "#2"}, + "south": {"uv": [0, 5, 6, 11], "rotation": 180, "texture": "#2"}, + "west": {"uv": [6, 5, 12, 11], "rotation": 180, "texture": "#2"} + } + } + ], + "groups": [ + { + "name": "rack", + "origin": [8, 8, 8], + "children": [ + { + "name": "end", + "origin": [8, 8, 8], + "children": [0, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [] + } + ] + }, + { + "name": "middle", + "origin": [8, 8, 8], + "children": [ + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [1] + } + ] + }, + { + "name": "start", + "origin": [8, 8, 8], + "children": [2, 3, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json new file mode 100644 index 000000000..b77bfceba --- /dev/null +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json @@ -0,0 +1,69 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/axis", + "1": "create:block/axis_top", + "2": "create:block/gantry_shaft", + "3": "create:block/cogwheel", + "particle": "#2" + }, + "elements": [ + { + "from": [4, 2, 4], + "to": [12, 5, 12], + "faces": { + "north": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "east": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "south": {"uv": [14.5, 0, 16, 4], "rotation": 90, "texture": "#3"}, + "west": {"uv": [14.5, 0, 16, 4], "rotation": 270, "texture": "#3"}, + "up": {"uv": [0, 0, 4, 4], "texture": "#3"}, + "down": {"uv": [0, 0, 4, 4], "rotation": 180, "texture": "#3"} + } + }, + { + "from": [5, 5, 5], + "to": [11, 16, 11], + "shade": false, + "faces": { + "north": {"uv": [0, 0, 6, 11], "texture": "#2"}, + "east": {"uv": [2, 0, 8, 11], "texture": "#2"}, + "south": {"uv": [4, 0, 10, 11], "texture": "#2"}, + "west": {"uv": [6, 0, 12, 11], "texture": "#2"} + } + }, + { + "name": "Axis", + "from": [6, 0, 6], + "to": [10, 16, 10], + "shade": false, + "faces": { + "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "south": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "west": {"uv": [6, 0, 10, 16], "texture": "#0"}, + "up": {"uv": [6, 6, 10, 10], "texture": "#1"}, + "down": {"uv": [6, 6, 10, 10], "texture": "#1"} + } + } + ], + "groups": [ + { + "name": "rack", + "origin": [8, 8, 8], + "children": [ + { + "name": "start", + "origin": [8, 8, 8], + "children": [0, 1, + { + "name": "shaft", + "origin": [8, 8, 8], + "children": [2] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/cogwheel.png b/src/main/resources/assets/create/textures/block/cogwheel.png index 944bb51a6e7221cc5617e0394489302f45b3eb8c..bf3cd5cf9cb290a0a607335c009587ba15cd68c9 100644 GIT binary patch delta 357 zcmdnU@|9_VWIZzj1B1(wu46!ou{g-xiDBJ2nU_EgOS+@4BLl<6e(pbstU$hWfKP~P zL6BZmlnIa*<)V`4truz~-;`)o5^4YxIqo0&6G(BE1o;L3hXRIR{|X_HV1Y+uF#`kN zVGw3Kp1&dmD0t4(#WBR9-v8~yNWMb`Jgm7#J!}698=v-kFG7mMOPDTNuO zTDGouDtkf9w0U>#yz+@_pT@PvKYQpsd7Fov%+kakdzkC)JY!swf1q*NzZ1dh8T2o# tE*Cpl{kGu#!N?+Y`&ay1>KIPcFm$XEUG1?dqY>yg22WQ%mvv4FO#n1Uk2e4S delta 547 zcmV+;0^I%e0;8Gi-<0047(dh`GQ0r*KoK~z{r?N+-^!$1%`OC*k>C`J?!h=wnS zD5&@aIwTsp`~d|O1qB5)e?UjcXHZe`6G#*wN0F5WlF^(s(Rgj=VT5RWmG5qEcXoDe z&%xFCFzt5Qjw6}Q9q0JQz+Bgt#?JY5J68F7czz4iKDfC&Nq^ttq7xV$L>Vv!*I)#N z{dneF6lOp*5v*fikBQtrz2*Uc0UGk~Y?k=XqrvVnLu*4@bxyFB5d~NP00xj5j3!^P zKilfIascRnAP6uFyUSP#gp6WMfrHUf21sKS0PZ8O2DNj7puMFZ^HK(g*k(ozU>|#n zWRYWt^TYk9pnn6^3t1>-Kt)IZI^UWk6K*EZx=s*axcWrx|ERtZKJgm*8%6>Ps-4Wq<9s6K3sH=lXs7_~KjX^~G`8 zZtZyc&v=q+IICy}YkN`8n~W!k3kZOR7)-(F9y9zc0K}OuzFqENSSJ|W2Y`MryMA>T zs09E)6$Ajl5#N$c5?~2x0YJ~tAo|}>^;%j``fLOERwb|u)DQ002ovPDHLkV1oKG_0RwS diff --git a/src/main/resources/assets/create/textures/block/gantry_shaft.png b/src/main/resources/assets/create/textures/block/gantry_shaft.png new file mode 100644 index 0000000000000000000000000000000000000000..b11a4a8d6ade7ea9c2155a90e07c2754b400bf52 GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}T0G|+7MFs`~23Bh}ZZ!r5RR#ttRxWd9b`1sw6$S=n1_pB`_I+)W*?@{U z3p^r=85sEXgD|57YcNm&Ly)J7V~9p@@416Q4GJ8t7o}%K{r`W^mU&fXaNfBF1OA9J zJwZ=jZA<$SopbA}{Gy*5SKf0@ir>mzy6WebH|c#>KL1@l@&E6>GynH3eh~NbNS%G}T0G|+7MFs`~23Bh}ZgVDf6$S=11_o6I26JY1WuO@h3|6dMyDk(70Tpu= zctjR6Fz_7&Va6R3v)=**13g_FLo|Zt_Brx3IB+oU4vo0}-#$X?#L@1LCcHcg8Q9E| z@@Kg#&2G^4m7267_J-$+cPCEzo`}-U6-?G@jlHsc^SjCSt4-o<5B<9M_@|)l8U1um VrqdVJSA%S1@O1TaS?83{1ON@>LU8~9 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/gantry_shaft_powered.png b/src/main/resources/assets/create/textures/block/gantry_shaft_powered.png new file mode 100644 index 0000000000000000000000000000000000000000..b3111e74ae16faabab85e71ae5f405615fd2808b GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}H0G|-oIDY;He*Ovk{F(gxsr>x?{QO<~{CWKRiTwOM{QQa>thzvzoCO|{ z#S9F52SJ!|$HeTnKtVrG7sn8d;NEiwg&Gt%TrWyby7vEn!TE-bvAZmp57|60FrIbV z_|07j?;NWy^A}a_54o?obG;SI{H%R7zo#mHP5PhxEdPGs&;R8ntZ(i#+9%~Q_2oWq RRREgI;OXk;vd$@?2>_zIN4Wq1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/gantry_shaft_powered_flipped.png b/src/main/resources/assets/create/textures/block/gantry_shaft_powered_flipped.png new file mode 100644 index 0000000000000000000000000000000000000000..4e7c55ddb2e51f47fc8c1d9afca88d9989b17eec GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}H0G|-oIDY;He*Ovk{5|~qsr>wz{QO<~{E7VhdHnqS{QUo;ua*K;au#?* z7BevL9Ry*<9TT(P0tJIST^vI+g6H-*3N;vTFbB6p{r{gRyf9{u#XK|S(*g{K`I^lS z&pb1$LED#G&-F@Qnb0ol;!gsbu6actnc=mi`&Zf3+E3N}&sMXqmAC!I|BYimqk|t) V)gGSzqCnFbJYD@<);T3K0RV5YMW_G( literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/pinion.png b/src/main/resources/assets/create/textures/block/pinion.png new file mode 100644 index 0000000000000000000000000000000000000000..68c43c3e607d9d30137ffbc79b654f263925e1ad GIT binary patch literal 514 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%Lh?0X`wF$!W=L9qoQ*GOiC$;ChB%L>zPO4gcVuLwtPrOZAG-(_$WcIW z;mgx!K+3Qr$S?RmiGV?VmY*U}GiQNEWHAE+-$4*&+%YlxEl_Z`r;B5VMzCv7V_%bj zfXjAn5$&j@4MBbvt#w!Hl)wC6Klk?O*qW0mlct|x&^V%_U$XPmS*g{$2f}XO-M4LP zcFt;1hLUFmZ~lHLeAO;CIUv1SMqkP8{;O5Z>n@%9-uyjW(CuWq({uNFsdbN!&eZeW zuui&qL+)d{ZruaR4jKK{5(qah)_eLzZrPFeR%@0jj^G8$ulO)_Oi!Js{wOnUTE1Gs zKfy^JXL&w~i*^Jh{SiMh<&&6>(