diff --git a/build.gradle b/build.gradle index ae5d883dd..3ef495f58 100644 --- a/build.gradle +++ b/build.gradle @@ -187,6 +187,8 @@ dependencies { compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_minecraft_version}:api") runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_minecraft_version}") + runtimeOnly fg.deobf("curse.maven:commandstructures-565119:4711641") + if (cc_tweaked_enable.toBoolean()) { compileOnly("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-core-api:${cc_tweaked_version}") compileOnly fg.deobf("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-forge-api:${cc_tweaked_version}") diff --git a/src/generated/resources/.cache/2d64935085b86659cb7857bad9701dbf9bab6e4c b/src/generated/resources/.cache/2d64935085b86659cb7857bad9701dbf9bab6e4c index 2afe4ee91..d4427f8b5 100644 --- a/src/generated/resources/.cache/2d64935085b86659cb7857bad9701dbf9bab6e4c +++ b/src/generated/resources/.cache/2d64935085b86659cb7857bad9701dbf9bab6e4c @@ -1,4 +1,4 @@ -// 1.20.1 2023-09-20T19:40:25.374215 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +// 1.20.1 2024-02-27T19:56:37.1999052 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] 60bbdf92d2ac9824ea6144955c74043a6005f79d assets/create/blockstates/acacia_window.json 6a67703c2697d81b7dc83e9d72a66f9c9ff08383 assets/create/blockstates/acacia_window_pane.json c3ae87b62e81d8e9476eccd793bb1548d74c66a1 assets/create/blockstates/adjustable_chain_gearshift.json @@ -585,8 +585,8 @@ b0d8f08968763a5f74e5cd5644377a76a9f39753 assets/create/blockstates/yellow_toolbo fe8c497aacc641c2f01cec90bba9f19e59cc2ed2 assets/create/blockstates/yellow_valve_handle.json e819e93fdcbe9fd9c050a052d2718ff3b3539365 assets/create/blockstates/zinc_block.json 64121dcb216381c83b4fe28aa361ea07c24c9ad0 assets/create/blockstates/zinc_ore.json -79a43e6c997dbfa078c6aa8e4ab0c4386aaf4dd9 assets/create/lang/en_ud.json -d8d0f395ae53d72ea0d5047b9167569fe87c870d assets/create/lang/en_us.json +5bc2e2c67a554384431fbc4b916493fec7203a63 assets/create/lang/en_ud.json +cb0c666d2a6d52e2c4871d84e9b648103f65b4e2 assets/create/lang/en_us.json a97e1060e00ae701a02e39cd4ef8054cf345fac4 assets/create/models/block/acacia_window.json 103e032c0b1a0a6a27c67da8c91179a564bd281c assets/create/models/block/acacia_window_pane_noside.json fb00b627abda76ad4fea867ca57dbfadd24fffa3 assets/create/models/block/acacia_window_pane_noside_alt.json @@ -4189,6 +4189,7 @@ a5874f73c7dc0a3ae12999e6ae8abf45bc7fb9be data/create/tags/blocks/passive_boiler_ da739ad2160e7df4e0e5cc89587670ce5e9450c3 data/create/tags/blocks/valve_handles.json 72143286fb5cb372a0696550e2eac76ca50e6fbc data/create/tags/blocks/windmill_sails.json 58987ea71d488cc48192ceb00c00aa2903e51304 data/create/tags/blocks/wrench_pickup.json +76c0522664726c09461ad4565b6fba80b4f816b2 data/create/tags/entity_types/blaze_burner_capturable.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/create/tags/entity_types/ignore_seat.json 894e1e4fd1e32712abdda18ec64ab13750d3c039 data/create/tags/fluids/bottomless/allow.json 35133e95f1c8fdd7a1c21afcc231fc0bffefb9a8 data/create/tags/fluids/bottomless/deny.json diff --git a/src/generated/resources/.cache/499d9d953ee69b539ff4dd4c95a6cbd849f63f67 b/src/generated/resources/.cache/499d9d953ee69b539ff4dd4c95a6cbd849f63f67 new file mode 100644 index 000000000..c48f73d62 --- /dev/null +++ b/src/generated/resources/.cache/499d9d953ee69b539ff4dd4c95a6cbd849f63f67 @@ -0,0 +1,52 @@ +// 1.20.1 2024-02-28T16:56:53.0452139 Create Train Hat Information +be16d47aa64e673b1107a36ce06475016e316fca assets/minecraft/train_hat_info/axolotl.json +b8ae6d9c8014439f4049622e0d6e79b9d6716260 assets/minecraft/train_hat_info/bat.json +5053a6c9fb412dfac1bf17eb0f57f9fd314198e4 assets/minecraft/train_hat_info/bee.json +2157404eccf602f1b88eb18b073fcd2969ef9fad assets/minecraft/train_hat_info/blaze.json +95947423dc367c0c60e06ca0b8dd26d563c8419c assets/minecraft/train_hat_info/camel.json +19da83a3ee2d9629bf7ca07909fe07e2b1f22248 assets/minecraft/train_hat_info/cat.json +59ad9206c8deafe586c6dd84d518cc1fa40e274b assets/minecraft/train_hat_info/cave_spider.json +044062def9766f4552e7017af866d55e6818827a assets/minecraft/train_hat_info/chicken.json +c39106b8c17896da6277aaa62dd41adfbabe6661 assets/minecraft/train_hat_info/cod.json +ce1baa5cfa30ab912b72fd771db10aa943c7385e assets/minecraft/train_hat_info/cow.json +4de138fbba2cce34eeccda8cad8aace6d7501788 assets/minecraft/train_hat_info/dolphin.json +e524c61954660d3cb605f01395edb25572b59a1c assets/minecraft/train_hat_info/donkey.json +e87dfc580ae1dcc8fcfc88c06f35c783ac415c0e assets/minecraft/train_hat_info/elder_guardian.json +3f49938e00491599e58c2a05137b36ce194badab assets/minecraft/train_hat_info/endermite.json +06d87ca89d4eb5d15427868a08a591270157ab8e assets/minecraft/train_hat_info/fox.json +2fabb0c86b122fb09ec3ab0c650d43d17417ba9f assets/minecraft/train_hat_info/frog.json +6c1ba6bc216700dc38e9079c9b321cc6f7bd0859 assets/minecraft/train_hat_info/ghast.json +6c1ba6bc216700dc38e9079c9b321cc6f7bd0859 assets/minecraft/train_hat_info/glow_squid.json +d1a10e368f5d0abe92fede6208aab41208dcd773 assets/minecraft/train_hat_info/goat.json +e87dfc580ae1dcc8fcfc88c06f35c783ac415c0e assets/minecraft/train_hat_info/guardian.json +daac75dcadb6e00db5cf1a5b30a450f137da54ae assets/minecraft/train_hat_info/hoglin.json +e524c61954660d3cb605f01395edb25572b59a1c assets/minecraft/train_hat_info/horse.json +272e5169bac1bc2ded2a70db171cdf6fa8d1a63f assets/minecraft/train_hat_info/iron_golem.json +e9b7fc5ec7ed936c6651b59adccfa8c4cbbfd9b4 assets/minecraft/train_hat_info/magma_cube.json +946ce1cdb07b0896b3dbf202c4fc95353f635b2f assets/minecraft/train_hat_info/mooshroom.json +e524c61954660d3cb605f01395edb25572b59a1c assets/minecraft/train_hat_info/mule.json +19da83a3ee2d9629bf7ca07909fe07e2b1f22248 assets/minecraft/train_hat_info/ocelot.json +e1d5b218a5d406bf55038cc89163fe95c5006625 assets/minecraft/train_hat_info/panda.json +f8f55c50becee5cce88755bc1a6d0f13f0b19d8e assets/minecraft/train_hat_info/parrot.json +e237f1a6383b02a45e05676a37987795b4165b35 assets/minecraft/train_hat_info/phantom.json +fb2a3022eac273b99abfea0bb85b81f7de91c7fe assets/minecraft/train_hat_info/pig.json +b8ae6d9c8014439f4049622e0d6e79b9d6716260 assets/minecraft/train_hat_info/polar_bear.json +f394d3dbb39e1603efed1f64d904752c2dd01098 assets/minecraft/train_hat_info/pufferfish.json +1d7b61ae0006a7aed61d1934d042255f16eef9d8 assets/minecraft/train_hat_info/ravager.json +5a0d53f4320bfe187abc5ce3332a3af740fa9062 assets/minecraft/train_hat_info/salmon.json +855f16860193440c1ccde244e81eac2107a298e0 assets/minecraft/train_hat_info/sheep.json +82634fddb5303bc6062a4297c202ebb102d004d9 assets/minecraft/train_hat_info/silverfish.json +e524c61954660d3cb605f01395edb25572b59a1c assets/minecraft/train_hat_info/skeleton_horse.json +8fcf064b7a73a3eb9f31724f1c2075a26706d6b7 assets/minecraft/train_hat_info/slime.json +1990e7eb3ba24f2f64eb5aeea6e6e1d4002ca69f assets/minecraft/train_hat_info/sniffer.json +59ad9206c8deafe586c6dd84d518cc1fa40e274b assets/minecraft/train_hat_info/spider.json +6c1ba6bc216700dc38e9079c9b321cc6f7bd0859 assets/minecraft/train_hat_info/squid.json +527ea95992502de466eb64d81b7c3a365e3a2c59 assets/minecraft/train_hat_info/strider.json +282f1517834c77175e874148c92c40efb19a8f5b assets/minecraft/train_hat_info/tadpole.json +509913e06b456fe6fbefd0c4516713e423bce285 assets/minecraft/train_hat_info/tropical_fish.json +fd85007f98c57b2f57b16cd8dff43d0cf029cd36 assets/minecraft/train_hat_info/turtle.json +78950a0bb66d28d1939049400a8cfd194f92f906 assets/minecraft/train_hat_info/warden.json +12eba791d433f9bd8cc9781cb2b2a9c587ae6b70 assets/minecraft/train_hat_info/wither.json +bd87188334d5f189f7c05a02813307a3e3dc601c assets/minecraft/train_hat_info/wolf.json +daac75dcadb6e00db5cf1a5b30a450f137da54ae assets/minecraft/train_hat_info/zoglin.json +e524c61954660d3cb605f01395edb25572b59a1c assets/minecraft/train_hat_info/zombie_horse.json diff --git a/src/generated/resources/assets/minecraft/train_hat_info/axolotl.json b/src/generated/resources/assets/minecraft/train_hat_info/axolotl.json new file mode 100644 index 000000000..bddf19eca --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/axolotl.json @@ -0,0 +1,9 @@ +{ + "model_part": "head", + "offset": [ + 0.0, + 1.0, + -2.0 + ], + "scale": 0.75 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/bat.json b/src/generated/resources/assets/minecraft/train_hat_info/bat.json new file mode 100644 index 000000000..99a03dd80 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/bat.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 3.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/bee.json b/src/generated/resources/assets/minecraft/train_hat_info/bee.json new file mode 100644 index 000000000..957689d87 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/bee.json @@ -0,0 +1,9 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 2.0, + -2.0 + ], + "scale": 0.5 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/blaze.json b/src/generated/resources/assets/minecraft/train_hat_info/blaze.json new file mode 100644 index 000000000..422778318 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/blaze.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 4.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/camel.json b/src/generated/resources/assets/minecraft/train_hat_info/camel.json new file mode 100644 index 000000000..3c6bd359f --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/camel.json @@ -0,0 +1,9 @@ +{ + "cube_index": 1, + "model_part": "body/head", + "offset": [ + 0.0, + -8.0, + -11.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/cat.json b/src/generated/resources/assets/minecraft/train_hat_info/cat.json new file mode 100644 index 000000000..9ca43b52b --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/cat.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 1.0, + -0.25 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/cave_spider.json b/src/generated/resources/assets/minecraft/train_hat_info/cave_spider.json new file mode 100644 index 000000000..11e5f6705 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/cave_spider.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 2.0, + -3.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/chicken.json b/src/generated/resources/assets/minecraft/train_hat_info/chicken.json new file mode 100644 index 000000000..c06f068dd --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/chicken.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + -0.25 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/cod.json b/src/generated/resources/assets/minecraft/train_hat_info/cod.json new file mode 100644 index 000000000..f34550354 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/cod.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 1.5, + -2.5 + ] +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/cow.json b/src/generated/resources/assets/minecraft/train_hat_info/cow.json new file mode 100644 index 000000000..3c0d50aa6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/cow.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 2.0, + -1.25 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/dolphin.json b/src/generated/resources/assets/minecraft/train_hat_info/dolphin.json new file mode 100644 index 000000000..e81e49ce9 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/dolphin.json @@ -0,0 +1,9 @@ +{ + "model_part": "body/head", + "offset": [ + 0.0, + 3.0, + 0.0 + ], + "scale": 0.75 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/donkey.json b/src/generated/resources/assets/minecraft/train_hat_info/donkey.json new file mode 100644 index 000000000..178af4ab6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/donkey.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + 2.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/elder_guardian.json b/src/generated/resources/assets/minecraft/train_hat_info/elder_guardian.json new file mode 100644 index 000000000..cfe8bad25 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/elder_guardian.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 20.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/endermite.json b/src/generated/resources/assets/minecraft/train_hat_info/endermite.json new file mode 100644 index 000000000..91e9d9792 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/endermite.json @@ -0,0 +1,9 @@ +{ + "model_part": "segment0", + "offset": [ + 0.0, + 2.5, + 0.5 + ], + "scale": 0.75 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/fox.json b/src/generated/resources/assets/minecraft/train_hat_info/fox.json new file mode 100644 index 000000000..fbb2b1afe --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/fox.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.75, + 2.5, + -2.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/frog.json b/src/generated/resources/assets/minecraft/train_hat_info/frog.json new file mode 100644 index 000000000..9eeb16897 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/frog.json @@ -0,0 +1,9 @@ +{ + "model_part": "body/head", + "offset": [ + 0.0, + -3.0, + -4.25 + ], + "scale": 0.5 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/ghast.json b/src/generated/resources/assets/minecraft/train_hat_info/ghast.json new file mode 100644 index 000000000..fb933a1d3 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/ghast.json @@ -0,0 +1,8 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 6.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/glow_squid.json b/src/generated/resources/assets/minecraft/train_hat_info/glow_squid.json new file mode 100644 index 000000000..fb933a1d3 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/glow_squid.json @@ -0,0 +1,8 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 6.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/goat.json b/src/generated/resources/assets/minecraft/train_hat_info/goat.json new file mode 100644 index 000000000..8ba63e0e1 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/goat.json @@ -0,0 +1,9 @@ +{ + "model_part": "nose", + "offset": [ + -0.5, + 2.0, + 0.0 + ], + "scale": 0.5 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/guardian.json b/src/generated/resources/assets/minecraft/train_hat_info/guardian.json new file mode 100644 index 000000000..cfe8bad25 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/guardian.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 20.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/hoglin.json b/src/generated/resources/assets/minecraft/train_hat_info/hoglin.json new file mode 100644 index 000000000..095c992a5 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/hoglin.json @@ -0,0 +1,8 @@ +{ + "offset": [ + 0.0, + 0.0, + -4.5 + ], + "scale": 0.5 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/horse.json b/src/generated/resources/assets/minecraft/train_hat_info/horse.json new file mode 100644 index 000000000..178af4ab6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/horse.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + 2.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/iron_golem.json b/src/generated/resources/assets/minecraft/train_hat_info/iron_golem.json new file mode 100644 index 000000000..6830caadb --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/iron_golem.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + -2.0, + -1.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/magma_cube.json b/src/generated/resources/assets/minecraft/train_hat_info/magma_cube.json new file mode 100644 index 000000000..cd7d5d380 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/magma_cube.json @@ -0,0 +1,8 @@ +{ + "model_part": "cube7", + "offset": [ + 0.0, + 16.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/mooshroom.json b/src/generated/resources/assets/minecraft/train_hat_info/mooshroom.json new file mode 100644 index 000000000..8dbcd18e0 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/mooshroom.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 3.0, + -1.75 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/mule.json b/src/generated/resources/assets/minecraft/train_hat_info/mule.json new file mode 100644 index 000000000..178af4ab6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/mule.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + 2.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/ocelot.json b/src/generated/resources/assets/minecraft/train_hat_info/ocelot.json new file mode 100644 index 000000000..9ca43b52b --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/ocelot.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 1.0, + -0.25 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/panda.json b/src/generated/resources/assets/minecraft/train_hat_info/panda.json new file mode 100644 index 000000000..68fa03ac3 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/panda.json @@ -0,0 +1,8 @@ +{ + "offset": [ + 0.0, + 4.0, + 0.5 + ], + "scale": 0.75 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/parrot.json b/src/generated/resources/assets/minecraft/train_hat_info/parrot.json new file mode 100644 index 000000000..5c8b3ea04 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/parrot.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + -1.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/phantom.json b/src/generated/resources/assets/minecraft/train_hat_info/phantom.json new file mode 100644 index 000000000..ca4b2c8ce --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/phantom.json @@ -0,0 +1,8 @@ +{ + "model_part": "body/head", + "offset": [ + 0.0, + 0.0, + -1.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/pig.json b/src/generated/resources/assets/minecraft/train_hat_info/pig.json new file mode 100644 index 000000000..3077b65b7 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/pig.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 3.0, + -4.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/polar_bear.json b/src/generated/resources/assets/minecraft/train_hat_info/polar_bear.json new file mode 100644 index 000000000..99a03dd80 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/polar_bear.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 3.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/pufferfish.json b/src/generated/resources/assets/minecraft/train_hat_info/pufferfish.json new file mode 100644 index 000000000..4b68fafab --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/pufferfish.json @@ -0,0 +1,9 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + -0.5, + 0.0 + ], + "scale": 0.75 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/ravager.json b/src/generated/resources/assets/minecraft/train_hat_info/ravager.json new file mode 100644 index 000000000..667c47567 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/ravager.json @@ -0,0 +1,8 @@ +{ + "model_part": "neck/head", + "offset": [ + 0.0, + 0.0, + -5.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/salmon.json b/src/generated/resources/assets/minecraft/train_hat_info/salmon.json new file mode 100644 index 000000000..878378c44 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/salmon.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 1.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/sheep.json b/src/generated/resources/assets/minecraft/train_hat_info/sheep.json new file mode 100644 index 000000000..fc93bd641 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/sheep.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.5, + -0.75 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/silverfish.json b/src/generated/resources/assets/minecraft/train_hat_info/silverfish.json new file mode 100644 index 000000000..412fa10a9 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/silverfish.json @@ -0,0 +1,8 @@ +{ + "model_part": "segment1", + "offset": [ + 0.0, + 3.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/skeleton_horse.json b/src/generated/resources/assets/minecraft/train_hat_info/skeleton_horse.json new file mode 100644 index 000000000..178af4ab6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/skeleton_horse.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + 2.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/slime.json b/src/generated/resources/assets/minecraft/train_hat_info/slime.json new file mode 100644 index 000000000..5be7f8468 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/slime.json @@ -0,0 +1,9 @@ +{ + "model_part": "cube", + "offset": [ + 0.0, + 12.0, + 0.0 + ], + "scale": 1.25 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/sniffer.json b/src/generated/resources/assets/minecraft/train_hat_info/sniffer.json new file mode 100644 index 000000000..696363aa3 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/sniffer.json @@ -0,0 +1,8 @@ +{ + "model_part": "bone/body/head", + "offset": [ + 0.0, + 8.0, + -5.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/spider.json b/src/generated/resources/assets/minecraft/train_hat_info/spider.json new file mode 100644 index 000000000..11e5f6705 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/spider.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 2.0, + -3.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/squid.json b/src/generated/resources/assets/minecraft/train_hat_info/squid.json new file mode 100644 index 000000000..fb933a1d3 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/squid.json @@ -0,0 +1,8 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 6.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/strider.json b/src/generated/resources/assets/minecraft/train_hat_info/strider.json new file mode 100644 index 000000000..bee64acdf --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/strider.json @@ -0,0 +1,8 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 5.0, + 0.0 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/tadpole.json b/src/generated/resources/assets/minecraft/train_hat_info/tadpole.json new file mode 100644 index 000000000..613b6a166 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/tadpole.json @@ -0,0 +1,8 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 1.0, + 1.5 + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/tropical_fish.json b/src/generated/resources/assets/minecraft/train_hat_info/tropical_fish.json new file mode 100644 index 000000000..368adeb3b --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/tropical_fish.json @@ -0,0 +1,9 @@ +{ + "model_part": "body", + "offset": [ + 0.0, + 1.0, + -2.0 + ], + "scale": 0.5 +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/turtle.json b/src/generated/resources/assets/minecraft/train_hat_info/turtle.json new file mode 100644 index 000000000..ddc232582 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/turtle.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 3.0, + 0.0 + ] +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/warden.json b/src/generated/resources/assets/minecraft/train_hat_info/warden.json new file mode 100644 index 000000000..144345b6c --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/warden.json @@ -0,0 +1,9 @@ +{ + "model_part": "bone/body/head", + "offset": [ + 0.0, + -2.0, + 0.5 + ], + "scale": 0.5 +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/wither.json b/src/generated/resources/assets/minecraft/train_hat_info/wither.json new file mode 100644 index 000000000..63265f6db --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/wither.json @@ -0,0 +1,8 @@ +{ + "model_part": "center_head", + "offset": [ + 0.0, + 3.0, + 0.0 + ] +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/wolf.json b/src/generated/resources/assets/minecraft/train_hat_info/wolf.json new file mode 100644 index 000000000..38aa5ac03 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/wolf.json @@ -0,0 +1,8 @@ +{ + "model_part": "real_head", + "offset": [ + 0.5, + 2.5, + 0.25 + ] +} diff --git a/src/generated/resources/assets/minecraft/train_hat_info/zoglin.json b/src/generated/resources/assets/minecraft/train_hat_info/zoglin.json new file mode 100644 index 000000000..095c992a5 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/zoglin.json @@ -0,0 +1,8 @@ +{ + "offset": [ + 0.0, + 0.0, + -4.5 + ], + "scale": 0.5 +} \ No newline at end of file diff --git a/src/generated/resources/assets/minecraft/train_hat_info/zombie_horse.json b/src/generated/resources/assets/minecraft/train_hat_info/zombie_horse.json new file mode 100644 index 000000000..178af4ab6 --- /dev/null +++ b/src/generated/resources/assets/minecraft/train_hat_info/zombie_horse.json @@ -0,0 +1,7 @@ +{ + "offset": [ + 0.0, + 0.0, + 2.0 + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/api/data/TrainHatInfoProvider.java b/src/main/java/com/simibubi/create/api/data/TrainHatInfoProvider.java new file mode 100644 index 000000000..89caa700f --- /dev/null +++ b/src/main/java/com/simibubi/create/api/data/TrainHatInfoProvider.java @@ -0,0 +1,67 @@ +package com.simibubi.create.api.data; + +import com.mojang.serialization.JsonOps; +import com.simibubi.create.Create; +import com.simibubi.create.content.trains.schedule.hat.TrainHatInfo; + +import com.simibubi.create.content.trains.schedule.hat.TrainHatInfoReloadListener; + +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public abstract class TrainHatInfoProvider implements DataProvider { + private final PackOutput.PathProvider path; + protected final Map trainHatOffsets = new HashMap<>(); + + public TrainHatInfoProvider(PackOutput output) { + this.path = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, TrainHatInfoReloadListener.HAT_INFO_DIRECTORY); + } + + protected abstract void createOffsets(); + + protected void makeInfoFor(EntityType type, Vec3 offset) { + this.makeInfoFor(type, offset, "", 0, 1.0F); + } + + protected void makeInfoFor(EntityType type, Vec3 offset, String part) { + this.makeInfoFor(type, offset, part, 0, 1.0F); + } + + protected void makeInfoFor(EntityType type, Vec3 offset, float scale) { + this.makeInfoFor(type, offset, "", 0, scale); + } + + protected void makeInfoFor(EntityType type, Vec3 offset, String part, float scale) { + this.makeInfoFor(type, offset, part, 0, scale); + } + + protected void makeInfoFor(EntityType type, Vec3 offset, String part, int cubeIndex, float scale) { + this.trainHatOffsets.put(ForgeRegistries.ENTITY_TYPES.getKey(type), new TrainHatInfo(part, cubeIndex, offset, scale)); + } + + @Override + public CompletableFuture run(CachedOutput output) { + this.trainHatOffsets.clear(); + this.createOffsets(); + return CompletableFuture.allOf( + this.trainHatOffsets.entrySet().stream().map(entry -> + DataProvider.saveStable(output, + TrainHatInfo.CODEC.encodeStart(JsonOps.INSTANCE, entry.getValue()).resultOrPartial(Create.LOGGER::error).orElseThrow(), + this.path.json(entry.getKey())) + ).toArray(CompletableFuture[]::new)); + } + + @Override + public final String getName() { + return "Create Train Hat Information"; + } +} diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/TrainHatOffsets.java b/src/main/java/com/simibubi/create/content/trains/schedule/TrainHatOffsets.java deleted file mode 100644 index 772156ac7..000000000 --- a/src/main/java/com/simibubi/create/content/trains/schedule/TrainHatOffsets.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.simibubi.create.content.trains.schedule; - -import net.minecraft.client.model.AgeableListModel; -import net.minecraft.client.model.AxolotlModel; -import net.minecraft.client.model.BeeModel; -import net.minecraft.client.model.BlazeModel; -import net.minecraft.client.model.ChickenModel; -import net.minecraft.client.model.CowModel; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.FoxModel; -import net.minecraft.client.model.FrogModel; -import net.minecraft.client.model.GuardianModel; -import net.minecraft.client.model.HierarchicalModel; -import net.minecraft.client.model.HoglinModel; -import net.minecraft.client.model.IronGolemModel; -import net.minecraft.client.model.LavaSlimeModel; -import net.minecraft.client.model.OcelotModel; -import net.minecraft.client.model.PandaModel; -import net.minecraft.client.model.ParrotModel; -import net.minecraft.client.model.PigModel; -import net.minecraft.client.model.QuadrupedModel; -import net.minecraft.client.model.SheepModel; -import net.minecraft.client.model.SlimeModel; -import net.minecraft.client.model.SnowGolemModel; -import net.minecraft.client.model.SpiderModel; -import net.minecraft.client.model.WardenModel; -import net.minecraft.client.model.WolfModel; -import net.minecraft.world.phys.Vec3; - -public class TrainHatOffsets { - - // sorry - public static Vec3 getOffset(EntityModel model) { - - float x = 0; - float y = 0; - float z = 0; - - if (model instanceof AgeableListModel) { - if (model instanceof WolfModel) { - x += .5f; - y += 1.5f; - z += .25f; - } else if (model instanceof OcelotModel) { - y += 1f; - z -= .25f; - } else if (model instanceof ChickenModel) { - z -= .25f; - } else if (model instanceof FoxModel) { - x += .5f; - y += 2f; - z -= 1f; - } else if (model instanceof QuadrupedModel) { - y += 2f; - - if (model instanceof CowModel) - z -= 1.25f; - else if (model instanceof PandaModel) - z += .5f; - else if (model instanceof PigModel) - z -= 2f; - else if (model instanceof SheepModel) { - z -= .75f; - y -= 1.5f; - - } - } else if (model instanceof HoglinModel) - z -= 4.5f; - else if (model instanceof BeeModel) { - z -= .75f; - y -= 4f; - } else if (model instanceof AxolotlModel) { - z -= 5f; - y += .5f; - } - } - - if (model instanceof HierarchicalModel) { - if (model instanceof BlazeModel) - y += 4; - else if (model instanceof GuardianModel) - y += 20; - else if (model instanceof IronGolemModel) { - z -= 1.5f; - y -= 2f; - } else if (model instanceof SnowGolemModel) { - z -= .75f; - y -= 3f; - } else if (model instanceof SlimeModel || model instanceof LavaSlimeModel) { - y += 22; - } else if (model instanceof SpiderModel) { - z -= 3.5f; - y += 2f; - } else if (model instanceof ParrotModel) { - z -= 1.5f; - } else if (model instanceof WardenModel) { - y += 3.5f; - z += .5f; - } else if (model instanceof FrogModel) { - y += 16.75f; - z -= .25f; - } - } - - return new Vec3(x, y, z); - - } - -} diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/TrainHatArmorLayer.java b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatArmorLayer.java similarity index 63% rename from src/main/java/com/simibubi/create/content/trains/schedule/TrainHatArmorLayer.java rename to src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatArmorLayer.java index 6bd8c4a02..5d24d49ea 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/TrainHatArmorLayer.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatArmorLayer.java @@ -1,4 +1,4 @@ -package com.simibubi.create.content.trains.schedule; +package com.simibubi.create.content.trains.schedule.hat; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; @@ -11,14 +11,8 @@ import com.simibubi.create.foundation.render.CachedBufferer; import com.simibubi.create.foundation.utility.Couple; import net.minecraft.client.model.AgeableListModel; -import net.minecraft.client.model.AxolotlModel; import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.FrogModel; import net.minecraft.client.model.HierarchicalModel; -import net.minecraft.client.model.LavaSlimeModel; -import net.minecraft.client.model.SlimeModel; -import net.minecraft.client.model.WardenModel; -import net.minecraft.client.model.WolfModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.ModelPart.Cube; import net.minecraft.client.renderer.MultiBufferSource; @@ -30,6 +24,7 @@ import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; @@ -37,20 +32,19 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; + +import java.util.ArrayList; +import java.util.List; public class TrainHatArmorLayer> extends RenderLayer { - private Vec3 offset; - - public TrainHatArmorLayer(RenderLayerParent renderer, Vec3 offset) { + public TrainHatArmorLayer(RenderLayerParent renderer) { super(renderer); - this.offset = offset; } @Override - public void render(PoseStack ms, MultiBufferSource buffer, int light, LivingEntity entity, float yaw, float pitch, - float pt, float p_225628_8_, float p_225628_9_, float p_225628_10_) { + public void render(PoseStack ms, MultiBufferSource buffer, int light, LivingEntity entity, float limbSwing, float limbSwingAmount, + float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { if (!shouldRenderOn(entity)) return; @@ -58,9 +52,9 @@ public class TrainHatArmorLayer RenderType renderType = Sheets.cutoutBlockSheet(); ms.pushPose(); - boolean valid = false; TransformStack msr = TransformStack.cast(ms); - float scale = 1; + TrainHatInfo info = TrainHatInfoReloadListener.getHatInfoFor(entity.getType()); + List partsToHead = new ArrayList<>(); if (entityModel instanceof AgeableListModel model) { if (model.young) { @@ -73,61 +67,31 @@ public class TrainHatArmorLayer ModelPart head = getHeadPart(model); if (head != null) { - head.translateAndRotate(ms); - - if (model instanceof WolfModel) - head = head.getChild("real_head"); - if (model instanceof AxolotlModel) - head = head.getChild("head"); - - ms.translate(offset.x / 16f, offset.y / 16f, offset.z / 16f); - - if (!head.isEmpty()) { - Cube cube = head.cubes.get(0); - ms.translate(offset.x / 16f, (cube.minY - cube.maxY + offset.y) / 16f, offset.z / 16f); - float max = Math.max(cube.maxX - cube.minX, cube.maxZ - cube.minZ) / 8f; - ms.scale(max, max, max); - } - - valid = true; + partsToHead.addAll(TrainHatInfo.getAdjustedPart(info, head, "")); } + } else if (entityModel instanceof HierarchicalModel model) { + partsToHead.addAll(TrainHatInfo.getAdjustedPart(info, model.root(), "head")); } - else if (entityModel instanceof HierarchicalModel model) { - boolean slime = model instanceof SlimeModel || model instanceof LavaSlimeModel; - ModelPart head = model.root().children.get(slime ? "cube" : "head"); + if (!partsToHead.isEmpty()) { + partsToHead.forEach(part -> part.translateAndRotate(ms)); - if (model instanceof WardenModel) - head = model.root().children.get("bone").children.get("body").children.get("head"); - - if (model instanceof FrogModel) { - head = model.root().children.get("body").children.get("head"); - scale = .5f; + ModelPart lastChild = partsToHead.get(partsToHead.size() - 1); + if (!lastChild.isEmpty()) { + Cube cube = lastChild.cubes.get(Mth.clamp(info.cubeIndex(), 0, lastChild.cubes.size() - 1)); + ms.translate(info.offset().x() / 16.0F, (cube.minY - cube.maxY + info.offset().y()) / 16.0F, info.offset().z() / 16.0F); + float max = Math.max(cube.maxX - cube.minX, cube.maxZ - cube.minZ) / 8.0F * info.scale(); + ms.scale(max, max, max); } - if (head != null) { - head.translateAndRotate(ms); - - if (!head.isEmpty()) { - Cube cube = head.cubes.get(0); - ms.translate(offset.x, (cube.minY - cube.maxY + offset.y) / 16f, offset.z / 16f); - float max = Math.max(cube.maxX - cube.minX, cube.maxZ - cube.minZ) / (slime ? 6.5f : 8f) * scale; - ms.scale(max, max, max); - } - - valid = true; - } - } - - if (valid) { ms.scale(1, -1, -1); - ms.translate(0, -2.25f / 16f, 0); - msr.rotateX(-8.5f); + ms.translate(0, -2.25F / 16.0F, 0); + msr.rotateX(-8.5F); BlockState air = Blocks.AIR.defaultBlockState(); CachedBufferer.partial(AllPartialModels.TRAIN_HAT, air) - .forEntityRender() - .light(light) - .renderInto(ms, buffer.getBuffer(renderType)); + .forEntityRender() + .light(light) + .renderInto(ms, buffer.getBuffer(renderType)); } ms.popPose(); @@ -137,7 +101,7 @@ public class TrainHatArmorLayer if (entity == null) return false; if (entity.getPersistentData() - .contains("TrainHat")) + .contains("TrainHat")) return true; if (!entity.isPassenger()) return false; @@ -163,13 +127,13 @@ public class TrainHatArmorLayer public static void registerOnAll(EntityRenderDispatcher renderManager) { for (EntityRenderer renderer : renderManager.getSkinMap() - .values()) + .values()) registerOn(renderer); for (EntityRenderer renderer : renderManager.renderers.values()) registerOn(renderer); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void registerOn(EntityRenderer entityRenderer) { if (!(entityRenderer instanceof LivingEntityRenderer livingRenderer)) return; @@ -179,9 +143,7 @@ public class TrainHatArmorLayer if (!(model instanceof HierarchicalModel) && !(model instanceof AgeableListModel)) return; - Vec3 offset = TrainHatOffsets.getOffset(model); - TrainHatArmorLayer layer = new TrainHatArmorLayer<>(livingRenderer, offset); - livingRenderer.addLayer((TrainHatArmorLayer) layer); + livingRenderer.addLayer((TrainHatArmorLayer) new TrainHatArmorLayer<>(livingRenderer)); } private static ModelPart getHeadPart(AgeableListModel model) { diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfo.java b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfo.java new file mode 100644 index 000000000..5f4d89ac1 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfo.java @@ -0,0 +1,40 @@ +package com.simibubi.create.content.trains.schedule.hat; + +import java.util.ArrayList; +import java.util.List; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.world.phys.Vec3; + +public record TrainHatInfo(String part, int cubeIndex, Vec3 offset, float scale) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.STRING.optionalFieldOf("model_part", "").forGetter(TrainHatInfo::part), + Codec.INT.optionalFieldOf("cube_index", 0).forGetter(TrainHatInfo::cubeIndex), + Vec3.CODEC.fieldOf("offset").forGetter(TrainHatInfo::offset), + Codec.FLOAT.optionalFieldOf("scale", 1.0F).forGetter(TrainHatInfo::scale) + ).apply(instance, TrainHatInfo::new)); + + public static List getAdjustedPart(TrainHatInfo info, ModelPart root, String defaultPart) { + List finalParts = new ArrayList<>(); + finalParts.add(root); + ModelPart parent = root; + if (!info.part().isEmpty() && !info.part().equals(defaultPart)) { + String[] partList = info.part().split("/"); + for (String part : partList) { + if (parent.children.containsKey(part)) { + finalParts.add(parent.children.get(part)); + parent = parent.children.get(part); + } + } + } else { + if (parent.children.containsKey(defaultPart)) { + finalParts.add(parent.children.get(defaultPart)); + } + } + + return finalParts; + } +} diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfoReloadListener.java b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfoReloadListener.java new file mode 100644 index 000000000..58e3cd8a9 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/trains/schedule/hat/TrainHatInfoReloadListener.java @@ -0,0 +1,52 @@ +package com.simibubi.create.content.trains.schedule.hat; + +import java.io.BufferedReader; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.mojang.serialization.JsonOps; +import com.simibubi.create.Create; + +import net.minecraft.resources.FileToIdConverter; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceManagerReloadListener; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.registries.ForgeRegistries; + +public class TrainHatInfoReloadListener { + + private static final Map, TrainHatInfo> ENTITY_INFO_MAP = new HashMap<>(); + public static final String HAT_INFO_DIRECTORY = "train_hat_info"; + public static final ResourceManagerReloadListener LISTENER = TrainHatInfoReloadListener::registerOffsetOverrides; + private static final TrainHatInfo DEFAULT = new TrainHatInfo("", 0, Vec3.ZERO, 1.0F); + + private static void registerOffsetOverrides(ResourceManager manager) { + ENTITY_INFO_MAP.clear(); + + FileToIdConverter converter = FileToIdConverter.json(HAT_INFO_DIRECTORY); + converter.listMatchingResources(manager).forEach((location, resource) -> { + String[] splitPath = location.getPath().split("/"); + ResourceLocation entityName = new ResourceLocation(location.getNamespace(), splitPath[splitPath.length - 1].replace(".json", "")); + if (!ForgeRegistries.ENTITY_TYPES.containsKey(entityName)) { + Create.LOGGER.error("Failed to load train hat info for entity {} as it does not exist.", entityName); + return; + } + + try (BufferedReader reader = resource.openAsReader()) { + JsonObject json = GsonHelper.parse(reader); + ENTITY_INFO_MAP.put(ForgeRegistries.ENTITY_TYPES.getValue(entityName), TrainHatInfo.CODEC.parse(JsonOps.INSTANCE, json).resultOrPartial(Create.LOGGER::error).orElseThrow()); + } catch (Exception e) { + Create.LOGGER.error("Failed to read train hat info for entity {}!", entityName, e); + } + }); + Create.LOGGER.info("Loaded {} train hat configurations.", ENTITY_INFO_MAP.size()); + } + + public static TrainHatInfo getHatInfoFor(EntityType type) { + return ENTITY_INFO_MAP.getOrDefault(type, DEFAULT); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java b/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java index c18d60f4f..c83d5522f 100644 --- a/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java @@ -41,7 +41,8 @@ import com.simibubi.create.content.trains.TrainHUD; import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; import com.simibubi.create.content.trains.entity.CarriageCouplingRenderer; import com.simibubi.create.content.trains.entity.TrainRelocator; -import com.simibubi.create.content.trains.schedule.TrainHatArmorLayer; +import com.simibubi.create.content.trains.schedule.hat.TrainHatArmorLayer; +import com.simibubi.create.content.trains.schedule.hat.TrainHatInfoReloadListener; import com.simibubi.create.content.trains.track.CurvedTrackInteraction; import com.simibubi.create.content.trains.track.TrackBlockOutline; import com.simibubi.create.content.trains.track.TrackPlacement; @@ -207,7 +208,7 @@ public class ClientEvents { public static void onRenderWorld(RenderLevelStageEvent event) { if (event.getStage() != Stage.AFTER_PARTICLES) return; - + PoseStack ms = event.getPoseStack(); ms.pushPose(); SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); @@ -333,6 +334,7 @@ public class ClientEvents { @SubscribeEvent public static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { event.registerReloadListener(CreateClient.RESOURCE_RELOAD_LISTENER); + event.registerReloadListener(TrainHatInfoReloadListener.LISTENER); } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/infrastructure/data/CreateDatagen.java b/src/main/java/com/simibubi/create/infrastructure/data/CreateDatagen.java index 01a13c2e6..c41a7baad 100644 --- a/src/main/java/com/simibubi/create/infrastructure/data/CreateDatagen.java +++ b/src/main/java/com/simibubi/create/infrastructure/data/CreateDatagen.java @@ -45,13 +45,14 @@ public class CreateDatagen { GeneratedEntriesProvider generatedEntriesProvider = new GeneratedEntriesProvider(output, lookupProvider); lookupProvider = generatedEntriesProvider.getRegistryProvider(); generator.addProvider(true, generatedEntriesProvider); - + generator.addProvider(true, new CreateRecipeSerializerTagsProvider(output, lookupProvider, existingFileHelper)); generator.addProvider(true, new DamageTypeTagGen(output, lookupProvider, existingFileHelper)); generator.addProvider(true, new AllAdvancements(output)); generator.addProvider(true, new StandardRecipeGen(output)); generator.addProvider(true, new MechanicalCraftingRecipeGen(output)); generator.addProvider(true, new SequencedAssemblyRecipeGen(output)); + generator.addProvider(true, new VanillaHatOffsetGenerator(output)); ProcessingRecipeGen.registerAll(generator, output); } } diff --git a/src/main/java/com/simibubi/create/infrastructure/data/VanillaHatOffsetGenerator.java b/src/main/java/com/simibubi/create/infrastructure/data/VanillaHatOffsetGenerator.java new file mode 100644 index 000000000..535307e8d --- /dev/null +++ b/src/main/java/com/simibubi/create/infrastructure/data/VanillaHatOffsetGenerator.java @@ -0,0 +1,68 @@ +package com.simibubi.create.infrastructure.data; + +import com.simibubi.create.api.data.TrainHatInfoProvider; + +import net.minecraft.data.PackOutput; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.phys.Vec3; + +public class VanillaHatOffsetGenerator extends TrainHatInfoProvider { + public VanillaHatOffsetGenerator(PackOutput output) { + super(output); + } + + @Override + protected void createOffsets() { + this.makeInfoFor(EntityType.AXOLOTL, new Vec3(0.0F, 1.0F, -2.0F), "head", 0.75F); + this.makeInfoFor(EntityType.BAT, new Vec3(0.0F, 3.0F, 0.0F)); + this.makeInfoFor(EntityType.BEE, new Vec3(0.0F, 2.0F, -2.0F), "body", 0.5F); + this.makeInfoFor(EntityType.BLAZE, new Vec3(0.0F, 4.0F, 0.0F)); + this.makeInfoFor(EntityType.CAMEL, new Vec3(0.0F, -8.0F, -11.5F), "body/head", 1, 1.0F); + this.makeInfoFor(EntityType.CAT, new Vec3(0.0F, 1.0F, -0.25F)); + this.makeInfoFor(EntityType.CAVE_SPIDER, new Vec3(0.0F, 2.0F, -3.5F)); + this.makeInfoFor(EntityType.CHICKEN, new Vec3(0.0F, 0.0F, -0.25F)); + this.makeInfoFor(EntityType.COD, new Vec3(0.0F, 10.0F, 0.0F)); + this.makeInfoFor(EntityType.COW, new Vec3(0.0F, 2.0F, -1.25F)); + this.makeInfoFor(EntityType.DOLPHIN, new Vec3(0.0F, 3.0F, 0.0F), "body/head", 0.75F); + this.makeInfoFor(EntityType.DONKEY, new Vec3(0.0F, 0.0F, 2.0F)); + this.makeInfoFor(EntityType.ELDER_GUARDIAN, new Vec3(0.0F, 20.0F, 0.0F)); + this.makeInfoFor(EntityType.ENDERMITE, new Vec3(0.0F, 2.5F, 0.5F), "segment0", 0.75F); + this.makeInfoFor(EntityType.FOX, new Vec3(0.75F, 2.5F, -2.0F)); + this.makeInfoFor(EntityType.FROG, new Vec3(0.0F, -3.0F, -4.25F), "body/head", 0.5F); + this.makeInfoFor(EntityType.GHAST, new Vec3(0.0F, 6.0F, 0.0F), "body"); + this.makeInfoFor(EntityType.GLOW_SQUID, new Vec3(0.0F, 6.0F, 0.0F), "body"); + this.makeInfoFor(EntityType.GOAT, new Vec3(-0.5F, 2.0F, 0.0F), "nose", 0.5F); + this.makeInfoFor(EntityType.GUARDIAN, new Vec3(0.0F, 20.0F, 0.0F)); + this.makeInfoFor(EntityType.HOGLIN, new Vec3(0.0F, 0.0F, -4.5F), 0.5F); + this.makeInfoFor(EntityType.HORSE, new Vec3(0.0F, 0.0F, 2.0F)); + this.makeInfoFor(EntityType.IRON_GOLEM, new Vec3(0.0F, -2.0F, -1.5F)); + this.makeInfoFor(EntityType.MAGMA_CUBE, new Vec3(0.0F, 16.0F, 0.0F), "cube7"); + this.makeInfoFor(EntityType.MOOSHROOM, new Vec3(0.0F, 3.0F, -1.75F)); + this.makeInfoFor(EntityType.MULE, new Vec3(0.0F, 0.0F, 2.0F)); + this.makeInfoFor(EntityType.OCELOT, new Vec3(0.0F, 1.0F, -0.25F)); + this.makeInfoFor(EntityType.PANDA, new Vec3(0.0F, 4.0F, 0.5F), 0.75F); + this.makeInfoFor(EntityType.PARROT, new Vec3(0.0F, 0.0F, -1.5F)); + this.makeInfoFor(EntityType.PHANTOM, new Vec3(0.0F, 0.0F, -1.0F), "body/head"); + this.makeInfoFor(EntityType.PIG, new Vec3(0.0F, 3.0F, -4.0F)); + this.makeInfoFor(EntityType.POLAR_BEAR, new Vec3(0.0F, 3.0F, 0.0F)); + this.makeInfoFor(EntityType.PUFFERFISH, new Vec3(0.0F, -0.5F, 0.0F), "body", 0.75F); + this.makeInfoFor(EntityType.RAVAGER, new Vec3(0.0F, 0.0F, -5.5F), "neck/head"); + this.makeInfoFor(EntityType.SALMON, new Vec3(0.0F, 1.0F, 0.0F)); + this.makeInfoFor(EntityType.SHEEP, new Vec3(0.0F, 0.5F, -0.75F)); + this.makeInfoFor(EntityType.SILVERFISH, new Vec3(0.0F, 3.0F, 0.0F), "segment1"); + this.makeInfoFor(EntityType.SKELETON_HORSE, new Vec3(0.0F, 0.0F, 2.0F)); + this.makeInfoFor(EntityType.SLIME, new Vec3(0.0F, 12.0F, 0.0F), "cube", 1.25F); + this.makeInfoFor(EntityType.SNIFFER, new Vec3(0.0F, 8.0F, -5.0F), "bone/body/head"); + this.makeInfoFor(EntityType.SPIDER, new Vec3(0.0F, 2.0F, -3.5F)); + this.makeInfoFor(EntityType.SQUID, new Vec3(0.0F, 6.0F, 0.0F), "body"); + this.makeInfoFor(EntityType.STRIDER, new Vec3(0.0F, 5.0F, 0.0F), "body"); + this.makeInfoFor(EntityType.TADPOLE, new Vec3(0.0F, 1.0F, 1.5F), "body"); + this.makeInfoFor(EntityType.TROPICAL_FISH, new Vec3(0.0F, 0.0F, 0.0F), "body", 0.5F); + this.makeInfoFor(EntityType.TURTLE, new Vec3(0.0F, 2.0F, 0.0F)); + this.makeInfoFor(EntityType.WARDEN, new Vec3(0.0F, 3.5F, 0.5F), "bone/body/head", 0.5F); + this.makeInfoFor(EntityType.WITHER, new Vec3(0.0F, -5.0F, 0.0F)); + this.makeInfoFor(EntityType.WOLF, new Vec3(0.5F, 1.5F, 0.25F)); + this.makeInfoFor(EntityType.ZOGLIN, new Vec3(0.0F, 0.0F, -4.5F), 0.5F); + this.makeInfoFor(EntityType.ZOMBIE_HORSE, new Vec3(0.0F, 0.0F, 2.0F)); + } +}