From 0231b32866a4d574c030dc728a3d55f3505a90eb Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 28 Nov 2020 21:12:31 +0100 Subject: [PATCH 1/6] Someone get those damn mine carts under control!! --- src/generated/resources/.cache/cache | 29 +- .../create/blockstates/controller_rail.json | 724 ++++++++++++++++++ .../assets/create/blockstates/fluid_pipe.json | 22 +- .../resources/assets/create/lang/en_ud.json | 1 + .../resources/assets/create/lang/en_us.json | 1 + .../assets/create/lang/unfinished/de_de.json | 3 +- .../assets/create/lang/unfinished/fr_fr.json | 3 +- .../assets/create/lang/unfinished/it_it.json | 3 +- .../assets/create/lang/unfinished/ja_jp.json | 3 +- .../assets/create/lang/unfinished/ko_kr.json | 3 +- .../assets/create/lang/unfinished/nl_nl.json | 3 +- .../assets/create/lang/unfinished/pt_br.json | 3 +- .../assets/create/lang/unfinished/ru_ru.json | 3 +- .../assets/create/lang/unfinished/zh_cn.json | 3 +- .../create/models/item/controller_rail.json | 6 + .../loot_tables/blocks/controller_rail.json | 19 + .../data/minecraft/tags/blocks/rails.json | 3 +- .../java/com/simibubi/create/AllBlocks.java | 11 + .../tracks/ControllerRailBlock.java | 166 ++++ .../create/foundation/data/BlockStateGen.java | 44 ++ .../block_ascending_north_analog.json | 6 + .../block_ascending_north_off.json | 6 + .../block_ascending_north_on.json | 6 + .../block_ascending_south_analog.json | 6 + .../block_ascending_south_off.json | 6 + .../block_ascending_south_on.json | 6 + .../block_north_south_analog.json | 6 + .../block_north_south_off.json | 6 + .../controller_rail/block_north_south_on.json | 6 + .../textures/block/controller_rail_analog.png | Bin 0 -> 336 bytes .../textures/block/controller_rail_off.png | Bin 0 -> 331 bytes .../textures/block/controller_rail_on.png | Bin 0 -> 342 bytes 32 files changed, 1073 insertions(+), 34 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/controller_rail.json create mode 100644 src/generated/resources/assets/create/models/item/controller_rail.json create mode 100644 src/generated/resources/data/create/loot_tables/blocks/controller_rail.json create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json create mode 100644 src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json create mode 100644 src/main/resources/assets/create/textures/block/controller_rail_analog.png create mode 100644 src/main/resources/assets/create/textures/block/controller_rail_off.png create mode 100644 src/main/resources/assets/create/textures/block/controller_rail_on.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 7e6225ab8..f1e064766 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -49,6 +49,7 @@ b59324f051f21d8ce1a48a08f4721a61a3c414d6 assets/create/blockstates/chute.json 1f33834c685e3243882acfe20183fe64dfa872be assets/create/blockstates/clutch.json e5e3757e99c139d67b2a70288466d8a74d818841 assets/create/blockstates/cogwheel.json 36f54136a7756c97f71bc6b47ef4e8e575e72879 assets/create/blockstates/content_observer.json +c309aead7e052aef770baebfb4d0e65dfd257b66 assets/create/blockstates/controller_rail.json f8eff64c75fc599e9a44a003f54ae9931cd8ce7c assets/create/blockstates/copper_block.json cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets/create/blockstates/copper_casing.json 3355a852cdc717e257ca19b3db836068964733e3 assets/create/blockstates/copper_ore.json @@ -137,7 +138,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -fe9169716dd21a81a3710a89f0a9b7ea4dcd4d51 assets/create/blockstates/fluid_pipe.json +3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json @@ -393,17 +394,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 -67f9a92292948241e01ce6043445b2b3ddcf5350 assets/create/lang/en_ud.json -64119d621b012cb67a88a72297cfbe64e276bd76 assets/create/lang/en_us.json -276e7bf74972ab6a32ffa1fcc91bb8adbfca7a45 assets/create/lang/unfinished/de_de.json -37cda56935f196f3c531afb0bf001c0ba56053c6 assets/create/lang/unfinished/fr_fr.json -96592f7ce4ed4ede69c3f42b5870d1b805f1fc23 assets/create/lang/unfinished/it_it.json -84b5c9d2586f1dd4067cdb60568420d151589e7f assets/create/lang/unfinished/ja_jp.json -4171adac242132ab5b8da5d362eeb6b9fae03213 assets/create/lang/unfinished/ko_kr.json -6798dd2c517ad9a201175fdbba5108b346478a44 assets/create/lang/unfinished/nl_nl.json -8c9358acc37b949dfc8c15fc750fd6f13a8104a3 assets/create/lang/unfinished/pt_br.json -fff47b09b35b20294dbc814fceb05430c2eec9af assets/create/lang/unfinished/ru_ru.json -c1481426852c9a0e651342ecaea541aa300a5168 assets/create/lang/unfinished/zh_cn.json +458ea82f1528fc105ae5511619a8673dbd71101f assets/create/lang/en_ud.json +0b031873dee4854906c42ca74431796809529979 assets/create/lang/en_us.json +e0edef1fd82761c99556a8f9f968817c9d00a389 assets/create/lang/unfinished/de_de.json +80bd81070645f36dc5a4a3355985b68aadee932c assets/create/lang/unfinished/fr_fr.json +74e0f3f8635be43ae96f199374d95b2e4b467c46 assets/create/lang/unfinished/it_it.json +d2d2239b0c6a750a0aa0cb9fc6e190522202b5e7 assets/create/lang/unfinished/ja_jp.json +71a75e1739dea9a0d26a6c3cb07c9c1f5e3bcd00 assets/create/lang/unfinished/ko_kr.json +036ace865f424c6d38330a5dda3783df6fc9feac assets/create/lang/unfinished/nl_nl.json +53dddb1c29cf6739750567350c89f7ae01cda588 assets/create/lang/unfinished/pt_br.json +03d1bf6e868f87fe27704acdde55e75f5101acd9 assets/create/lang/unfinished/ru_ru.json +72c0f7e67c59b4e3f13c348d007044d86afb7e75 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 @@ -1157,6 +1158,7 @@ c1da21be9f1af4f7a2ef4ec9cd92195d65ada316 assets/create/models/item/clockwork_bea 0a2a0f0aafeab0088172f77afd40c1fa2cc1f2b8 assets/create/models/item/clutch.json dcb09deae110077bcddf090996b51cc66e9a7de3 assets/create/models/item/cogwheel.json 7717e3b21cff39f497f07687c70c1fa40eaa756d assets/create/models/item/content_observer.json +17a8889e54d6e82fd1a6eec9e87c46feba903cb1 assets/create/models/item/controller_rail.json 965a90a882d85dba93b30af9bce7ecf8e68ce747 assets/create/models/item/copper_block.json 759bcb5fe7dfdd628716f9b4ff19a5ab00393381 assets/create/models/item/copper_casing.json c5bcfba46f5824654dedaa2c5d5f42deb29e3baf assets/create/models/item/copper_ingot.json @@ -2196,6 +2198,7 @@ adde89e46b12de1eee6fd0c5cb98c5f45feefc15 data/create/loot_tables/blocks/chiseled d76113310fc56eca6382d44df174096f2210d416 data/create/loot_tables/blocks/clutch.json 673ba3a5deae9133b917d16c9eb87fe4c2873c8a data/create/loot_tables/blocks/cogwheel.json 096af6b5df6e87d36cb936eea9b00982a554f4af data/create/loot_tables/blocks/content_observer.json +80c2cb21714651116a71f449368c06bb22e841ce data/create/loot_tables/blocks/controller_rail.json f38802b919c49f162f102d6e5d94113f05bf4ab1 data/create/loot_tables/blocks/copper_block.json 5a65a18ea787130ac7b8f5652bfa5ed187446649 data/create/loot_tables/blocks/copper_casing.json 31a51237763c374b7cdf39b9b62c14e965871047 data/create/loot_tables/blocks/copper_ore.json @@ -3316,7 +3319,7 @@ ff1900963bc4cd8ceffa78d58ef1952ceacb2fb7 data/forge/tags/items/storage_blocks/br f6c8f34ceb475546dba5cc6ff288863ea795d20b data/forge/tags/items/storage_blocks/copper.json 7f71a774800111e50b42de0e6159ed2d2a807d32 data/forge/tags/items/storage_blocks/zinc.json 31424fe956db0354a9f24c61baf977a2961c8db6 data/minecraft/tags/blocks/impermeable.json -9dadc647e17b6262c13b6d8eda9139e30ce7e7d0 data/minecraft/tags/blocks/rails.json +378b01e288301e0835d3d25167889077a2070780 data/minecraft/tags/blocks/rails.json 29e6f7e3d4be9a9b0af1fca5d32fa55e29905ce2 data/minecraft/tags/blocks/slabs.json 0d188ad2c33d10ee8f0d455c4e63a4460a8302fb data/minecraft/tags/blocks/stairs.json 92584f914c53e00c111f9ff5e3894e2e3594946b data/minecraft/tags/blocks/walls.json diff --git a/src/generated/resources/assets/create/blockstates/controller_rail.json b/src/generated/resources/assets/create/blockstates/controller_rail.json new file mode 100644 index 000000000..65f6ee81b --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/controller_rail.json @@ -0,0 +1,724 @@ +{ + "variants": { + "backwards=false,power=0,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_off" + }, + "backwards=true,power=0,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 180 + }, + "backwards=false,power=1,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=1,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=2,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=2,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=3,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=3,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=4,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=4,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=5,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=5,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=6,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=6,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=7,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=7,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=8,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=8,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=9,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=9,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=10,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=10,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=11,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=11,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=12,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=12,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=13,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=13,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=14,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=14,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=15,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_on" + }, + "backwards=true,power=15,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 180 + }, + "backwards=false,power=0,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 270 + }, + "backwards=true,power=0,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 90 + }, + "backwards=false,power=1,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=1,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=2,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=2,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=3,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=3,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=4,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=4,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=5,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=5,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=6,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=6,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=7,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=7,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=8,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=8,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=9,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=9,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=10,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=10,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=11,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=11,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=12,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=12,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=13,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=13,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=14,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=14,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=15,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 270 + }, + "backwards=true,power=15,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 90 + }, + "backwards=false,power=0,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 90 + }, + "backwards=true,power=0,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 270 + }, + "backwards=false,power=1,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=1,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=2,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=2,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=3,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=3,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=4,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=4,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=5,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=5,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=6,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=6,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=7,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=7,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=8,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=8,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=9,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=9,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=10,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=10,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=11,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=11,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=12,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=12,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=13,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=13,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=14,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=14,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=15,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 90 + }, + "backwards=true,power=15,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 270 + }, + "backwards=false,power=0,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 270 + }, + "backwards=true,power=0,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 90 + }, + "backwards=false,power=1,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=1,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=2,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=2,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=3,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=3,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=4,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=4,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=5,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=5,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=6,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=6,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=7,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=7,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=8,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=8,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=9,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=9,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=10,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=10,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=11,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=11,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=12,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=12,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=13,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=13,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=14,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=14,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=15,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 270 + }, + "backwards=true,power=15,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 90 + }, + "backwards=false,power=0,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_off" + }, + "backwards=true,power=0,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 180 + }, + "backwards=false,power=1,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=1,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=2,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=2,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=3,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=3,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=4,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=4,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=5,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=5,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=6,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=6,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=7,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=7,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=8,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=8,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=9,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=9,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=10,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=10,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=11,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=11,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=12,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=12,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=13,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=13,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=14,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=14,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=15,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_on" + }, + "backwards=true,power=15,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 180 + }, + "backwards=false,power=0,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 180 + }, + "backwards=true,power=0,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_off" + }, + "backwards=false,power=1,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=1,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=2,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=2,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=3,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=3,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=4,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=4,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=5,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=5,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=6,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=6,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=7,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=7,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=8,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=8,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=9,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=9,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=10,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=10,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=11,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=11,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=12,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=12,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=13,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=13,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=14,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=14,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=15,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 180 + }, + "backwards=true,power=15,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_on" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index 3b646b920..a4cffcde7 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -303,8 +303,8 @@ { "when": { "west": "false", - "east": "true", "down": "false", + "east": "true", "up": "true" }, "apply": { @@ -314,8 +314,8 @@ { "when": { "west": "true", - "east": "false", "down": "false", + "east": "false", "up": "true" }, "apply": { @@ -325,8 +325,8 @@ { "when": { "west": "false", - "east": "true", "down": "true", + "east": "true", "up": "false" }, "apply": { @@ -336,8 +336,8 @@ { "when": { "west": "true", - "east": "false", "down": "true", + "east": "false", "up": "false" }, "apply": { @@ -347,8 +347,8 @@ { "when": { "west": "false", - "east": "false", "down": "true", + "east": "false", "up": "true" }, "apply": { @@ -358,8 +358,8 @@ { "when": { "west": "false", - "east": "false", "down": "false", + "east": "false", "up": "true" }, "apply": { @@ -369,8 +369,8 @@ { "when": { "west": "false", - "east": "false", "down": "true", + "east": "false", "up": "false" }, "apply": { @@ -380,8 +380,8 @@ { "when": { "west": "true", - "east": "true", "down": "false", + "east": "true", "up": "false" }, "apply": { @@ -391,8 +391,8 @@ { "when": { "west": "false", - "east": "true", "down": "false", + "east": "true", "up": "false" }, "apply": { @@ -402,8 +402,8 @@ { "when": { "west": "true", - "east": "false", "down": "false", + "east": "false", "up": "false" }, "apply": { @@ -413,8 +413,8 @@ { "when": { "west": "false", - "east": "false", "down": "false", + "east": "false", "up": "false" }, "apply": { diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index a98ffe1fb..d85a1a98e 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -50,6 +50,7 @@ "block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186", "block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186", "block.create.content_observer": "\u0279\u01DD\u028C\u0279\u01DDsqO \u0287u\u01DD\u0287uo\u0186", + "block.create.controller_rail": "\u05DF\u0131\u0250\u1D1A \u0279\u01DD\u05DF\u05DFo\u0279\u0287uo\u0186", "block.create.copper_block": "\u029E\u0254o\u05DF\u15FA \u0279\u01DDddo\u0186", "block.create.copper_casing": "bu\u0131s\u0250\u0186 \u0279\u01DDddo\u0186", "block.create.copper_ore": "\u01DD\u0279O \u0279\u01DDddo\u0186", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index d5687e841..de6eeee0f 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -53,6 +53,7 @@ "block.create.clutch": "Clutch", "block.create.cogwheel": "Cogwheel", "block.create.content_observer": "Content Observer", + "block.create.controller_rail": "Controller Rail", "block.create.copper_block": "Copper Block", "block.create.copper_casing": "Copper Casing", "block.create.copper_ore": "Copper Ore", 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 7f8d73ee7..aaea64458 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: 1050", + "_": "Missing Localizations: 1051", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Kupplung", "block.create.cogwheel": "Zahnrad", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "UNLOCALIZED: Copper Block", "block.create.copper_casing": "UNLOCALIZED: Copper Casing", "block.create.copper_ore": "UNLOCALIZED: Copper Ore", 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 28e47b355..4ac7ff1cc 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: 680", + "_": "Missing Localizations: 681", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Embrayage", "block.create.cogwheel": "Roue dentée", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "Bloc de cuivre", "block.create.copper_casing": "Boîtier en cuivre", "block.create.copper_ore": "Minerai de cuivre", 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 3560dd163..ef2891eb0 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: 664", + "_": "Missing Localizations: 665", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Frizione", "block.create.cogwheel": "Ruota Dentata", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "Blocco di Rame", "block.create.copper_casing": "Involucro di Rame", "block.create.copper_ore": "Rame Grezzo", 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 305b933c1..e86ba2f46 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: 663", + "_": "Missing Localizations: 664", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "クラッチ", "block.create.cogwheel": "歯車", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "銅ブロック", "block.create.copper_casing": "銅ケーシング", "block.create.copper_ore": "銅鉱石", 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 d043a647f..cd047bf0d 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: 664", + "_": "Missing Localizations: 665", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "클러치", "block.create.cogwheel": "톱나버퀴", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "구리 블럭", "block.create.copper_casing": "구리 케이스", "block.create.copper_ore": "구리 광석", 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 549c4cda9..11f631734 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: 991", + "_": "Missing Localizations: 992", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Koppeling", "block.create.cogwheel": "Tandwiel", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "UNLOCALIZED: Copper Block", "block.create.copper_casing": "UNLOCALIZED: Copper Casing", "block.create.copper_ore": "UNLOCALIZED: Copper Ore", 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 85ce6c924..8af150962 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: 1057", + "_": "Missing Localizations: 1058", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Embreagem", "block.create.cogwheel": "Roda Dentada", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "UNLOCALIZED: Copper Block", "block.create.copper_casing": "UNLOCALIZED: Copper Casing", "block.create.copper_ore": "UNLOCALIZED: Copper Ore", 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 6a6b3474c..80ae82a39 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: 333", + "_": "Missing Localizations: 334", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "Сцепление", "block.create.cogwheel": "Шестерня", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "Медный блок", "block.create.copper_casing": "Медный корпус", "block.create.copper_ore": "Медная руда", 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 d4245aa75..09b9dbaac 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: 346", + "_": "Missing Localizations: 347", "_": "->------------------------] Game Elements [------------------------<-", @@ -54,6 +54,7 @@ "block.create.clutch": "离合器", "block.create.cogwheel": "齿轮", "block.create.content_observer": "UNLOCALIZED: Content Observer", + "block.create.controller_rail": "UNLOCALIZED: Controller Rail", "block.create.copper_block": "铜块", "block.create.copper_casing": "铜机壳", "block.create.copper_ore": "铜矿石", diff --git a/src/generated/resources/assets/create/models/item/controller_rail.json b/src/generated/resources/assets/create/models/item/controller_rail.json new file mode 100644 index 000000000..3524bff1a --- /dev/null +++ b/src/generated/resources/assets/create/models/item/controller_rail.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json b/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json new file mode 100644 index 000000000..d68ce3cec --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:controller_rail" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/rails.json b/src/generated/resources/data/minecraft/tags/blocks/rails.json index c75102c53..9f6c12628 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/rails.json +++ b/src/generated/resources/data/minecraft/tags/blocks/rails.json @@ -2,6 +2,7 @@ "replace": false, "values": [ "create:cart_assembler", - "create:reinforced_rail" + "create:reinforced_rail", + "create:controller_rail" ] } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index c4861f26c..f904a9e07 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -61,6 +61,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonHeadBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock; +import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.components.turntable.TurntableBlock; import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock; @@ -735,6 +736,16 @@ public class AllBlocks { .build() .register(); + public static final BlockEntry CONTROLLER_RAIL = + REGISTRATE.block("controller_rail", ControllerRailBlock::new) + .initialProperties(() -> Blocks.POWERED_RAIL) + .blockstate(BlockStateGen.controllerRail()) + .addLayer(() -> RenderType::getCutoutMipped) + .tag(BlockTags.RAILS) + .item() + .model((c, p) -> p.generated(c, Create.asResource("block/controller_rail_analog"))) + .build().register(); + public static final BlockEntry MINECART_ANCHOR = REGISTRATE.block("minecart_anchor", MinecartAnchorBlock::new) .initialProperties(SharedProperties::stone) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java new file mode 100644 index 000000000..6149efd59 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -0,0 +1,166 @@ +package com.simibubi.create.content.contraptions.components.tracks; + +import com.simibubi.create.foundation.utility.VecHelper; +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.block.AbstractRailBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.state.*; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.state.properties.RailShape; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import javax.annotation.ParametersAreNonnullByDefault; + +import static net.minecraft.state.properties.RailShape.*; + + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@SuppressWarnings("deprecation") +public class ControllerRailBlock extends AbstractRailBlock { + public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; + public static final IntegerProperty POWERED = BlockStateProperties.POWER_0_15; + public static final BooleanProperty BACKWARDS = BooleanProperty.create("backwards"); + + public ControllerRailBlock(Properties p_i48444_2_) { + super(true, p_i48444_2_); + this.setDefaultState(this.stateContainer.getBaseState().with(POWERED, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); + } + + @Override + public IProperty getShapeProperty() { + return SHAPE; + } + + protected void fillStateContainer(StateContainer.Builder p_206840_1_) { + p_206840_1_.add(SHAPE, POWERED, BACKWARDS); + } + + public Vec3d getAccelerationVector(BlockState state) { + RailShape shape = state.get(SHAPE); + boolean backwards = state.get(BACKWARDS); + Vec3d base = new Vec3d(shape == ASCENDING_EAST ? 1 : (shape == EAST_WEST || shape == ASCENDING_WEST ? -1 : 0), + 0, shape == ASCENDING_SOUTH ? 1 : (shape == ASCENDING_NORTH || shape == NORTH_SOUTH ? -1 : 0)); + return base.scale(backwards ? -1 : 1); + } + + @Override + public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) { + if (world.isRemote) + return; + Vec3d accelerationVec = getAccelerationVector(state); + double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWERED) / 15.; + if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) { + cart.setMotion(accelerationVec.scale(targetSpeed)); + } else { + decelerateCart(pos, cart); + } + } + + private void decelerateCart(BlockPos pos, AbstractMinecartEntity cart) { + Vec3d diff = VecHelper.getCenterOf(pos) + .subtract(cart.getPositionVec()); + cart.setMotion(diff.x / 16f, 0, diff.z / 16f); + } + + @Override + protected void updateState(BlockState state, World world, BlockPos pos, Block block) { + int oldPower = state.get(POWERED); + int newPower = Math.max(world.getRedstonePowerFromNeighbors(pos), 0); // TODO: Add power calculation + if (oldPower != newPower) { + world.setBlockState(pos, state.with(POWERED, newPower), 3); + world.notifyNeighborsOfStateChange(pos.down(), this); + if (state.get(SHAPE).isAscending()) { + world.notifyNeighborsOfStateChange(pos.up(), this); + } + } + } + + @Override + public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) { + switch (p_185499_2_) { + case CLOCKWISE_180: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + default: + return p_185499_1_.with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + } + case COUNTERCLOCKWISE_90: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case NORTH_SOUTH: + return p_185499_1_.with(SHAPE, EAST_WEST); + case EAST_WEST: + return p_185499_1_.with(SHAPE, NORTH_SOUTH).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + } + case CLOCKWISE_90: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case NORTH_SOUTH: + return p_185499_1_.with(SHAPE, EAST_WEST).with(SHAPE, NORTH_SOUTH).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + case EAST_WEST: + return p_185499_1_.with(SHAPE, NORTH_SOUTH); + } + default: + return p_185499_1_; + } + } + + @Override + public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) { + RailShape railshape = p_185471_1_.get(SHAPE); + switch (p_185471_2_) { + case LEFT_RIGHT: + switch (railshape) { + case ASCENDING_NORTH: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_SOUTH); + case ASCENDING_SOUTH: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_NORTH); + case NORTH_SOUTH: + return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); + default: + return super.mirror(p_185471_1_, p_185471_2_); + } + case FRONT_BACK: + switch (railshape) { + case ASCENDING_EAST: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_WEST); + case ASCENDING_WEST: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_EAST); + case EAST_WEST: + return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); + default: + break; + } + } + + return super.mirror(p_185471_1_, p_185471_2_); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index 604161694..5ef9c4042 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -9,6 +9,7 @@ import java.util.Vector; import java.util.function.BiFunction; import java.util.function.Function; +import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.ImmutableList; @@ -434,4 +435,47 @@ public class BlockStateGen { .end(); } + public static NonNullBiConsumer, RegistrateBlockstateProvider> controllerRail() { + return (c, p) -> p.getVariantBuilder(c.get()) + .forAllStates(state -> { + int power = state.get(ControllerRailBlock.POWERED); + boolean backwards = state.get(ControllerRailBlock.BACKWARDS); + String powerStr = power == 0 ? "off" : (power == 15 ? "on" : "analog"); + RailShape shape = state.get(ControllerRailBlock.SHAPE); + String shapeName = shape.isAscending() ? RailShape.ASCENDING_NORTH.getName() : RailShape.NORTH_SOUTH.getName(); + int rotation = 0; + + switch (shape) { + case EAST_WEST: + rotation += 270; + shapeName = RailShape.NORTH_SOUTH.getName(); + break; + case ASCENDING_EAST: + rotation += 90; + break; + case ASCENDING_SOUTH: + rotation += 180; + break; + case ASCENDING_WEST: + rotation += 270; + break; + default: + break; + } + + if (backwards) { + rotation += 180; + shapeName = shape.isAscending() ? RailShape.ASCENDING_SOUTH.getName() : RailShape.NORTH_SOUTH.getName(); + } + + + return ConfiguredModel.builder() + .modelFile(p.models() + .getExistingFile(p.modLoc( + "block/" + c.getName() + "/block_" + shapeName + "_" + + powerStr))) + .rotationY(rotation % 360) + .build(); + }); + } } diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json new file mode 100644 index 000000000..73815cb0d --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json new file mode 100644 index 000000000..f339682a0 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json new file mode 100644 index 000000000..0fe3100de --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json new file mode 100644 index 000000000..de285565e --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json new file mode 100644 index 000000000..f4fbd0df1 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json new file mode 100644 index 000000000..cffc1646a --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json new file mode 100644 index 000000000..ba0d436dc --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json new file mode 100644 index 000000000..280d61983 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json new file mode 100644 index 000000000..749918039 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/controller_rail_analog.png b/src/main/resources/assets/create/textures/block/controller_rail_analog.png new file mode 100644 index 0000000000000000000000000000000000000000..f114dde12136d880f9dc1bd4c2d6466442604984 GIT binary patch literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}B0G|+7AU$W!oQ#Z&lO3|{xvqECX(ll-ZJiLgq`|AGGB3zkWA&QVpATvo zGBCvW8mwk!OlM*QYFVM5lL4fJN`m}?|DywjNBj2+0cAN0JR*x382Ao@Fyrz36)8Z$ zR!RX#E}C{TWlm19cg2?4LD>C6{?UEg;tGST`%pL2LF!#zH0>qV*7 zOmAdQ9dEoYsBWxy*Ls~v)_K0kK}FMA(%V1%O||}azx+SrHVdv3RvrAIKnF2+y85}S Ib4q9e0O3-7H~;_u literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/controller_rail_off.png b/src/main/resources/assets/create/textures/block/controller_rail_off.png new file mode 100644 index 0000000000000000000000000000000000000000..346d2fb671b9c36bea25f64a61acbd0dd2faa0d0 GIT binary patch literal 331 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}x0G|+7AU$W!oQ#Z&lO3|{xvqECX(ll-ZJiLgq`|AGGB3zkWA&QVpATwz zF*C>b8W;jqGcY`0R(}Sh1WSVag8!od2GzAQlYo+(1s;*b3=DjSL74G){)!Z!V2h`V zV~9quZ@(iSiy{XLJIfS7_kaIyxgJgV9l?3^>|?%&n&k>R?EM;awwg^^~ZdM*0g+iv*Xf=v$ASyuUc_E<9oWZZszrm|M&gouRFt)S<`U#1JFGTp00i_>zopr E06IT?F8}}l literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/controller_rail_on.png b/src/main/resources/assets/create/textures/block/controller_rail_on.png new file mode 100644 index 0000000000000000000000000000000000000000..bd61741a5f5dd2f93e73044c3af87ca434030b6d GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}Z0G|+7AU$W!oQ#Z&lO3|{xvqECXN*w4h+0kVLBd$K_WkP`LPr!hSeTi-YE&NnYmW_CbL;0Dt*W-uJO($toD6pNFhmyVsdzTZ z+!2kIpLZ@IpFPafPwHA_l0jpM@ikVCDV{D?s%uX(-Z=Jo&-;Ydw+F=dVz=^DSVz72 zFzs!@hH{N|=KjO}X)(LXWmaB4)~B}g$sOTid{6WLeUd%?|96`G-2`sMZ~yHiflgxZ MboFyt=akR{0OqEF^#A|> literal 0 HcmV?d00001 From 72596f63d46c67a7b609a78b32c8eb5a218458af Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 28 Nov 2020 23:06:09 +0100 Subject: [PATCH 2/6] Placement logic please --- .../tracks/ControllerRailBlock.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java index 6149efd59..ca49eb29d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -1,14 +1,19 @@ package com.simibubi.create.content.contraptions.components.tracks; +import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.utility.VecHelper; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemUseContext; import net.minecraft.state.*; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -23,7 +28,7 @@ import static net.minecraft.state.properties.RailShape.*; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @SuppressWarnings("deprecation") -public class ControllerRailBlock extends AbstractRailBlock { +public class ControllerRailBlock extends AbstractRailBlock implements IWrenchable { public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; public static final IntegerProperty POWERED = BlockStateProperties.POWER_0_15; public static final BooleanProperty BACKWARDS = BooleanProperty.create("backwards"); @@ -33,6 +38,13 @@ public class ControllerRailBlock extends AbstractRailBlock { this.setDefaultState(this.stateContainer.getBaseState().with(POWERED, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); } + @Override + public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { + Direction direction = p_196258_1_.getPlacementHorizontalFacing(); + BlockState base = super.getStateForPlacement(p_196258_1_); + return (base == null ? getDefaultState() : base).with(BACKWARDS, direction == Direction.SOUTH || direction == Direction.EAST); + } + @Override public IProperty getShapeProperty() { return SHAPE; @@ -163,4 +175,28 @@ public class ControllerRailBlock extends AbstractRailBlock { return super.mirror(p_185471_1_, p_185471_2_); } + + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + BlockPos pos = context.getPos(); + world.setBlockState(pos, rotate(state, Rotation.CLOCKWISE_90)); + world.notifyNeighborsOfStateChange(pos.down(), this); + if (state.get(SHAPE).isAscending()) { + world.notifyNeighborsOfStateChange(pos.up(), this); + } + return ActionResultType.SUCCESS; + } + + @Override + public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + BlockPos pos = context.getPos(); + world.setBlockState(pos, rotate(state, Rotation.COUNTERCLOCKWISE_90)); + world.notifyNeighborsOfStateChange(pos.down(), this); + if (state.get(SHAPE).isAscending()) { + world.notifyNeighborsOfStateChange(pos.up(), this); + } + return ActionResultType.SUCCESS; + } } From 94aa5ea4c75b9bf4e3836eb45cabaeef5a30431c Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sun, 29 Nov 2020 13:07:04 +0100 Subject: [PATCH 3/6] Wrench QOL: Helping the controller to not loose control over supporting blocks while wrenching it Plus a bunch of refactoring to make things easier for the next changes --- .../tracks/ControllerRailBlock.java | 90 +++++++++++-------- 1 file changed, 54 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java index ca49eb29d..b2175ffc2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -18,6 +18,8 @@ import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import javax.annotation.ParametersAreNonnullByDefault; @@ -38,6 +40,34 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl this.setDefaultState(this.stateContainer.getBaseState().with(POWERED, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); } + private static Vec3i getAccelerationVector(BlockState state) { + Direction pointingTo = getPointingTowards(state); + return (state.get(BACKWARDS) ? pointingTo.getOpposite() : pointingTo).getDirectionVec(); + } + + private static Direction getPointingTowards(BlockState state) { + switch (state.get(SHAPE)) { + case ASCENDING_WEST: + case EAST_WEST: + return Direction.WEST; + case ASCENDING_EAST: + return Direction.EAST; + case ASCENDING_SOUTH: + return Direction.SOUTH; + default: + return Direction.NORTH; + } + } + + private static void decelerateCart(BlockPos pos, AbstractMinecartEntity cart) { + Vec3d diff = VecHelper.getCenterOf(pos).subtract(cart.getPositionVec()); + cart.setMotion(diff.x / 16f, 0, diff.z / 16f); + } + + private static boolean isStableWith(BlockState testState, IBlockReader world, BlockPos pos) { + return hasSolidSideOnTop(world, pos.down()) && (!testState.get(SHAPE).isAscending() || hasSolidSideOnTop(world, pos.offset(getPointingTowards(testState)))); + } + @Override public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { Direction direction = p_196258_1_.getPlacementHorizontalFacing(); @@ -50,48 +80,28 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl return SHAPE; } + @Override protected void fillStateContainer(StateContainer.Builder p_206840_1_) { p_206840_1_.add(SHAPE, POWERED, BACKWARDS); } - public Vec3d getAccelerationVector(BlockState state) { - RailShape shape = state.get(SHAPE); - boolean backwards = state.get(BACKWARDS); - Vec3d base = new Vec3d(shape == ASCENDING_EAST ? 1 : (shape == EAST_WEST || shape == ASCENDING_WEST ? -1 : 0), - 0, shape == ASCENDING_SOUTH ? 1 : (shape == ASCENDING_NORTH || shape == NORTH_SOUTH ? -1 : 0)); - return base.scale(backwards ? -1 : 1); - } - @Override public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) { if (world.isRemote) return; - Vec3d accelerationVec = getAccelerationVector(state); + Vec3d accelerationVec = new Vec3d(getAccelerationVector(state)); double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWERED) / 15.; - if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) { + if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) cart.setMotion(accelerationVec.scale(targetSpeed)); - } else { + else decelerateCart(pos, cart); - } - } - - private void decelerateCart(BlockPos pos, AbstractMinecartEntity cart) { - Vec3d diff = VecHelper.getCenterOf(pos) - .subtract(cart.getPositionVec()); - cart.setMotion(diff.x / 16f, 0, diff.z / 16f); } @Override protected void updateState(BlockState state, World world, BlockPos pos, Block block) { - int oldPower = state.get(POWERED); int newPower = Math.max(world.getRedstonePowerFromNeighbors(pos), 0); // TODO: Add power calculation - if (oldPower != newPower) { - world.setBlockState(pos, state.with(POWERED, newPower), 3); - world.notifyNeighborsOfStateChange(pos.down(), this); - if (state.get(SHAPE).isAscending()) { - world.notifyNeighborsOfStateChange(pos.up(), this); - } - } + if (state.get(POWERED) != newPower) + placeAndNotify(state.with(POWERED, newPower), pos, world); } @Override @@ -172,18 +182,21 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl break; } } - return super.mirror(p_185471_1_, p_185471_2_); } @Override public ActionResultType onWrenched(BlockState state, ItemUseContext context) { World world = context.getWorld(); + if (world.isRemote) + return ActionResultType.SUCCESS; BlockPos pos = context.getPos(); - world.setBlockState(pos, rotate(state, Rotation.CLOCKWISE_90)); - world.notifyNeighborsOfStateChange(pos.down(), this); - if (state.get(SHAPE).isAscending()) { - world.notifyNeighborsOfStateChange(pos.up(), this); + for (Rotation testRotation : new Rotation[]{Rotation.CLOCKWISE_90, Rotation.CLOCKWISE_180, Rotation.COUNTERCLOCKWISE_90}) { + BlockState testState = rotate(state, testRotation); + if (isStableWith(testState, world, pos)) { + placeAndNotify(testState, pos, world); + break; + } } return ActionResultType.SUCCESS; } @@ -192,11 +205,16 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { World world = context.getWorld(); BlockPos pos = context.getPos(); - world.setBlockState(pos, rotate(state, Rotation.COUNTERCLOCKWISE_90)); - world.notifyNeighborsOfStateChange(pos.down(), this); - if (state.get(SHAPE).isAscending()) { - world.notifyNeighborsOfStateChange(pos.up(), this); - } + BlockState testState = state.with(BACKWARDS, !state.get(BACKWARDS)); + if (isStableWith(testState, world, pos)) + placeAndNotify(testState, pos, world); return ActionResultType.SUCCESS; } + + private void placeAndNotify(BlockState state, BlockPos pos, World world) { + world.setBlockState(pos, state, 3); + world.notifyNeighborsOfStateChange(pos.down(), this); + if (state.get(SHAPE).isAscending()) + world.notifyNeighborsOfStateChange(pos.up(), this); + } } From 58601e827e380e656c5dcb09fb4869506f16941c Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sun, 29 Nov 2020 17:30:53 +0100 Subject: [PATCH 4/6] Interpolation please! --- .../tracks/ControllerRailBlock.java | 88 +++++++++++++++++-- .../processing/BasinTileEntity.java | 2 +- .../create/foundation/data/BlockStateGen.java | 2 +- 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java index b2175ffc2..d4ecf5998 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -17,11 +17,13 @@ import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import static net.minecraft.state.properties.RailShape.*; @@ -32,12 +34,12 @@ import static net.minecraft.state.properties.RailShape.*; @SuppressWarnings("deprecation") public class ControllerRailBlock extends AbstractRailBlock implements IWrenchable { public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; - public static final IntegerProperty POWERED = BlockStateProperties.POWER_0_15; + public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15; public static final BooleanProperty BACKWARDS = BooleanProperty.create("backwards"); public ControllerRailBlock(Properties p_i48444_2_) { super(true, p_i48444_2_); - this.setDefaultState(this.stateContainer.getBaseState().with(POWERED, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); + this.setDefaultState(this.stateContainer.getBaseState().with(POWER, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); } private static Vec3i getAccelerationVector(BlockState state) { @@ -82,7 +84,7 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl @Override protected void fillStateContainer(StateContainer.Builder p_206840_1_) { - p_206840_1_.add(SHAPE, POWERED, BACKWARDS); + p_206840_1_.add(SHAPE, POWER, BACKWARDS); } @Override @@ -90,7 +92,7 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl if (world.isRemote) return; Vec3d accelerationVec = new Vec3d(getAccelerationVector(state)); - double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWERED) / 15.; + double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWER) / 15.; if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) cart.setMotion(accelerationVec.scale(targetSpeed)); else @@ -99,9 +101,52 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl @Override protected void updateState(BlockState state, World world, BlockPos pos, Block block) { - int newPower = Math.max(world.getRedstonePowerFromNeighbors(pos), 0); // TODO: Add power calculation - if (state.get(POWERED) != newPower) - placeAndNotify(state.with(POWERED, newPower), pos, world); + int newPower = calculatePower(world, pos); + if (state.get(POWER) != newPower) + placeAndNotify(state.with(POWER, newPower), pos, world); + } + + private int calculatePower(World world, BlockPos pos) { + int newPower = world.getRedstonePowerFromNeighbors(pos); + if (newPower != 0) + return newPower; + + int forwardDistance = 0; + int backwardsDistance = 0; + BlockPos lastForwardRail = pos; + BlockPos lastBackwardsRail = pos; + int forwardPower = 0; + int backwardsPower = 0; + + for (int i = 0; i < 15; i++) { + BlockPos testPos = findNextRail(lastForwardRail, world, false); + if (testPos == null) + break; + forwardDistance++; + lastForwardRail = testPos; + forwardPower = world.getRedstonePowerFromNeighbors(testPos); + if (forwardPower != 0) + break; + } + for (int i = 0; i < 15; i++) { + BlockPos testPos = findNextRail(lastBackwardsRail, world, true); + if (testPos == null) + break; + backwardsDistance++; + lastBackwardsRail = testPos; + backwardsPower = world.getRedstonePowerFromNeighbors(testPos); + if (backwardsPower != 0) + break; + } + if (forwardDistance > 8 && backwardsDistance > 8) + return 0; + else if (backwardsPower == 0 && forwardDistance <= 8) + return forwardPower; + else if (forwardPower == 0 && backwardsDistance <= 8) + return backwardsPower; + else if (backwardsPower != 0 && forwardPower != 0) + return MathHelper.ceil((backwardsPower * forwardDistance + forwardPower * backwardsDistance) / (double) (forwardDistance + backwardsDistance)); + return 0; } @Override @@ -146,7 +191,7 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl case ASCENDING_SOUTH: return p_185499_1_.with(SHAPE, ASCENDING_WEST); case NORTH_SOUTH: - return p_185499_1_.with(SHAPE, EAST_WEST).with(SHAPE, NORTH_SOUTH).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + return p_185499_1_.with(SHAPE, EAST_WEST).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); case EAST_WEST: return p_185499_1_.with(SHAPE, NORTH_SOUTH); } @@ -217,4 +262,31 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl if (state.get(SHAPE).isAscending()) world.notifyNeighborsOfStateChange(pos.up(), this); } + + @Nullable + private BlockPos findNextRail(BlockPos from, IBlockReader world, boolean reversed) { + BlockState current = world.getBlockState(from); + if (!(current.getBlock() instanceof ControllerRailBlock)) + return null; + Vec3i accelerationVec = getAccelerationVector(current); + BlockPos baseTestPos = reversed ? from.subtract(accelerationVec) : from.add(accelerationVec); + for (BlockPos testPos : new BlockPos[]{baseTestPos, baseTestPos.down(), baseTestPos.up()}) { + if (testPos.getY() > from.getY() && !current.get(SHAPE).isAscending()) + continue; + BlockState testState = world.getBlockState(testPos); + if (testState.getBlock() instanceof ControllerRailBlock && getAccelerationVector(testState).equals(accelerationVec)) + return testPos; + } + return null; + } + + @Override + public boolean hasComparatorInputOverride(BlockState state) { + return true; + } + + @Override + public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { + return state.get(POWER); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 08890929f..f6429ab37 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -251,7 +251,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt newFacing = test; } - if (preferredSpoutput != null && BasinBlock.canOutputTo(world, pos, preferredSpoutput)) + if (preferredSpoutput != null && BasinBlock.canOutputTo(world, pos, preferredSpoutput) && preferredSpoutput != Direction.UP) newFacing = preferredSpoutput; if (newFacing != currentFacing) diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index 5ef9c4042..e9432c225 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -438,7 +438,7 @@ public class BlockStateGen { public static NonNullBiConsumer, RegistrateBlockstateProvider> controllerRail() { return (c, p) -> p.getVariantBuilder(c.get()) .forAllStates(state -> { - int power = state.get(ControllerRailBlock.POWERED); + int power = state.get(ControllerRailBlock.POWER); boolean backwards = state.get(ControllerRailBlock.BACKWARDS); String powerStr = power == 0 ? "off" : (power == 15 ? "on" : "analog"); RailShape shape = state.get(ControllerRailBlock.SHAPE); From bf869010f05198a87301684d54b105b24696b679 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 29 Nov 2020 23:01:18 +0100 Subject: [PATCH 5/6] Minecart Purgatory - Further attempts at improving the coupling physics - Fixed reversed couplings losing their physics entry point - Fixed "angel block" placement through super glue --- .../glue/SuperGlueEntity.java | 53 ++++++++++------- .../train/CouplingPhysics.java | 57 +++++++++++++------ .../train/MinecartSim2020.java | 44 +++----------- .../train/capability/MinecartController.java | 2 +- .../ArmInteractionPointHandler.java | 5 +- .../create/foundation/utility/Couple.java | 16 ++++-- 6 files changed, 98 insertions(+), 79 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index d4a6f9b65..294a0582a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -43,6 +43,7 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -256,26 +257,38 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat @OnlyIn(Dist.CLIENT) private void triggerPlaceBlock(PlayerEntity player, Hand hand) { - if (player instanceof ClientPlayerEntity && player.world instanceof ClientWorld) { - ClientPlayerEntity cPlayer = (ClientPlayerEntity) player; - Minecraft mc = Minecraft.getInstance(); - RayTraceResult ray = - cPlayer.pick(mc.playerController.getBlockReachDistance(), mc.getRenderPartialTicks(), false); - if (ray instanceof BlockRayTraceResult) { - for (Hand handIn : Hand.values()) { - ItemStack itemstack = cPlayer.getHeldItem(handIn); - int countBefore = itemstack.getCount(); - ActionResultType actionResultType = mc.playerController.func_217292_a(cPlayer, - (ClientWorld) cPlayer.world, handIn, (BlockRayTraceResult) ray); - if (actionResultType == ActionResultType.SUCCESS) { - cPlayer.swingArm(handIn); - if (!itemstack.isEmpty() - && (itemstack.getCount() != countBefore || mc.playerController.isInCreativeMode())) - mc.gameRenderer.itemRenderer.resetEquippedProgress(handIn); - return; - } - } - } + if (!(player instanceof ClientPlayerEntity)) + return; + if (!(player.world instanceof ClientWorld)) + return; + + ClientPlayerEntity cPlayer = (ClientPlayerEntity) player; + Minecraft mc = Minecraft.getInstance(); + RayTraceResult ray = + cPlayer.pick(mc.playerController.getBlockReachDistance(), mc.getRenderPartialTicks(), false); + + if (!(ray instanceof BlockRayTraceResult)) + return; + if (ray.getType() == Type.MISS) + return; + BlockRayTraceResult blockRay = (BlockRayTraceResult) ray; + if (!blockRay.getPos() + .offset(blockRay.getFace()) + .equals(getHangingPosition())) + return; + + for (Hand handIn : Hand.values()) { + ItemStack itemstack = cPlayer.getHeldItem(handIn); + int countBefore = itemstack.getCount(); + ActionResultType actionResultType = + mc.playerController.func_217292_a(cPlayer, (ClientWorld) cPlayer.world, handIn, blockRay); + if (actionResultType != ActionResultType.SUCCESS) + return; + + cPlayer.swingArm(handIn); + if (!itemstack.isEmpty() && (itemstack.getCount() != countBefore || mc.playerController.isInCreativeMode())) + mc.gameRenderer.itemRenderer.resetEquippedProgress(handIn); + return; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java index 47ede3ff0..519a694b6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java @@ -11,7 +11,9 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.MoverType; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.state.properties.RailShape; +import net.minecraft.tags.BlockTags; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; @@ -23,12 +25,18 @@ public class CouplingPhysics { public static void tickCoupling(World world, Couple c) { Couple carts = c.map(MinecartController::cart); - float couplingLength = c.getFirst().getCouplingLength(true); + float couplingLength = c.getFirst() + .getCouplingLength(true); softCollisionStep(world, carts, couplingLength); + if (world.isRemote) + return; hardCollisionStep(world, carts, couplingLength); } public static void hardCollisionStep(World world, Couple carts, double couplingLength) { + if (!MinecartSim2020.canAddMotion(carts.get(false)) && MinecartSim2020.canAddMotion(carts.get(true))) + carts = carts.swap(); + Couple corrections = Couple.create(null, null); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); boolean firstLoop = true; @@ -39,6 +47,9 @@ public class CouplingPhysics { float stress = (float) (couplingLength - cart.getPositionVec() .distanceTo(otherCart.getPositionVec())); + if (Math.abs(stress) < 1 / 8f) + continue; + RailShape shape = null; BlockPos railPosition = cart.getCurrentRailPosition(); BlockState railState = world.getBlockState(railPosition.up()); @@ -53,7 +64,12 @@ public class CouplingPhysics { Vec3d link = otherCart.getPositionVec() .subtract(pos); float correctionMagnitude = firstLoop ? -stress / 2f : -stress; - correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos) + + if (!MinecartSim2020.canAddMotion(cart)) + correctionMagnitude /= 2; + + correction = shape != null + ? followLinkOnRail(link, pos, correctionMagnitude, MinecartSim2020.getRailVec(shape)).subtract(pos) : link.normalize() .scale(correctionMagnitude); @@ -75,27 +91,30 @@ public class CouplingPhysics { } public static void softCollisionStep(World world, Couple carts, double couplingLength) { - - Couple positions = carts.map(Entity::getPositionVector); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); Couple canAddmotion = carts.map(MinecartSim2020::canAddMotion); + Couple motions = carts.map(Entity::getMotion); + Couple nextPositions = carts.map(MinecartSim2020::predictNextPositionOf); - Couple shapes = carts.map(current -> { - BlockPos railPosition = current.getCurrentRailPosition(); + Couple shapes = carts.mapWithContext((cart, current) -> { + AbstractMinecartEntity minecart = cart.getMinecart(); + Vec3d vec = nextPositions.get(current); + int x = MathHelper.floor(vec.getX()); + int y = MathHelper.floor(vec.getY()); + int z = MathHelper.floor(vec.getZ()); + BlockPos pos = new BlockPos(x, y - 1, z); + if (minecart.world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down(); + BlockPos railPosition = pos; BlockState railState = world.getBlockState(railPosition.up()); if (!(railState.getBlock() instanceof AbstractRailBlock)) return null; AbstractRailBlock block = (AbstractRailBlock) railState.getBlock(); - return block.getRailDirection(railState, world, railPosition, current); + return block.getRailDirection(railState, world, railPosition, cart); }); - Couple motions = carts.map(MinecartSim2020::predictMotionOf); - Couple nextPositions = positions.copy(); - nextPositions.replaceWithParams(Vec3d::add, motions); - float futureStress = (float) (couplingLength - nextPositions.getFirst() .distanceTo(nextPositions.getSecond())); - if (Math.abs(futureStress) < 1 / 128f) + if (MathHelper.epsilonEquals(futureStress, 0)) return; for (boolean current : Iterate.trueAndFalse) { @@ -107,12 +126,19 @@ public class CouplingPhysics { if (canAddmotion.get(current) != canAddmotion.get(!current)) correctionMagnitude = !canAddmotion.get(current) ? 0 : correctionMagnitude * 2; + if (!canAddmotion.get(current)) + continue; RailShape shape = shapes.get(current); - correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos) - : link.normalize() + if (shape != null) { + Vec3d railVec = MinecartSim2020.getRailVec(shape); + correction = followLinkOnRail(link, pos, correctionMagnitude, railVec).subtract(pos); + } else + correction = link.normalize() .scale(correctionMagnitude); + correction = VecHelper.clamp(correction, maxSpeed.get(current)); + motions.set(current, motions.get(current) .add(correction)); } @@ -121,8 +147,7 @@ public class CouplingPhysics { carts.forEachWithParams(Entity::setMotion, motions); } - public static Vec3d followLinkOnRail(Vec3d link, Vec3d cart, float diffToReduce, RailShape shape) { - Vec3d railAxis = MinecartSim2020.getRailVec(shape); + public static Vec3d followLinkOnRail(Vec3d link, Vec3d cart, float diffToReduce, Vec3d railAxis) { double dotProduct = railAxis.dotProduct(link); if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0) return cart; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java index a01d3e6ff..a470a914d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java @@ -46,33 +46,20 @@ public class MinecartSim2020 { map.put(RailShape.NORTH_EAST, Pair.of(north, east)); }); - public static Vec3d predictMotionOf(AbstractMinecartEntity cart) { -// if (cart instanceof FurnaceMinecartEntity) { -// return cart.getPositionVec() -// .subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ); -// } - return cart.getMotion().scale(1f); -// if (cart instanceof ContainerMinecartEntity) { -// ContainerMinecartEntity containerCart = (ContainerMinecartEntity) cart; -// float f = 0.98F; -// if (containerCart.isEmpty()) -// return cart.getMotion() -// .mul(f, 0.0D, f); -// int i = 15 - Container.calcRedstoneFromInventory(containerCart); -// f += (float) i * 0.001F; -// return cart.getMotion() -// .mul(f, 0.0D, f); -// } -// return cart.getMotion() -// .scale(cart.isBeingRidden() ? 0.997D : 0.96D); + public static Vec3d predictNextPositionOf(AbstractMinecartEntity cart) { + Vec3d position = cart.getPositionVec(); + Vec3d motion = cart.getMotion(); + return position.add(motion); } public static boolean canAddMotion(AbstractMinecartEntity c) { if (c instanceof FurnaceMinecartEntity) return MathHelper.epsilonEquals(((FurnaceMinecartEntity) c).pushX, 0) && MathHelper.epsilonEquals(((FurnaceMinecartEntity) c).pushZ, 0); - LazyOptional capability = c.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); - if (capability.isPresent() && capability.orElse(null).isStalled()) + LazyOptional capability = + c.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); + if (capability.isPresent() && capability.orElse(null) + .isStalled()) return false; return true; } @@ -196,21 +183,6 @@ public class MinecartSim2020 { } cart.setMotion(previousMotion); - - if (cart instanceof FurnaceMinecartEntity) { -// FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart; -// Vec3d vec3d = cart.getMotion(); -// double d2 = horizontalMag(vec3d); -// double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ; -// if (d3 > 1.0E-4D && d2 > 0.001D) { -// double d40 = (double) MathHelper.sqrt(d2); -// double d50 = (double) MathHelper.sqrt(d3); -// furnaceCart.pushX = vec3d.x / d40 * d50; -// furnaceCart.pushZ = vec3d.z / d40 * d50; -// furnaceCart.setMotion(vec3d.mul(0.8D, 0.0D, 0.8D) -// .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ)); -// } - } } public static Vec3d getRailVec(RailShape shape) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java index 121d1fa61..4b60990c1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java @@ -187,9 +187,9 @@ public class MinecartController implements INBTSerializable { } })); mc.couplings = mc.couplings.swap(); + mc.needsEntryRefresh = true; if (mc == this) continue; - mc.needsEntryRefresh = true; mc.sendData(); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java index e461ed678..7cf1e883b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java @@ -114,8 +114,9 @@ public class ArmInteractionPointHandler { else inputs++; } - player.sendStatusMessage(Lang.createTranslationTextComponent("mechanical_arm.summary", inputs, outputs) - .applyTextStyle(TextFormatting.WHITE), true); + if (inputs + outputs > 0) + player.sendStatusMessage(Lang.createTranslationTextComponent("mechanical_arm.summary", inputs, outputs) + .applyTextStyle(TextFormatting.WHITE), true); } AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos)); diff --git a/src/main/java/com/simibubi/create/foundation/utility/Couple.java b/src/main/java/com/simibubi/create/foundation/utility/Couple.java index 0df6950b6..9c36c903f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Couple.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Couple.java @@ -49,6 +49,14 @@ public class Couple extends Pair implements Iterable { return Couple.create(function.apply(first), function.apply(second)); } + public Couple mapWithContext(BiFunction function) { + return Couple.create(function.apply(first, true), function.apply(second, false)); + } + + public Couple mapWithParams(BiFunction function, Couple values) { + return Couple.create(function.apply(first, values.first), function.apply(second, values.second)); + } + public void replace(Function function) { setFirst(function.apply(getFirst())); setSecond(function.apply(getSecond())); @@ -95,17 +103,17 @@ public class Couple extends Pair implements Iterable { public Iterator iterator() { return new Couplerator<>(this); } - + private static class Couplerator implements Iterator { int state; private Couple couple; - + public Couplerator(Couple couple) { this.couple = couple; state = 0; } - + @Override public boolean hasNext() { return state != 2; @@ -120,7 +128,7 @@ public class Couple extends Pair implements Iterable { return couple.second; return null; } - + } } From 32d8869b8aeeb8bec22a729af0a2974e3ec41616 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sun, 29 Nov 2020 23:21:38 +0100 Subject: [PATCH 6/6] D --- .../components/structureMovement/train/CouplingPhysics.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java index 519a694b6..00c932783 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java @@ -114,7 +114,7 @@ public class CouplingPhysics { float futureStress = (float) (couplingLength - nextPositions.getFirst() .distanceTo(nextPositions.getSecond())); - if (MathHelper.epsilonEquals(futureStress, 0)) + if (MathHelper.epsilonEquals(futureStress, 0D)) return; for (boolean current : Iterate.trueAndFalse) {