From 520983d5d05425d80a2cd02d7e85f116b88b71ad Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 9 May 2022 17:23:57 +0200 Subject: [PATCH] Out of bounds - Increased distance at which activated whistles can be heard - Super glue captured by schematics or /c clone now gets cropped to the selected boundary - Controlled contraptions now save their anchor block position in relative coords --- src/generated/resources/.cache/cache | 34 +++++------ .../resources/assets/create/lang/en_us.json | 4 +- .../assets/create/lang/unfinished/de_de.json | 4 +- .../assets/create/lang/unfinished/es_cl.json | 4 +- .../assets/create/lang/unfinished/es_es.json | 4 +- .../assets/create/lang/unfinished/fr_fr.json | 4 +- .../assets/create/lang/unfinished/it_it.json | 4 +- .../assets/create/lang/unfinished/ja_jp.json | 4 +- .../assets/create/lang/unfinished/ko_kr.json | 4 +- .../assets/create/lang/unfinished/nl_nl.json | 4 +- .../assets/create/lang/unfinished/pl_pl.json | 4 +- .../assets/create/lang/unfinished/pt_br.json | 4 +- .../assets/create/lang/unfinished/pt_pt.json | 4 +- .../assets/create/lang/unfinished/ro_ro.json | 4 +- .../assets/create/lang/unfinished/ru_ru.json | 4 +- .../assets/create/lang/unfinished/zh_cn.json | 4 +- .../assets/create/lang/unfinished/zh_tw.json | 4 +- .../resources/assets/create/sounds.json | 58 +++++++++++++++---- .../com/simibubi/create/AllSoundEvents.java | 37 +++++++++--- .../steam/whistle/WhistleSoundInstance.java | 17 ++---- .../steam/whistle/WhistleTileEntity.java | 7 ++- .../ControlledContraptionEntity.java | 29 ++++++---- .../glue/SuperGlueEntity.java | 24 +++++++- .../schematics/ServerSchematicLoader.java | 39 +++++++++---- .../client/SchematicAndQuillHandler.java | 8 ++- .../item/SchematicAndQuillItem.java | 57 ++++++++++++++++++ .../foundation/command/CloneCommand.java | 26 +++------ 27 files changed, 273 insertions(+), 127 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 91b90fe9b..e172e4484 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -544,22 +544,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json 875f9aff979888b9d63d6a425cbf544431f1af5a assets/create/lang/en_ud.json -1ad377f4a615552b93c377ca77d09d9c3cf72056 assets/create/lang/en_us.json -52303333ebdc11d4777bebc86200897dbb4a49a6 assets/create/lang/unfinished/de_de.json -c523a1dd9f0ea330f529359bb578de3df2bc1458 assets/create/lang/unfinished/es_cl.json -099f7b1f415189ece3f4601c5934d812ba27ec33 assets/create/lang/unfinished/es_es.json -77132328aec11c2d2489eebf7d7b5d6cbeea65c2 assets/create/lang/unfinished/fr_fr.json -400aedaa547301ac8f35aed1f0e804bba3439a4c assets/create/lang/unfinished/it_it.json -47e91eb3f234db0148251fc587dcf4dfcd03cf4d assets/create/lang/unfinished/ja_jp.json -d7b445abbf9189e0c2bb05a49948ec8515f43b76 assets/create/lang/unfinished/ko_kr.json -d870830f76c5e268f43af5b53187ac8efecd0a84 assets/create/lang/unfinished/nl_nl.json -6b3fcb59cec2b318a63dac081f677d90ae3774c6 assets/create/lang/unfinished/pl_pl.json -863971974b1d54b141c7b1d2a725ec1fd073edc6 assets/create/lang/unfinished/pt_br.json -1dec98db8807133fd2060957b35bf506bfad97ab assets/create/lang/unfinished/pt_pt.json -73d43d4434793a145f8a6cba865a3563b674f43b assets/create/lang/unfinished/ro_ro.json -a07148fa0254c4b9a4a47026f6da8c91f5a718ab assets/create/lang/unfinished/ru_ru.json -39e11d9262999468a4a5b61986aead6a9263c75d assets/create/lang/unfinished/zh_cn.json -754ad714ec33c27bb1b546fc12798d422beb865b assets/create/lang/unfinished/zh_tw.json +c8e4df6292133a1873e4dccb34c00b1e52afcd92 assets/create/lang/en_us.json +3ca43c518fc5c0120b5cf2aaf37cc78f51625fd4 assets/create/lang/unfinished/de_de.json +128d3e35cf2d41dacdb54abd8562091f15323a8c assets/create/lang/unfinished/es_cl.json +f02d6b15275a22ac665303e6d7181998f408e1a7 assets/create/lang/unfinished/es_es.json +02e43d3f9d2527c2cd72f1a5bfe76397b6cfa32f assets/create/lang/unfinished/fr_fr.json +9f0982f15705f8c3f675f9dfac5b68a753ddf97a assets/create/lang/unfinished/it_it.json +84d0f74256115e505a239ed826b28002fbc67f86 assets/create/lang/unfinished/ja_jp.json +96dfb6f44098b2a44c4ba6c53ed6f42a4d7811f5 assets/create/lang/unfinished/ko_kr.json +5ea64ddc9613b72376220353819a477bf4c6d64d assets/create/lang/unfinished/nl_nl.json +dd81cd81f426833b627831530c77ab3f3655bb39 assets/create/lang/unfinished/pl_pl.json +7cdff911043ccc6232932f85825090305ce92426 assets/create/lang/unfinished/pt_br.json +ba139e8ea012ed05598ea5bb57ee6ac95693efdd assets/create/lang/unfinished/pt_pt.json +86ac8dc000591768856bbaa873f9d101faddc1cd assets/create/lang/unfinished/ro_ro.json +14988b8d3a0b97a7c6b49f392d5088fd59a3aaaa assets/create/lang/unfinished/ru_ru.json +99ffa28fe67913dda825628947e5763f0a21ee8a assets/create/lang/unfinished/zh_cn.json +01da3a96eb7aeea75afed38dd1a83321959fcf0a assets/create/lang/unfinished/zh_tw.json 487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json 3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json @@ -2155,7 +2155,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear 866fbb0ce2878a73e0440d1caf6534c8bd7c384f assets/create/models/item/zinc_ingot.json a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json -79691595de849f2821595483c6486501581c66cd assets/create/sounds.json +92c34840e05861f7f98aa2f942f9a90370f82cd6 assets/create/sounds.json 0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json 613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json 81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index de5842a1e..a8348c037 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1590,11 +1590,11 @@ "create.subtitle.wrench_rotate": "Wrench used", "create.subtitle.potato_hit": "Vegetable impacts", "create.subtitle.saw_activate_wood": "Mechanical Saw activates", - "create.subtitle.whistle_high": "Whistling", + "create.subtitle.whistle_high": "High whistling", "create.subtitle.haunted_bell_convert": "Haunted Bell awakens", "create.subtitle.deny": "Declining boop", "create.subtitle.controller_click": "Controller clicks", - "create.subtitle.whistle_low": "Whistling", + "create.subtitle.whistle_low": "Low whistling", "create.subtitle.schematicannon_launch_block": "Schematicannon fires", "create.subtitle.copper_armor_equip": "Diving equipment clinks", "create.subtitle.controller_take": "Lectern empties", 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 6b1448f04..ba1bd10d7 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Bauplankanone schießt", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_cl.json b/src/generated/resources/assets/create/lang/unfinished/es_cl.json index 598a279d1..cf040cab2 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_cl.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_cl.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "Llave Inglesa usada", "create.subtitle.potato_hit": "Impactos vegetales", "create.subtitle.saw_activate_wood": "Sierra Mecánica se activa", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "Campana Embrujada despierta", "create.subtitle.deny": "Boop denegante", "create.subtitle.controller_click": "Controlador cliquea", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Esquemacañón dispara", "create.subtitle.copper_armor_equip": "Equipo de Buceo tintinea", "create.subtitle.controller_take": "Atril se Vacía", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_es.json b/src/generated/resources/assets/create/lang/unfinished/es_es.json index 651bdb292..afa0eb6c1 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_es.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_es.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "Llave inglesa usada", "create.subtitle.potato_hit": "Impacto de vegetal", "create.subtitle.saw_activate_wood": "Sierra mecánica activada", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "Campana maldita se despierta", "create.subtitle.deny": "Pitido denegante", "create.subtitle.controller_click": "", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Esquematicañón dispara", "create.subtitle.copper_armor_equip": "Equipo de buceo tintinea", "create.subtitle.controller_take": "Atril vaciándose", 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 d9a7b6542..5f5e14a95 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Tir de schémacanon", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", 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 f436ec5eb..f968424c3 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Tiri del cannoneschematico", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", 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 57b97660f..97675bda5 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "レンチが使用される", "create.subtitle.potato_hit": "野菜の衝撃", "create.subtitle.saw_activate_wood": "メカニカルソーが動作する", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "憑りつかれた鐘が目覚める", "create.subtitle.deny": "失敗音", "create.subtitle.controller_click": "コントローラーのカチカチ音", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "概略図砲が発射する", "create.subtitle.copper_armor_equip": "潜水服がチャリンと鳴る", "create.subtitle.controller_take": "書見台が空になる", 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 1d798afbd..032930d2f 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "렌치를 사용함", "create.subtitle.potato_hit": "채소가 부딫힘", "create.subtitle.saw_activate_wood": "톱이 작동함", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "종에 귀신이 들림", "create.subtitle.deny": "취소음", "create.subtitle.controller_click": "조작기를 누름", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "청사진 대포가 발사함", "create.subtitle.copper_armor_equip": "잠수용 장비가 철커덕거림", "create.subtitle.controller_take": "독서대가 비워짐", 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 d0bc115d5..2a5ee0564 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "UNLOCALIZED: Schematicannon fires", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", diff --git a/src/generated/resources/assets/create/lang/unfinished/pl_pl.json b/src/generated/resources/assets/create/lang/unfinished/pl_pl.json index 40b34e04d..cfb2fc191 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pl_pl.json +++ b/src/generated/resources/assets/create/lang/unfinished/pl_pl.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "Klucz skrzypi", "create.subtitle.potato_hit": "Warzywo ląduje", "create.subtitle.saw_activate_wood": "Mechaniczna piła aktywuje się", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "Nawiedzony dzwon budzi się", "create.subtitle.deny": "Dźwięk odmowy", "create.subtitle.controller_click": "Sterownik klika", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Schematoarmata strzela", "create.subtitle.copper_armor_equip": "Sprzęt do nurkowania pobrzękuje", "create.subtitle.controller_take": "Pulpit opróżnia się", 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 52153e6f5..63512bdad 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "UNLOCALIZED: Schematicannon fires", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_pt.json b/src/generated/resources/assets/create/lang/unfinished/pt_pt.json index e2a9ee5be..b67ce3882 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_pt.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_pt.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "UNLOCALIZED: Vegetable impacts", "create.subtitle.saw_activate_wood": "UNLOCALIZED: Mechanical Saw activates", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "UNLOCALIZED: Haunted Bell awakens", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "UNLOCALIZED: Controller clicks", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "UNLOCALIZED: Schematicannon fires", "create.subtitle.copper_armor_equip": "UNLOCALIZED: Diving equipment clinks", "create.subtitle.controller_take": "UNLOCALIZED: Lectern empties", diff --git a/src/generated/resources/assets/create/lang/unfinished/ro_ro.json b/src/generated/resources/assets/create/lang/unfinished/ro_ro.json index f33766224..7a0c43bfe 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ro_ro.json +++ b/src/generated/resources/assets/create/lang/unfinished/ro_ro.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "Cheie folosită", "create.subtitle.potato_hit": "Impact de legumă", "create.subtitle.saw_activate_wood": "Ferăstrău Mecanic se activează", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "Clopot Bântuit se trezețte", "create.subtitle.deny": "Boop de refuz", "create.subtitle.controller_click": "Controlor clickuiește", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Tun de Schemă trage", "create.subtitle.copper_armor_equip": "Echipament de scufundare ciocăne", "create.subtitle.controller_take": "Pupitru se golește", 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 8bca57db9..aa5f5b619 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "Использован гаечный ключ", "create.subtitle.potato_hit": "Овощ врезается", "create.subtitle.saw_activate_wood": "Активируется механическая пила", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "Призрачный колокол пробуждается", "create.subtitle.deny": "Отрицательный «Буп»", "create.subtitle.controller_click": "Клики контроллера", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "Выстрелы схематичной пушки", "create.subtitle.copper_armor_equip": "Позвякивание снаряжения для дайвинга", "create.subtitle.controller_take": "Кафедра опустошается", 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 55592db1c..4b8a10998 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "扳手:拧动", "create.subtitle.potato_hit": "土豆:击中", "create.subtitle.saw_activate_wood": "动力锯:切割", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "奇异钟:转化", "create.subtitle.deny": "提示声:出错", "create.subtitle.controller_click": "遥控器:按下按钮", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "蓝图加农炮:发射", "create.subtitle.copper_armor_equip": "潜水装备:铿锵", "create.subtitle.controller_take": "讲台:取走物品", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 19eeffeae..66c18c141 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1591,11 +1591,11 @@ "create.subtitle.wrench_rotate": "UNLOCALIZED: Wrench used", "create.subtitle.potato_hit": "食物撞擊聲", "create.subtitle.saw_activate_wood": "機械鋸子運作聲", - "create.subtitle.whistle_high": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_high": "UNLOCALIZED: High whistling", "create.subtitle.haunted_bell_convert": "靈魂鐘轉化聲", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.controller_click": "遙控器按鍵聲", - "create.subtitle.whistle_low": "UNLOCALIZED: Whistling", + "create.subtitle.whistle_low": "UNLOCALIZED: Low whistling", "create.subtitle.schematicannon_launch_block": "藍圖大炮發射", "create.subtitle.copper_armor_equip": "潛水裝裝備聲", "create.subtitle.controller_take": "拿下遙控器", diff --git a/src/generated/resources/assets/create/sounds.json b/src/generated/resources/assets/create/sounds.json index 89fff5f05..fd39c82df 100644 --- a/src/generated/resources/assets/create/sounds.json +++ b/src/generated/resources/assets/create/sounds.json @@ -10,13 +10,19 @@ }, "chiff": { "sounds": [ - "create:chiff" + { + "name": "create:chiff", + "type": "file" + } ], "subtitle": "create.subtitle.chiff" }, "cogs": { "sounds": [ - "create:cogs" + { + "name": "create:cogs", + "type": "file" + } ], "subtitle": "create.subtitle.cogs" }, @@ -205,19 +211,28 @@ }, "fwoomp": { "sounds": [ - "create:fwoomp" + { + "name": "create:fwoomp", + "type": "file" + } ], "subtitle": "create.subtitle.fwoomp" }, "haunted_bell_convert": { "sounds": [ - "create:haunted_bell_convert" + { + "name": "create:haunted_bell_convert", + "type": "file" + } ], "subtitle": "create.subtitle.haunted_bell_convert" }, "haunted_bell_use": { "sounds": [ - "create:haunted_bell_use" + { + "name": "create:haunted_bell_use", + "type": "file" + } ], "subtitle": "create.subtitle.haunted_bell_use" }, @@ -300,14 +315,23 @@ }, "sanding_long": { "sounds": [ - "create:sanding_long" + { + "name": "create:sanding_long", + "type": "file" + } ], "subtitle": "create.subtitle.sanding_long" }, "sanding_short": { "sounds": [ - "create:sanding_short", - "create:sanding_short_1" + { + "name": "create:sanding_short", + "type": "file" + }, + { + "name": "create:sanding_short_1", + "type": "file" + } ], "subtitle": "create.subtitle.sanding_short" }, @@ -367,19 +391,31 @@ }, "whistle": { "sounds": [ - "create:whistle" + { + "name": "create:whistle", + "type": "file", + "attenuation_distance": 64 + } ], "subtitle": "create.subtitle.whistle" }, "whistle_high": { "sounds": [ - "create:whistle_high" + { + "name": "create:whistle_high", + "type": "file", + "attenuation_distance": 64 + } ], "subtitle": "create.subtitle.whistle_high" }, "whistle_low": { "sounds": [ - "create:whistle_low" + { + "name": "create:whistle_low", + "type": "file", + "attenuation_distance": 64 + } ], "subtitle": "create.subtitle.whistle_low" }, diff --git a/src/main/java/com/simibubi/create/AllSoundEvents.java b/src/main/java/com/simibubi/create/AllSoundEvents.java index 15fb96d0d..903313641 100644 --- a/src/main/java/com/simibubi/create/AllSoundEvents.java +++ b/src/main/java/com/simibubi/create/AllSoundEvents.java @@ -223,16 +223,19 @@ public class AllSoundEvents { .category(SoundSource.BLOCKS) .build(), - WHISTLE_HIGH = create("whistle_high").subtitle("Whistling") + WHISTLE_HIGH = create("whistle_high").subtitle("High whistling") .category(SoundSource.RECORDS) + .attenuationDistance(64) .build(), WHISTLE = create("whistle").subtitle("Whistling") .category(SoundSource.RECORDS) + .attenuationDistance(64) .build(), - WHISTLE_LOW = create("whistle_low").subtitle("Whistling") + WHISTLE_LOW = create("whistle_low").subtitle("Low whistling") .category(SoundSource.RECORDS) + .attenuationDistance(64) .build(), WHISTLE_CHIFF = create("chiff").noSubtitle() @@ -342,6 +345,7 @@ public class AllSoundEvents { protected SoundSource category = SoundSource.BLOCKS; protected List>> wrappedEvents; protected List variants; + protected int attenuationDistance; public SoundEntryBuilder(ResourceLocation id) { wrappedEvents = new ArrayList<>(); @@ -354,6 +358,11 @@ public class AllSoundEvents { return this; } + public SoundEntryBuilder attenuationDistance(int distance) { + this.attenuationDistance = distance; + return this; + } + public SoundEntryBuilder noSubtitle() { this.subtitle = null; return this; @@ -383,8 +392,9 @@ public class AllSoundEvents { } public SoundEntry build() { - SoundEntry entry = wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category) - : new WrappedSoundEntry(id, subtitle, wrappedEvents, category); + SoundEntry entry = + wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category, attenuationDistance) + : new WrappedSoundEntry(id, subtitle, wrappedEvents, category); entries.put(entry.getId(), entry); return entry; } @@ -550,11 +560,13 @@ public class AllSoundEvents { protected List variants; protected SoundEvent event; + protected int attenuationDistance; public CustomSoundEntry(ResourceLocation id, List variants, String subtitle, - SoundSource category) { + SoundSource category, int attenuationDistance) { super(id, subtitle, category); this.variants = variants; + this.attenuationDistance = attenuationDistance; } @Override @@ -577,9 +589,20 @@ public class AllSoundEvents { JsonObject entry = new JsonObject(); JsonArray list = new JsonArray(); - list.add(id.toString()); + JsonObject s = new JsonObject(); + s.addProperty("name", id.toString()); + s.addProperty("type", "file"); + if (attenuationDistance != 0) + s.addProperty("attenuation_distance", attenuationDistance); + list.add(s); + for (ResourceLocation variant : variants) { - list.add(variant.toString()); + s = new JsonObject(); + s.addProperty("name", variant.toString()); + s.addProperty("type", "file"); + if (attenuationDistance != 0) + s.addProperty("attenuation_distance", attenuationDistance); + list.add(s); } entry.add("sounds", list); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleSoundInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleSoundInstance.java index 3ba28622e..8908a378a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleSoundInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleSoundInstance.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.contraptions.components.steam.whistle; -import com.simibubi.create.AllSoundEvents; +import static com.simibubi.create.AllSoundEvents.WHISTLE; +import static com.simibubi.create.AllSoundEvents.WHISTLE_HIGH; +import static com.simibubi.create.AllSoundEvents.WHISTLE_LOW; + import com.simibubi.create.content.contraptions.components.steam.whistle.WhistleBlock.WhistleSize; -import net.minecraft.client.Minecraft; import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundSource; -import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec3; public class WhistleSoundInstance extends AbstractTickableSoundInstance { @@ -17,10 +18,8 @@ public class WhistleSoundInstance extends AbstractTickableSoundInstance { private WhistleSize size; public WhistleSoundInstance(WhistleSize size, BlockPos worldPosition) { - super( - (size == WhistleSize.SMALL ? AllSoundEvents.WHISTLE_HIGH - : size == WhistleSize.MEDIUM ? AllSoundEvents.WHISTLE : AllSoundEvents.WHISTLE_LOW).getMainEvent(), - SoundSource.RECORDS); + super((size == WhistleSize.SMALL ? WHISTLE_HIGH : size == WhistleSize.MEDIUM ? WHISTLE : WHISTLE_LOW) + .getMainEvent(), SoundSource.RECORDS); this.size = size; looping = true; active = true; @@ -51,11 +50,8 @@ public class WhistleSoundInstance extends AbstractTickableSoundInstance { @Override public void tick() { - Vec3 eyePosition = Minecraft.getInstance().cameraEntity.getEyePosition(); - float maxVolume = (float) Mth.clamp((30 - eyePosition.distanceTo(new Vec3(x, y, z))) / 30, 0, .75f); if (active) { volume = Math.min(1, volume + .25f); - volume = Math.min(volume, maxVolume); keepAlive--; if (keepAlive == 0) fadeOut(); @@ -63,7 +59,6 @@ public class WhistleSoundInstance extends AbstractTickableSoundInstance { } volume = Math.max(0, volume - .25f); - volume = Math.min(volume, maxVolume); if (volume == 0) stop(); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleTileEntity.java index 0fedfa42c..4e2dbfa1d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/steam/whistle/WhistleTileEntity.java @@ -25,6 +25,7 @@ import net.minecraft.core.Direction.Axis; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; +import net.minecraft.util.Mth; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; @@ -123,13 +124,15 @@ public class WhistleTileEntity extends SmartTileEntity implements IHaveGoggleInf float f = (float) Math.pow(2, -pitch / 12.0); boolean particle = level.getGameTime() % 8 == 0; + Vec3 eyePosition = Minecraft.getInstance().cameraEntity.getEyePosition(); + float maxVolume = (float) Mth.clamp((64 - eyePosition.distanceTo(Vec3.atCenterOf(worldPosition))) / 64, 0, 1); if (soundInstance == null || soundInstance.isStopped() || soundInstance.getOctave() != size) { Minecraft.getInstance() .getSoundManager() .play(soundInstance = new WhistleSoundInstance(size, worldPosition)); - AllSoundEvents.WHISTLE_CHIFF.playAt(level, worldPosition, 0.25f, size == WhistleSize.SMALL ? f + .75f : f, - true); + AllSoundEvents.WHISTLE_CHIFF.playAt(level, worldPosition, maxVolume * .175f, + size == WhistleSize.SMALL ? f + .75f : f, false); particle = true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index f9dcae6ca..c00fa8cad 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -50,11 +50,11 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { } @Override - public Vec3 getContactPointMotion(Vec3 globalContactPoint) { - if (contraption instanceof TranslatingContraption) - return getDeltaMovement(); - return super.getContactPointMotion(globalContactPoint); - } + public Vec3 getContactPointMotion(Vec3 globalContactPoint) { + if (contraption instanceof TranslatingContraption) + return getDeltaMovement(); + return super.getContactPointMotion(globalContactPoint); + } @Override protected void setContraption(Contraption contraption) { @@ -68,7 +68,11 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { @Override protected void readAdditional(CompoundTag compound, boolean spawnPacket) { super.readAdditional(compound, spawnPacket); - controllerPos = NbtUtils.readBlockPos(compound.getCompound("Controller")); + if (compound.contains("Controller")) // legacy + controllerPos = NbtUtils.readBlockPos(compound.getCompound("Controller")); + else + controllerPos = NbtUtils.readBlockPos(compound.getCompound("ControllerRelative")) + .offset(blockPosition()); if (compound.contains("Axis")) rotationAxis = NBTHelper.readEnum(compound, "Axis", Axis.class); angle = compound.getFloat("Angle"); @@ -77,7 +81,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { @Override protected void writeAdditional(CompoundTag compound, boolean spawnPacket) { super.writeAdditional(compound, spawnPacket); - compound.put("Controller", NbtUtils.writeBlockPos(controllerPos)); + compound.put("ControllerRelative", NbtUtils.writeBlockPos(controllerPos.subtract(blockPosition()))); if (rotationAxis != null) NBTHelper.writeEnum(compound, "Axis", rotationAxis); compound.putFloat("Angle", angle); @@ -168,7 +172,8 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { return false; if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) return false; - context.motion = Vec3.atLowerCornerOf(facing.getNormal()).scale(angleDelta / 360.0); + context.motion = Vec3.atLowerCornerOf(facing.getNormal()) + .scale(angleDelta / 360.0); context.relativeMotion = context.motion; int timer = context.data.getInt("StationaryTimer"); if (timer > 0) { @@ -227,9 +232,9 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { for (PoseStack stack : matrixStacks) TransformStack.cast(stack) - .nudge(getId()) - .centre() - .rotate(angle, axis) - .unCentre(); + .nudge(getId()) + .centre() + .rotate(angle, axis) + .unCentre(); } } 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 46899b9ae..f2bc5447d 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 @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.glue; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import com.simibubi.create.AllBlocks; @@ -26,6 +28,7 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; @@ -72,6 +75,20 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat return false; } + public static List collectCropped(Level level, AABB bb) { + List glue = new ArrayList<>(); + for (SuperGlueEntity glueEntity : level.getEntitiesOfClass(SuperGlueEntity.class, bb)) { + AABB glueBox = glueEntity.getBoundingBox(); + AABB intersect = bb.intersect(glueBox); + if (intersect.getXsize() * intersect.getYsize() * intersect.getZsize() == 0) + continue; + if (Mth.equal(intersect.getSize(), 1)) + continue; + glue.add(new SuperGlueEntity(level, intersect)); + } + return glue; + } + public SuperGlueEntity(EntityType type, Level world) { super(type, world); } @@ -148,10 +165,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat @Override public void setPos(double x, double y, double z) { + AABB bb = getBoundingBox(); setPosRaw(x, y, z); - getBoundingBox().move(getBoundingBox().getCenter() - .scale(-1) - .add(x, y, z)); + Vec3 center = bb.getCenter(); + setBoundingBox(bb.move(-center.x, -bb.minY, -center.z) + .move(x, y, z)); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 0584595ef..8980e2d93 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -35,6 +35,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; +import net.minecraft.world.phys.AABB; public class ServerSchematicLoader { @@ -89,8 +90,10 @@ public class ServerSchematicLoader { } public void handleNewUpload(ServerPlayer player, String schematic, long size, BlockPos pos) { - String playerPath = getSchematicPath() + "/" + player.getGameProfile().getName(); - String playerSchematicId = player.getGameProfile().getName() + "/" + schematic; + String playerPath = getSchematicPath() + "/" + player.getGameProfile() + .getName(); + String playerSchematicId = player.getGameProfile() + .getName() + "/" + schematic; FilesHelper.createFolderIfMissing(playerPath); // Unsupported Format @@ -99,9 +102,12 @@ public class ServerSchematicLoader { return; } - Path playerSchematicsPath = Paths.get(getSchematicPath(), player.getGameProfile().getName()).toAbsolutePath(); + Path playerSchematicsPath = Paths.get(getSchematicPath(), player.getGameProfile() + .getName()) + .toAbsolutePath(); - Path uploadPath = playerSchematicsPath.resolve(schematic).normalize(); + Path uploadPath = playerSchematicsPath.resolve(schematic) + .normalize(); if (!uploadPath.startsWith(playerSchematicsPath)) { Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId); return; @@ -171,7 +177,8 @@ public class ServerSchematicLoader { } public void handleWriteRequest(ServerPlayer player, String schematic, byte[] data) { - String playerSchematicId = player.getGameProfile().getName() + "/" + schematic; + String playerSchematicId = player.getGameProfile() + .getName() + "/" + schematic; if (activeUploads.containsKey(playerSchematicId)) { SchematicUploadEntry entry = activeUploads.get(playerSchematicId); @@ -241,7 +248,8 @@ public class ServerSchematicLoader { } public void handleFinishedUpload(ServerPlayer player, String schematic) { - String playerSchematicId = player.getGameProfile().getName() + "/" + schematic; + String playerSchematicId = player.getGameProfile() + .getName() + "/" + schematic; if (activeUploads.containsKey(playerSchematicId)) { try { @@ -262,7 +270,8 @@ public class ServerSchematicLoader { if (table == null) return; table.finishUpload(); - table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getGameProfile().getName())); + table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getGameProfile() + .getName())); } catch (IOException e) { Create.LOGGER.error("Exception Thrown when finishing Upload: " + playerSchematicId); @@ -273,8 +282,10 @@ public class ServerSchematicLoader { public void handleInstantSchematic(ServerPlayer player, String schematic, Level world, BlockPos pos, BlockPos bounds) { - String playerPath = getSchematicPath() + "/" + player.getGameProfile().getName(); - String playerSchematicId = player.getGameProfile().getName() + "/" + schematic; + String playerPath = getSchematicPath() + "/" + player.getGameProfile() + .getName(); + String playerSchematicId = player.getGameProfile() + .getName() + "/" + schematic; FilesHelper.createFolderIfMissing(playerPath); // Unsupported Format @@ -283,9 +294,11 @@ public class ServerSchematicLoader { return; } - Path schematicPath = Paths.get(getSchematicPath()).toAbsolutePath(); + Path schematicPath = Paths.get(getSchematicPath()) + .toAbsolutePath(); - Path path = schematicPath.resolve(playerSchematicId).normalize(); + Path path = schematicPath.resolve(playerSchematicId) + .normalize(); if (!path.startsWith(schematicPath)) { Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId); return; @@ -321,8 +334,10 @@ public class ServerSchematicLoader { try (OutputStream outputStream = Files.newOutputStream(path)) { CompoundTag nbttagcompound = t.save(new CompoundTag()); SchematicAndQuillItem.replaceStructureVoidWithAir(nbttagcompound); + SchematicAndQuillItem.clampGlueBoxes(world, new AABB(pos, pos.offset(bounds)), nbttagcompound); NbtIo.writeCompressed(nbttagcompound, outputStream); - player.setItemInHand(InteractionHand.MAIN_HAND, SchematicItem.create(schematic, player.getGameProfile().getName())); + player.setItemInHand(InteractionHand.MAIN_HAND, SchematicItem.create(schematic, player.getGameProfile() + .getName())); } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java index 263632574..482bc71a0 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicAndQuillHandler.java @@ -39,6 +39,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; @@ -190,8 +191,7 @@ public class SchematicAndQuillHandler { if (secondPos == null) { if (firstPos == null) return selectedPos == null ? null : new AABB(selectedPos); - return selectedPos == null ? new AABB(firstPos) - : new AABB(firstPos, selectedPos).expandTowards(1, 1, 1); + return selectedPos == null ? new AABB(firstPos) : new AABB(firstPos, selectedPos).expandTowards(1, 1, 1); } return new AABB(firstPos, secondPos).expandTowards(1, 1, 1); } @@ -210,8 +210,9 @@ public class SchematicAndQuillHandler { BoundingBox bb = BoundingBox.fromCorners(firstPos, secondPos); BlockPos origin = new BlockPos(bb.minX(), bb.minY(), bb.minZ()); BlockPos bounds = new BlockPos(bb.getXSpan(), bb.getYSpan(), bb.getZSpan()); + Level level = Minecraft.getInstance().level; - t.fillFromWorld(Minecraft.getInstance().level, origin, bounds, true, Blocks.AIR); + t.fillFromWorld(level, origin, bounds, true, Blocks.AIR); if (string.isEmpty()) string = Lang.translate("schematicAndQuill.fallbackName") @@ -228,6 +229,7 @@ public class SchematicAndQuillHandler { outputStream = Files.newOutputStream(path, StandardOpenOption.CREATE); CompoundTag nbttagcompound = t.save(new CompoundTag()); SchematicAndQuillItem.replaceStructureVoidWithAir(nbttagcompound); + SchematicAndQuillItem.clampGlueBoxes(level, new AABB(origin, origin.offset(bounds)), nbttagcompound); NbtIo.writeCompressed(nbttagcompound, outputStream); } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java b/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java index 193ff2ac1..e773b1322 100644 --- a/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/item/SchematicAndQuillItem.java @@ -1,10 +1,23 @@ package com.simibubi.create.content.schematics.item; +import java.util.Iterator; + +import com.simibubi.create.AllEntityTypes; +import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; import com.simibubi.create.foundation.utility.NBTHelper; +import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.DoubleTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; public class SchematicAndQuillItem extends Item { @@ -26,4 +39,48 @@ public class SchematicAndQuillItem extends Item { }); } + public static void clampGlueBoxes(Level level, AABB aabb, CompoundTag nbt) { + ListTag listtag = nbt.getList("entities", 10) + .copy(); + + for (Iterator iterator = listtag.iterator(); iterator.hasNext();) { + Tag tag = iterator.next(); + if (!(tag instanceof CompoundTag compoundtag)) + continue; + if (compoundtag.contains("nbt") && new ResourceLocation(compoundtag.getCompound("nbt") + .getString("id")).equals(AllEntityTypes.SUPER_GLUE.getId())) { + iterator.remove(); + } + } + + for (SuperGlueEntity entity : SuperGlueEntity.collectCropped(level, aabb)) { + Vec3 vec3 = new Vec3(entity.getX() - aabb.minX, entity.getY() - aabb.minY, entity.getZ() - aabb.minZ); + CompoundTag compoundtag = new CompoundTag(); + entity.save(compoundtag); + BlockPos blockpos = new BlockPos(vec3); + + CompoundTag entityTag = new CompoundTag(); + entityTag.put("pos", newDoubleList(vec3.x, vec3.y, vec3.z)); + entityTag.put("blockPos", newIntegerList(blockpos.getX(), blockpos.getY(), blockpos.getZ())); + entityTag.put("nbt", compoundtag.copy()); + listtag.add(entityTag); + } + + nbt.put("entities", listtag); + } + + private static ListTag newIntegerList(int... pValues) { + ListTag listtag = new ListTag(); + for (int i : pValues) + listtag.add(IntTag.valueOf(i)); + return listtag; + } + + private static ListTag newDoubleList(double... pValues) { + ListTag listtag = new ListTag(); + for (double d0 : pValues) + listtag.add(DoubleTag.valueOf(d0)); + return listtag; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java index 524c78b3f..11b68e60e 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java @@ -8,13 +8,11 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; -import com.simibubi.create.foundation.utility.Pair; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; @@ -27,6 +25,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; public class CloneCommand { @@ -89,22 +88,15 @@ public class CloneCommand { private static int cloneGlue(BoundingBox sourceArea, ServerLevel world, BlockPos diffToTarget) { int gluePastes = 0; - List glue = world.getEntitiesOfClass(SuperGlueEntity.class, AABB.of(sourceArea)); - List> newGlue = Lists.newArrayList(); + AABB bb = new AABB(sourceArea.minX(), sourceArea.minY(), sourceArea.minZ(), sourceArea.maxX() + 1, + sourceArea.maxY() + 1, sourceArea.maxZ() + 1); + for (SuperGlueEntity g : SuperGlueEntity.collectCropped(world, bb)) { + g.setPos(g.position() + .add(Vec3.atLowerCornerOf(diffToTarget))); + world.addFreshEntity(g); + gluePastes++; + } -// for (SuperGlueEntity g : glue) {TODO -// BlockPos pos = g.getHangingPosition(); -// Direction direction = g.getFacingDirection(); -// newGlue.add(Pair.of(pos.offset(diffToTarget), direction)); -// } -// -// for (Pair p : newGlue) { -// SuperGlueEntity g = new SuperGlueEntity(world, p.getFirst(), p.getSecond()); -// if (g.onValidSurface()) { -// world.addFreshEntity(g); -// gluePastes++; -// } -// } return gluePastes; }