From 187c448513628cf1ad012540a63c90782fdf549f Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Thu, 6 May 2021 16:40:33 +0200 Subject: [PATCH] Deploying items on items - Added the Deploying recipe type - Deployers can now polish items on belts or depots - Deployers now make a little polishing sound when using sandpaper --- src/generated/resources/.cache/cache | 32 ++--- .../resources/assets/create/lang/en_us.json | 2 + .../assets/create/lang/unfinished/de_de.json | 4 +- .../assets/create/lang/unfinished/es_es.json | 4 +- .../assets/create/lang/unfinished/es_mx.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/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 | 9 ++ .../data/create/advancements/aesthetics.json | 4 +- .../com/simibubi/create/AllRecipeTypes.java | 2 + .../com/simibubi/create/AllSoundEvents.java | 5 + .../simibubi/create/compat/jei/CreateJEI.java | 10 ++ .../jei/category/DeployingCategory.java | 68 ++++++++++ .../category/animations/AnimatedDeployer.java | 61 +++++++++ .../deployer/BeltDeployerCallbacks.java | 123 ++++++++++++++++++ .../deployer/DeployerApplicationRecipe.java | 66 ++++++++++ .../components/deployer/DeployerHandler.java | 34 +++-- .../deployer/DeployerMovementBehaviour.java | 4 +- .../deployer/DeployerTileEntity.java | 76 ++++++++--- .../data/recipe/DeployingRecipeGen.java | 24 ++++ .../data/recipe/ProcessingRecipeGen.java | 1 + .../assets/create/lang/default/messages.json | 1 + 30 files changed, 513 insertions(+), 61 deletions(-) create mode 100644 src/main/java/com/simibubi/create/compat/jei/category/DeployingCategory.java create mode 100644 src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedDeployer.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerApplicationRecipe.java create mode 100644 src/main/java/com/simibubi/create/foundation/data/recipe/DeployingRecipeGen.java diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index f24219921..7b69af6c4 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -408,20 +408,20 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json a6d814f94926d88764c38862cc4ece9c367e023b assets/create/lang/en_ud.json -95f238e0df097f74a7845a58a02d27c3989305ce assets/create/lang/en_us.json -e03638c344f9f80f5cee92c5e4ce4986478e65a5 assets/create/lang/unfinished/de_de.json -dae908c13b54fa5123bad98dd38ba35d58edaaf0 assets/create/lang/unfinished/es_es.json -bf9142028bbd21a4441381c06c3b4557e60e49c5 assets/create/lang/unfinished/es_mx.json -e4f70996f672bc50e8cfeaccd150075c0a07a917 assets/create/lang/unfinished/fr_fr.json -34c1226afddeaf7824fc1aaf65f40505b3811a91 assets/create/lang/unfinished/it_it.json -17a4ed49d461a537ca8e59fc95d12909780105d7 assets/create/lang/unfinished/ja_jp.json -dd1e77bf533b4bf0e7fa358d48ce5643d08b21c3 assets/create/lang/unfinished/ko_kr.json -0faf1940b7c9664be63d02b3685ed0252528a9ce assets/create/lang/unfinished/nl_nl.json -996e1392e3ffcdb6d41a66cf6bd752e301c52b12 assets/create/lang/unfinished/pl_pl.json -49e35e88d59fb49cb1889e960a18371d0616b963 assets/create/lang/unfinished/pt_br.json -af5ee82802fc0e42012c575cd9da1cf36b88b035 assets/create/lang/unfinished/ru_ru.json -63db3153b522775cad4f91eb509e14568bfb0c3c assets/create/lang/unfinished/zh_cn.json -f533c7c7c1cc2b11908377bd807ff006902d5e34 assets/create/lang/unfinished/zh_tw.json +d1838140c8383ee4537db90eb8f657d0c268fe91 assets/create/lang/en_us.json +9d6f26ca7b59d3707ce996e513358cc9b873cad1 assets/create/lang/unfinished/de_de.json +7fafb7565349aa52f4ccb829d4886a179eb547dc assets/create/lang/unfinished/es_es.json +822b912d290d40c5f02011393af44bf37684f9b4 assets/create/lang/unfinished/es_mx.json +502d761465a0de7aeb15acec4147b8ec8bee92cf assets/create/lang/unfinished/fr_fr.json +dac15c17578fb37bbdb874cee5a0a078110b7481 assets/create/lang/unfinished/it_it.json +fd270c9c8bc46d4df21aa04ecc7bf059011e4b3e assets/create/lang/unfinished/ja_jp.json +a5b002e047a2f509a8d35b9e638627f970b4810e assets/create/lang/unfinished/ko_kr.json +50f65aaba8c4fec5404ab1fc40f74b4970a55edd assets/create/lang/unfinished/nl_nl.json +ff61e567f15ded6ba127522af03860232069cdd2 assets/create/lang/unfinished/pl_pl.json +a7a28fb3896bc38e00f746e650433160f5b53c90 assets/create/lang/unfinished/pt_br.json +ffa1901b392719634403048419d29b268704bd10 assets/create/lang/unfinished/ru_ru.json +38b843c5232167876b3678328b47ec95f30cf69f assets/create/lang/unfinished/zh_cn.json +b806d1e6fe9ebee27f417a3c4d6c818124ee4cde 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 @@ -1651,8 +1651,8 @@ 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 -3fd540489a0038a78c6b02f81e89d95e53596b2b assets/create/sounds.json -5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json +096382a4c025b5ffdde9c496ee9da0d5345fbe17 assets/create/sounds.json +0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json 187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json 0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json 83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index b7324fd07..427d2c658 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -681,6 +681,7 @@ "create.recipe.fan_blasting.fan": "Fan behind Lava", "create.recipe.pressing": "Pressing", "create.recipe.mixing": "Mixing", + "create.recipe.deploying": "Deploying", "create.recipe.automatic_shapeless": "Automated Shapeless Crafting", "create.recipe.automatic_brewing": "Automated Brewing", "create.recipe.packing": "Compacting", @@ -1141,6 +1142,7 @@ "create.subtitle.mixing": "Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "Mechanical Press bonks", "create.subtitle.worldshaper_place": "Worldshaper zaps", + "create.subtitle.deployer_polish": "Deployer applies polish", "create.subtitle.depot_slide": "Item slides", "create.subtitle.deny": "Declining boop", "create.subtitle.blaze_munch": "Blaze Burner munches", 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 324c91d17..bffa0a121 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 940", + "_": "Missing Localizations: 942", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Propeller hinter Lava", "create.recipe.pressing": "Mechanische Presse", "create.recipe.mixing": "Mixen", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "Automatisiertes Formloses Bauen", "create.recipe.automatic_brewing": "Automatisiertes Brauen", "create.recipe.packing": "Komprimieren", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "Lohe kaut glücklich", 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 90f7ba71f..12880cfef 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_es.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_es.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 641", + "_": "Missing Localizations: 643", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Ventilador detrás de la lava", "create.recipe.pressing": "Prensando", "create.recipe.mixing": "Mezclando", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "Elaboración automatizada de productos sin forma", "create.recipe.automatic_brewing": "Elaboración de cerveza automatizada", "create.recipe.packing": "Compactando", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "Blaze mastica felizmente", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index a6287481c..f3de8dd15 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1264", + "_": "Missing Localizations: 1266", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "UNLOCALIZED: Fan behind Lava", "create.recipe.pressing": "UNLOCALIZED: Pressing", "create.recipe.mixing": "UNLOCALIZED: Mixing", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "UNLOCALIZED: Automated Shapeless Crafting", "create.recipe.automatic_brewing": "UNLOCALIZED: Automated Brewing", "create.recipe.packing": "UNLOCALIZED: Compacting", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches", 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 201ca083f..558c2ff87 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1192", + "_": "Missing Localizations: 1194", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Ventilateur derrière de la lave", "create.recipe.pressing": "Pressage", "create.recipe.mixing": "Mixage", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "UNLOCALIZED: Automated Shapeless Crafting", "create.recipe.automatic_brewing": "Alchimie automatisée", "create.recipe.packing": "Compactage", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches", 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 e8509ce0d..afa0b3942 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 658", + "_": "Missing Localizations: 660", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Ventilatore dietro la lava", "create.recipe.pressing": "Pressatura", "create.recipe.mixing": "Mescolamento", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "Costruzione informe automatizzata", "create.recipe.automatic_brewing": "Fermentazione automatica", "create.recipe.packing": "Compattazione", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "Il blaze lo gusta felicemente", 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 4d9481522..9bf53aabf 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 22", + "_": "Missing Localizations: 24", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "溶岩の奥のケース入りファン", "create.recipe.pressing": "プレス", "create.recipe.mixing": "混合", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "自動不定形クラフト", "create.recipe.automatic_brewing": "自動醸造", "create.recipe.packing": "圧縮", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "混ぜる音", "create.subtitle.mechanical_press_activation_belt": "メカニカルプレスがボンと鳴る", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "アイテムが滑る", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "ブレイズの咀嚼音", 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 9f2072e14..17289ec89 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 711", + "_": "Missing Localizations: 713", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "용암과 선풍기", "create.recipe.pressing": "압착", "create.recipe.mixing": "혼합", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "무형 자동 조합", "create.recipe.automatic_brewing": "자동 양조", "create.recipe.packing": "압축", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "블레이즈가 행복하게 섭취함", 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 9dfd61c14..acb783a8e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1575", + "_": "Missing Localizations: 1577", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "UNLOCALIZED: Fan behind Lava", "create.recipe.pressing": "Persen", "create.recipe.mixing": "Mengen", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "UNLOCALIZED: Automated Shapeless Crafting", "create.recipe.automatic_brewing": "UNLOCALIZED: Automated Brewing", "create.recipe.packing": "Compressen", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches", 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 c515f1e65..3b4dd77cd 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pl_pl.json +++ b/src/generated/resources/assets/create/lang/unfinished/pl_pl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 36", + "_": "Missing Localizations: 38", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Wiatrak za lawą", "create.recipe.pressing": "Tłoczenie", "create.recipe.mixing": "Mieszanie", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "Zautomatyzowanie nieokreślone konstruowanie", "create.recipe.automatic_brewing": "Zautomatyzowane warzenie", "create.recipe.packing": "Prasowanie", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "Płomyk szczęśliwie przeżuwa", 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 cf7587f56..4d81d99bb 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1627", + "_": "Missing Localizations: 1629", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "UNLOCALIZED: Fan behind Lava", "create.recipe.pressing": "Prensa Mecânica", "create.recipe.mixing": "UNLOCALIZED: Mixing", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "UNLOCALIZED: Automated Shapeless Crafting", "create.recipe.automatic_brewing": "UNLOCALIZED: Automated Brewing", "create.recipe.packing": "UNLOCALIZED: Compacting", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches", 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 3eb45c5a5..1f092d472 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 555", + "_": "Missing Localizations: 557", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "Вентилятор за текущей лавой", "create.recipe.pressing": "Прессование", "create.recipe.mixing": "Смешивание", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "Автоматическая бесформенная сборка", "create.recipe.automatic_brewing": "Автоматическое смешивание", "create.recipe.packing": "Прессование", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "Всполох радостно жуёт", 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 1647bf98e..513325f0d 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 41", + "_": "Missing Localizations: 43", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "在熔岩后放置鼓风机", "create.recipe.pressing": "金属压片", "create.recipe.mixing": "混合搅拌", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "自动搅拌", "create.recipe.automatic_brewing": "自动酿造", "create.recipe.packing": "压块塑形", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "烈焰人:咀嚼", 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 acc5c68e9..8b3a4f40a 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 660", + "_": "Missing Localizations: 662", "_": "->------------------------] Game Elements [------------------------<-", @@ -682,6 +682,7 @@ "create.recipe.fan_blasting.fan": "在熔岩後放置鼓風機", "create.recipe.pressing": "金屬壓片", "create.recipe.mixing": "混合攪拌", + "create.recipe.deploying": "UNLOCALIZED: Deploying", "create.recipe.automatic_shapeless": "自動攪拌", "create.recipe.automatic_brewing": "自動釀造", "create.recipe.packing": "壓塊塑形", @@ -1142,6 +1143,7 @@ "create.subtitle.mixing": "UNLOCALIZED: Mixing Noises", "create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks", "create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps", + "create.subtitle.deployer_polish": "UNLOCALIZED: Deployer applies polish", "create.subtitle.depot_slide": "UNLOCALIZED: Item slides", "create.subtitle.deny": "UNLOCALIZED: Declining boop", "create.subtitle.blaze_munch": "烈焰使者開心地吃著", diff --git a/src/generated/resources/assets/create/sounds.json b/src/generated/resources/assets/create/sounds.json index 19f268c60..61a42d76f 100644 --- a/src/generated/resources/assets/create/sounds.json +++ b/src/generated/resources/assets/create/sounds.json @@ -110,6 +110,15 @@ ], "subtitle": "create.subtitle.deny" }, + "deployer_polish": { + "sounds": [ + { + "name": "minecraft:ui.stonecutter.take_result", + "type": "event" + } + ], + "subtitle": "create.subtitle.deployer_polish" + }, "depot_plop": { "sounds": [ { diff --git a/src/generated/resources/data/create/advancements/aesthetics.json b/src/generated/resources/data/create/advancements/aesthetics.json index 59a86f429..d723cbe38 100644 --- a/src/generated/resources/data/create/advancements/aesthetics.json +++ b/src/generated/resources/data/create/advancements/aesthetics.json @@ -28,8 +28,8 @@ "trigger": "create:bracket_apply", "conditions": { "accepted_entries": [ - "create:large_cogwheel", - "create:cogwheel" + "create:cogwheel", + "create:large_cogwheel" ] } }, diff --git a/src/main/java/com/simibubi/create/AllRecipeTypes.java b/src/main/java/com/simibubi/create/AllRecipeTypes.java index 910241dd6..c21740132 100644 --- a/src/main/java/com/simibubi/create/AllRecipeTypes.java +++ b/src/main/java/com/simibubi/create/AllRecipeTypes.java @@ -6,6 +6,7 @@ import java.util.function.Supplier; import com.simibubi.create.compat.jei.ConversionRecipe; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe; import com.simibubi.create.content.contraptions.components.crusher.CrushingRecipe; +import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe; import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe; import com.simibubi.create.content.contraptions.components.millstone.MillingRecipe; import com.simibubi.create.content.contraptions.components.mixer.CompactingRecipe; @@ -44,6 +45,7 @@ public enum AllRecipeTypes { PRESSING(processingSerializer(PressingRecipe::new)), SANDPAPER_POLISHING(processingSerializer(SandPaperPolishingRecipe::new)), SPLASHING(processingSerializer(SplashingRecipe::new)), + DEPLOYING(processingSerializer(DeployerApplicationRecipe::new)), FILLING(processingSerializer(FillingRecipe::new)), EMPTYING(processingSerializer(EmptyingRecipe::new)), diff --git a/src/main/java/com/simibubi/create/AllSoundEvents.java b/src/main/java/com/simibubi/create/AllSoundEvents.java index d4f99209b..bec9744d2 100644 --- a/src/main/java/com/simibubi/create/AllSoundEvents.java +++ b/src/main/java/com/simibubi/create/AllSoundEvents.java @@ -152,6 +152,11 @@ public class AllSoundEvents { .playExisting(SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 1f, 1f) .category(SoundCategory.PLAYERS) .build(), + + AUTO_POLISH = create("deployer_polish").subtitle("Deployer applies polish") + .playExisting(SoundEvents.UI_STONECUTTER_TAKE_RESULT, 1f, 1f) + .category(SoundCategory.BLOCKS) + .build(), BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches") .playExisting(SoundEvents.ENTITY_GENERIC_EAT, .5f, 1f) diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index 9e1511e9e..5d545b40f 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -19,6 +19,7 @@ import com.simibubi.create.compat.jei.category.BlockCuttingCategory; import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe; import com.simibubi.create.compat.jei.category.CreateRecipeCategory; import com.simibubi.create.compat.jei.category.CrushingCategory; +import com.simibubi.create.compat.jei.category.DeployingCategory; import com.simibubi.create.compat.jei.category.FanBlastingCategory; import com.simibubi.create.compat.jei.category.FanSmokingCategory; import com.simibubi.create.compat.jei.category.FanWashingCategory; @@ -33,6 +34,7 @@ import com.simibubi.create.compat.jei.category.PressingCategory; import com.simibubi.create.compat.jei.category.ProcessingViaFanCategory; import com.simibubi.create.compat.jei.category.SawingCategory; import com.simibubi.create.compat.jei.category.SpoutCategory; +import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe; import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity; import com.simibubi.create.content.contraptions.components.saw.SawTileEntity; import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipeManager; @@ -163,6 +165,14 @@ public class CreateJEI implements IModPlugin { .catalyst(AllItems.SAND_PAPER::get) .catalyst(AllItems.RED_SAND_PAPER::get) .build(), + + deploying = register("deploying", DeployingCategory::new) + .recipeList(() -> DeployerApplicationRecipe.convert(findRecipesByType(AllRecipeTypes.SANDPAPER_POLISHING.type))) + .recipes(AllRecipeTypes.DEPLOYING) + .catalyst(AllBlocks.DEPLOYER::get) + .catalyst(AllBlocks.DEPOT::get) + .catalyst(AllItems.BELT_CONNECTOR::get) + .build(), mysteryConversion = register("mystery_conversion", MysteriousItemConversionCategory::new) .recipeList(MysteriousItemConversionCategory::getRecipes) diff --git a/src/main/java/com/simibubi/create/compat/jei/category/DeployingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/DeployingCategory.java new file mode 100644 index 000000000..28b14c1cc --- /dev/null +++ b/src/main/java/com/simibubi/create/compat/jei/category/DeployingCategory.java @@ -0,0 +1,68 @@ +package com.simibubi.create.compat.jei.category; + +import java.util.Arrays; +import java.util.stream.Collectors; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer; +import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe; +import com.simibubi.create.foundation.fluid.FluidIngredient; +import com.simibubi.create.foundation.gui.AllGuiTextures; + +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; +import mezz.jei.api.ingredients.IIngredients; + +public class DeployingCategory extends CreateRecipeCategory { + + AnimatedDeployer deployer; + + public DeployingCategory() { + super(itemIcon(AllBlocks.DEPLOYER.get()), emptyBackground(177, 70)); + deployer = new AnimatedDeployer(); + } + + @Override + public Class getRecipeClass() { + return DeployerApplicationRecipe.class; + } + + @Override + public void setIngredients(DeployerApplicationRecipe recipe, IIngredients ingredients) { + ingredients.setInputIngredients(recipe.getIngredients()); + ingredients.setInputLists(VanillaTypes.FLUID, recipe.getFluidIngredients() + .stream() + .map(FluidIngredient::getMatchingFluidStacks) + .collect(Collectors.toList())); + + if (!recipe.getRollableResults() + .isEmpty()) + ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, DeployerApplicationRecipe recipe, IIngredients ingredients) { + IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); + itemStacks.init(0, true, 50, 4); + itemStacks.set(0, Arrays.asList(recipe.getRequiredHeldItem() + .getMatchingStacks())); + itemStacks.init(1, true, 26, 50); + itemStacks.set(1, Arrays.asList(recipe.getProcessedItem() + .getMatchingStacks())); + itemStacks.init(2, false, 131, 50); + itemStacks.set(2, recipe.getRecipeOutput()); + } + + @Override + public void draw(DeployerApplicationRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { + AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 4); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50); + getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 62, 57); + AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 126, 29); + deployer.draw(matrixStack, getBackground().getWidth() / 2 - 13, 22); + } + +} diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedDeployer.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedDeployer.java new file mode 100644 index 000000000..862e94194 --- /dev/null +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedDeployer.java @@ -0,0 +1,61 @@ +package com.simibubi.create.compat.jei.category.animations; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.components.deployer.DeployerBlock; +import com.simibubi.create.foundation.gui.GuiGameElement; +import com.simibubi.create.foundation.utility.AnimationTickHolder; + +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector3f; + +public class AnimatedDeployer extends AnimatedKinetics { + + @Override + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { + matrixStack.push(); + matrixStack.translate(xOffset, yOffset, 100); + matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); + matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); + int scale = 20; + + GuiGameElement.of(shaft(Axis.Z)) + .rotateBlock(0, 0, getCurrentAngle()) + .scale(scale) + .render(matrixStack); + + GuiGameElement.of(AllBlocks.DEPLOYER.getDefaultState() + .with(DeployerBlock.FACING, Direction.DOWN) + .with(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false)) + .scale(scale) + .render(matrixStack); + + float cycle = AnimationTickHolder.getRenderTime() % 30; + float offset = cycle < 10 ? cycle / 10f : cycle < 20 ? (20 - cycle) / 10f : 0; + + matrixStack.push(); + + matrixStack.translate(0, offset * 17, 0); + GuiGameElement.of(AllBlockPartials.DEPLOYER_POLE) + .rotateBlock(90, 0, 0) + .scale(scale) + .render(matrixStack); + GuiGameElement.of(AllBlockPartials.DEPLOYER_HAND_HOLDING) + .rotateBlock(90, 0, 0) + .scale(scale) + .render(matrixStack); + + matrixStack.pop(); + + GuiGameElement.of(AllBlocks.DEPOT.getDefaultState()) + .atLocal(0, 2, 0) + .scale(scale) + .render(matrixStack); + + matrixStack.pop(); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java new file mode 100644 index 000000000..7daf5b76d --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/BeltDeployerCallbacks.java @@ -0,0 +1,123 @@ +package com.simibubi.create.content.contraptions.components.deployer; + +import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; + +import java.util.List; +import java.util.stream.Collectors; + +import com.simibubi.create.AllSoundEvents; +import com.simibubi.create.Create; +import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode; +import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.State; +import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; +import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; +import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe; +import com.simibubi.create.content.logistics.InWorldProcessing; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; + +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.items.ItemHandlerHelper; + +public class BeltDeployerCallbacks { + + public static ProcessingResult onItemReceived(TransportedItemStack s, TransportedItemStackHandlerBehaviour i, + DeployerTileEntity deployerTileEntity) { + + if (deployerTileEntity.getSpeed() == 0) + return ProcessingResult.PASS; + if (deployerTileEntity.mode == Mode.PUNCH) + return ProcessingResult.PASS; + BlockState blockState = deployerTileEntity.getBlockState(); + if (!blockState.contains(FACING) || blockState.get(FACING) != Direction.DOWN) + return ProcessingResult.PASS; + if (deployerTileEntity.state != State.WAITING) + return ProcessingResult.HOLD; + if (deployerTileEntity.redstoneLocked) + return ProcessingResult.PASS; + + if (deployerTileEntity.getRecipe(s.stack) == null) + return ProcessingResult.PASS; + + deployerTileEntity.start(); + return ProcessingResult.HOLD; + } + + public static ProcessingResult whenItemHeld(TransportedItemStack s, TransportedItemStackHandlerBehaviour i, + DeployerTileEntity deployerTileEntity) { + + if (deployerTileEntity.getSpeed() == 0) + return ProcessingResult.PASS; + BlockState blockState = deployerTileEntity.getBlockState(); + if (!blockState.contains(FACING) || blockState.get(FACING) != Direction.DOWN) + return ProcessingResult.PASS; + IRecipe recipe = deployerTileEntity.getRecipe(s.stack); + if (recipe == null) + return ProcessingResult.PASS; + + if (deployerTileEntity.state == State.RETRACTING && deployerTileEntity.timer == 1000) { + activate(s, i, deployerTileEntity, recipe); + return ProcessingResult.HOLD; + } + + if (deployerTileEntity.state == State.WAITING) { + if (deployerTileEntity.redstoneLocked) + return ProcessingResult.PASS; + deployerTileEntity.start(); + } + + return ProcessingResult.HOLD; + } + + public static void activate(TransportedItemStack transported, TransportedItemStackHandlerBehaviour handler, + DeployerTileEntity deployerTileEntity, IRecipe recipe) { + + List collect = + InWorldProcessing.applyRecipeOn(ItemHandlerHelper.copyStackWithSize(transported.stack, 1), recipe) + .stream() + .map(stack -> { + TransportedItemStack copy = transported.copy(); + boolean centered = BeltHelper.isItemUpright(stack); + copy.stack = stack; + copy.locked = true; + copy.angle = centered ? 180 : Create.random.nextInt(360); + return copy; + }) + .collect(Collectors.toList()); + + TransportedItemStack left = transported.copy(); + deployerTileEntity.player.spawnedItemEffects = transported.stack.copy(); + left.stack.shrink(1); + + if (collect.isEmpty()) + handler.handleProcessingOnItem(transported, TransportedResult.convertTo(left)); + else + handler.handleProcessingOnItem(transported, TransportedResult.convertToAndLeaveHeld(collect, left)); + + ItemStack heldItem = deployerTileEntity.player.getHeldItemMainhand(); + if (heldItem.isDamageable()) + heldItem.damageItem(1, deployerTileEntity.player, s -> s.sendBreakAnimation(Hand.MAIN_HAND)); + else + heldItem.shrink(1); + + BlockPos pos = deployerTileEntity.getPos(); + World world = deployerTileEntity.getWorld(); + if (heldItem.isEmpty()) + world.playSound(null, pos, SoundEvents.ENTITY_ITEM_BREAK, SoundCategory.BLOCKS, .25f, 1); + world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .25f, .75f); + if (recipe instanceof SandPaperPolishingRecipe) + AllSoundEvents.AUTO_POLISH.playOnServer(world, pos, .25f, 1f); + + deployerTileEntity.sendData(); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerApplicationRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerApplicationRecipe.java new file mode 100644 index 000000000..1e4b1e449 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerApplicationRecipe.java @@ -0,0 +1,66 @@ +package com.simibubi.create.content.contraptions.components.deployer; + +import java.util.List; +import java.util.stream.Collectors; + +import com.simibubi.create.AllItems; +import com.simibubi.create.AllRecipeTypes; +import com.simibubi.create.Create; +import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; +import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder; +import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder.ProcessingRecipeParams; + +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.world.World; +import net.minecraftforge.items.wrapper.RecipeWrapper; + +public class DeployerApplicationRecipe extends ProcessingRecipe { + + public DeployerApplicationRecipe(ProcessingRecipeParams params) { + super(AllRecipeTypes.DEPLOYING, params); + } + + @Override + public boolean matches(RecipeWrapper inv, World p_77569_2_) { + return ingredients.get(0) + .test(inv.getStackInSlot(0)) + && ingredients.get(1) + .test(inv.getStackInSlot(1)); + } + + @Override + protected int getMaxInputCount() { + return 2; + } + + @Override + protected int getMaxOutputCount() { + return 2; + } + + public Ingredient getRequiredHeldItem() { + if (ingredients.isEmpty()) + throw new IllegalStateException("Deploying Recipe: " + id.toString() + " has no tool!"); + return ingredients.get(0); + } + + public Ingredient getProcessedItem() { + if (ingredients.size() < 2) + throw new IllegalStateException("Deploying Recipe: " + id.toString() + " has no ingredient!"); + return ingredients.get(1); + } + + public static List convert(List> sandpaperRecipes) { + return sandpaperRecipes.stream() + .map(r -> new ProcessingRecipeBuilder<>(DeployerApplicationRecipe::new, Create.asResource(r.getId() + .getPath() + "_using_deployer")) + .require(Ingredient.fromItems(AllItems.SAND_PAPER.get(), AllItems.RED_SAND_PAPER.get())) + .require(r.getIngredients() + .get(0)) + .output(r.getRecipeOutput()) + .build()) + .collect(Collectors.toList()); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java index 9500a1ea5..55f3a928d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerHandler.java @@ -6,11 +6,16 @@ import static net.minecraftforge.eventbus.api.Event.Result.DENY; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.Multimap; +import com.simibubi.create.AllSoundEvents; import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode; import com.simibubi.create.content.curiosities.tools.SandPaperItem; +import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; @@ -93,7 +98,7 @@ public class DeployerHandler { } } - static boolean shouldActivate(ItemStack held, World world, BlockPos targetPos) { + static boolean shouldActivate(ItemStack held, World world, BlockPos targetPos, @Nullable Direction facing) { if (held.getItem() instanceof BlockItem) if (world.getBlockState(targetPos) .getBlock() == ((BlockItem) held.getItem()).getBlock()) @@ -107,10 +112,15 @@ public class DeployerHandler { return false; } + if (!held.isEmpty() && facing == Direction.DOWN + && TileEntityBehaviour.get(world, targetPos, TransportedItemStackHandlerBehaviour.TYPE) != null) + return false; + return true; } - static void activate(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, Vector3d extensionVector, Mode mode) { + static void activate(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, Vector3d extensionVector, + Mode mode) { Multimap attributeModifiers = player.getHeldItemMainhand() .getAttributeModifiers(EquipmentSlotType.MAINHAND); player.getAttributes() @@ -120,8 +130,8 @@ public class DeployerHandler { .addTemporaryModifiers(attributeModifiers); } - private static void activateInner(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, Vector3d extensionVector, - Mode mode) { + private static void activateInner(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, + Vector3d extensionVector, Mode mode) { Vector3d rayOrigin = vec.add(extensionVector.scale(3 / 2f + 1 / 64f)); Vector3d rayTarget = vec.add(extensionVector.scale(5 / 2f - 1 / 64f)); @@ -148,10 +158,11 @@ public class DeployerHandler { return; } if (cancelResult == null) { - if (entity.processInitialInteract(player, hand).isAccepted()) + if (entity.processInitialInteract(player, hand) + .isAccepted()) success = true; - else if (entity instanceof LivingEntity - && stack.useOnEntity(player, (LivingEntity) entity, hand).isAccepted()) + else if (entity instanceof LivingEntity && stack.useOnEntity(player, (LivingEntity) entity, hand) + .isAccepted()) success = true; } if (!success && stack.isFood() && entity instanceof PlayerEntity) { @@ -215,7 +226,8 @@ public class DeployerHandler { if (blockBreakingProgress != null) before = blockBreakingProgress.getValue(); progress += before; - world.playSound(null, clickedPos, clickedState.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1); + world.playSound(null, clickedPos, clickedState.getSoundType() + .getHitSound(), SoundCategory.NEUTRAL, .25f, 1); if (progress >= 1) { tryHarvestBlock(player.interactionManager, clickedPos); @@ -300,8 +312,10 @@ public class DeployerHandler { } CompoundNBT tag = stack.getTag(); - if (tag != null && stack.getItem() instanceof SandPaperItem && tag.contains("Polishing")) + if (tag != null && stack.getItem() instanceof SandPaperItem && tag.contains("Polishing")) { player.spawnedItemEffects = ItemStack.read(tag.getCompound("Polishing")); + AllSoundEvents.AUTO_POLISH.playOnServer(world, pos, .25f, 1f); + } if (!player.getActiveItemStack() .isEmpty()) @@ -359,7 +373,7 @@ public class DeployerHandler { protected static ActionResultType safeOnBeehiveUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand) { // <> BeehiveBlock#onUse - + BeehiveBlock block = (BeehiveBlock) state.getBlock(); ItemStack prevHeldItem = player.getHeldItem(hand); int honeyLevel = state.get(BeehiveBlock.HONEY_LEVEL); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index a146a6c3e..ab152a5f5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -63,7 +63,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour { tryGrabbingItem(context); DeployerFakePlayer player = getPlayer(context); Mode mode = getMode(context); - if (mode == Mode.USE && !DeployerHandler.shouldActivate(player.getHeldItemMainhand(), context.world, pos)) + if (mode == Mode.USE && !DeployerHandler.shouldActivate(player.getHeldItemMainhand(), context.world, pos, null)) return; activate(context, pos, player, mode); @@ -115,7 +115,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour { List requiredItems = requirement.getRequiredItems(); ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0); - + if (!context.contraption.hasUniversalCreativeCrate) { IItemHandler iItemHandler = context.contraption.inventory; for (ItemStack required : requiredItems) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java index c1e5493a1..486de2d0e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java @@ -5,14 +5,20 @@ import static com.simibubi.create.content.contraptions.base.DirectionalKineticBl import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.curiosities.tools.SandPaperItem; +import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.render.backend.core.PartialModel; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -21,6 +27,7 @@ import com.simibubi.create.foundation.utility.animation.LerpedFloat; import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntity; @@ -41,6 +48,8 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.ItemStackHandler; +import net.minecraftforge.items.wrapper.RecipeWrapper; public class DeployerTileEntity extends KineticTileEntity { @@ -59,6 +68,8 @@ public class DeployerTileEntity extends KineticTileEntity { private LerpedFloat animatedOffset; + public BeltProcessingBehaviour processingBehaviour; + enum State { WAITING, EXPANDING, RETRACTING, DUMPING; } @@ -82,6 +93,10 @@ public class DeployerTileEntity extends KineticTileEntity { super.addBehaviours(behaviours); filtering = new FilteringBehaviour(this, new DeployerFilterSlot()); behaviours.add(filtering); + processingBehaviour = + new BeltProcessingBehaviour(this).whenItemEnters((s, i) -> BeltDeployerCallbacks.onItemReceived(s, i, this)) + .whileItemHeld((s, i) -> BeltDeployerCallbacks.whenItemHeld(s, i, this)); + behaviours.add(processingBehaviour); } @Override @@ -158,7 +173,7 @@ public class DeployerTileEntity extends KineticTileEntity { } Direction facing = getBlockState().get(FACING); - if (mode == Mode.USE && !DeployerHandler.shouldActivate(stack, world, pos.offset(facing, 2))) { + if (mode == Mode.USE && !DeployerHandler.shouldActivate(stack, world, pos.offset(facing, 2), facing)) { timer = getTimerSpeed() * 10; return; } @@ -166,25 +181,10 @@ public class DeployerTileEntity extends KineticTileEntity { // Check for advancement conditions if (mode == Mode.PUNCH && !boop && startBoop(facing)) return; - if (redstoneLocked) return; - state = State.EXPANDING; - Vector3d movementVector = getMovementVector(); - Vector3d rayOrigin = VecHelper.getCenterOf(pos) - .add(movementVector.scale(3 / 2f)); - Vector3d rayTarget = VecHelper.getCenterOf(pos) - .add(movementVector.scale(5 / 2f)); - RayTraceContext rayTraceContext = - new RayTraceContext(rayOrigin, rayTarget, BlockMode.OUTLINE, FluidMode.NONE, player); - BlockRayTraceResult result = world.rayTraceBlocks(rayTraceContext); - reach = (float) (.5f + Math.min(result.getHitVec() - .subtract(rayOrigin) - .length(), .75f)); - - timer = 1000; - sendData(); + start(); return; } @@ -208,6 +208,23 @@ public class DeployerTileEntity extends KineticTileEntity { } + protected void start() { + state = State.EXPANDING; + Vector3d movementVector = getMovementVector(); + Vector3d rayOrigin = VecHelper.getCenterOf(pos) + .add(movementVector.scale(3 / 2f)); + Vector3d rayTarget = VecHelper.getCenterOf(pos) + .add(movementVector.scale(5 / 2f)); + RayTraceContext rayTraceContext = + new RayTraceContext(rayOrigin, rayTarget, BlockMode.OUTLINE, FluidMode.NONE, player); + BlockRayTraceResult result = world.rayTraceBlocks(rayTraceContext); + reach = (float) (.5f + Math.min(result.getHitVec() + .subtract(rayOrigin) + .length(), .75f)); + timer = 1000; + sendData(); + } + public boolean startBoop(Direction facing) { if (!world.isAirBlock(pos.offset(facing, 1)) || !world.isAirBlock(pos.offset(facing, 2))) return false; @@ -263,6 +280,10 @@ public class DeployerTileEntity extends KineticTileEntity { player.rotationYaw = direction.getHorizontalAngle(); player.rotationPitch = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0; + if (direction == Direction.DOWN + && TileEntityBehaviour.get(world, clickedPos, TransportedItemStackHandlerBehaviour.TYPE) != null) + return; // Belt processing handled in BeltDeployerCallbacks + DeployerHandler.activate(player, center, clickedPos, movementVector, mode); if (player != null) heldItem = player.getHeldItemMainhand(); @@ -294,7 +315,7 @@ public class DeployerTileEntity extends KineticTileEntity { if (compound.contains("Particle")) { ItemStack particleStack = ItemStack.read(compound.getCompound("Particle")); SandPaperItem.spawnParticles(VecHelper.getCenterOf(pos) - .add(getMovementVector().scale(2f)), particleStack, this.world); + .add(getMovementVector().scale(reach + 1)), particleStack, this.world); } } @@ -413,4 +434,23 @@ public class DeployerTileEntity extends KineticTileEntity { animatedOffset.setValue(offset); } + RecipeWrapper recipeInv = new RecipeWrapper(new ItemStackHandler(2)); + SandPaperInv sandpaperInv = new SandPaperInv(ItemStack.EMPTY); + + @Nullable + public IRecipe getRecipe(ItemStack stack) { + if (player == null) + return null; + ItemStack heldItemMainhand = player.getHeldItemMainhand(); + if (heldItemMainhand.getItem() instanceof SandPaperItem) { + sandpaperInv.setInventorySlotContents(0, stack); + return AllRecipeTypes.SANDPAPER_POLISHING.find(sandpaperInv, world) + .orElse(null); + } + recipeInv.setInventorySlotContents(0, heldItemMainhand); + recipeInv.setInventorySlotContents(1, stack); + return AllRecipeTypes.DEPLOYING.find(recipeInv, world) + .orElse(null); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/DeployingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/DeployingRecipeGen.java new file mode 100644 index 000000000..4da7b3529 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/DeployingRecipeGen.java @@ -0,0 +1,24 @@ +package com.simibubi.create.foundation.data.recipe; + +import com.simibubi.create.AllRecipeTypes; + +import net.minecraft.data.DataGenerator; + +public class DeployingRecipeGen extends ProcessingRecipeGen { + +// GeneratedRecipe +// TEST = create("test", b -> b.require(AllItems.ANDESITE_ALLOY.get()) +// .require(AllItems.BAR_OF_CHOCOLATE.get()) +// .output(AllItems.BRASS_NUGGET.get())), +// ; + + public DeployingRecipeGen(DataGenerator p_i48262_1_) { + super(p_i48262_1_); + } + + @Override + protected AllRecipeTypes getRecipeType() { + return AllRecipeTypes.DEPLOYING; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java index 094d59133..920d5ef13 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/ProcessingRecipeGen.java @@ -31,6 +31,7 @@ public abstract class ProcessingRecipeGen extends CreateRecipeProvider { generators.add(new CuttingRecipeGen(gen)); generators.add(new WashingRecipeGen(gen)); generators.add(new PolishingRecipeGen(gen)); + generators.add(new DeployingRecipeGen(gen)); generators.add(new MixingRecipeGen(gen)); generators.add(new CompactingRecipeGen(gen)); generators.add(new PressingRecipeGen(gen)); diff --git a/src/main/resources/assets/create/lang/default/messages.json b/src/main/resources/assets/create/lang/default/messages.json index 58649f046..22a691d46 100644 --- a/src/main/resources/assets/create/lang/default/messages.json +++ b/src/main/resources/assets/create/lang/default/messages.json @@ -22,6 +22,7 @@ "create.recipe.fan_blasting.fan": "Fan behind Lava", "create.recipe.pressing": "Pressing", "create.recipe.mixing": "Mixing", + "create.recipe.deploying": "Deploying", "create.recipe.automatic_shapeless": "Automated Shapeless Crafting", "create.recipe.automatic_brewing": "Automated Brewing", "create.recipe.packing": "Compacting",