From efa2bc745feb52156a467f582598ff50783c7753 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 7 Jul 2021 17:33:43 +0200 Subject: [PATCH] Magic Potatoes - Fixed localization of potato cannon ammo tooltip - Added several enchantment compatibilities to the Potato Cannon - Added the Potato Recovery Enchantment --- src/generated/resources/.cache/cache | 30 ++++----- .../resources/assets/create/lang/en_ud.json | 1 + .../resources/assets/create/lang/en_us.json | 6 ++ .../assets/create/lang/unfinished/de_de.json | 8 ++- .../assets/create/lang/unfinished/es_es.json | 8 ++- .../assets/create/lang/unfinished/es_mx.json | 8 ++- .../assets/create/lang/unfinished/fr_fr.json | 8 ++- .../assets/create/lang/unfinished/it_it.json | 8 ++- .../assets/create/lang/unfinished/ja_jp.json | 8 ++- .../assets/create/lang/unfinished/ko_kr.json | 8 ++- .../assets/create/lang/unfinished/nl_nl.json | 8 ++- .../assets/create/lang/unfinished/pl_pl.json | 8 ++- .../assets/create/lang/unfinished/pt_br.json | 8 ++- .../assets/create/lang/unfinished/ru_ru.json | 8 ++- .../assets/create/lang/unfinished/zh_cn.json | 8 ++- .../assets/create/lang/unfinished/zh_tw.json | 8 ++- .../com/simibubi/create/AllEnchantments.java | 24 +++++++ src/main/java/com/simibubi/create/Create.java | 1 + .../curiosities/weapons/PotatoCannonItem.java | 66 +++++++++++++++++-- .../weapons/PotatoCannonProjectileTypes.java | 48 ++++++++------ .../weapons/PotatoProjectileEntity.java | 54 ++++++++++++--- .../weapons/PotatoRecoveryEnchantment.java | 24 +++++++ .../assets/create/lang/default/messages.json | 4 ++ 23 files changed, 300 insertions(+), 62 deletions(-) create mode 100644 src/main/java/com/simibubi/create/AllEnchantments.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoRecoveryEnchantment.java diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 4efa9ad1e..c41e6e483 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -425,21 +425,21 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 6801fa1f466f172700e573e5b8ee8ee5f9ca4583 assets/create/blockstates/yellow_valve_handle.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json -f0d3897a272bda674b3da81ff96c9ff9d50a22d7 assets/create/lang/en_ud.json -fe0d721b6a6cb497ebcd3d52cbdd85dcd0aaa88d assets/create/lang/en_us.json -823a08304aa1d825810f3e289524204b0d459afc assets/create/lang/unfinished/de_de.json -c1584c0fd16dcdfbe6b954cf66853ae54e943e14 assets/create/lang/unfinished/es_es.json -5ce012b625bd43f4722ffd33dba5a1d69e826c63 assets/create/lang/unfinished/es_mx.json -14982459cc823666a9c31c14f128c74fe23d7da7 assets/create/lang/unfinished/fr_fr.json -4e800e837b6604a963c1d8efd9502165306285ec assets/create/lang/unfinished/it_it.json -d6bff62e5c6ff8b9015f69239bd00dfc84752c1e assets/create/lang/unfinished/ja_jp.json -eaee8e2d47ca84cd95b7e5ee5681817a53e198df assets/create/lang/unfinished/ko_kr.json -3b685a11350ab25b26b285d31e96af534ed8b583 assets/create/lang/unfinished/nl_nl.json -dcffd28c035a77d20676b5df28b8bd053b821bda assets/create/lang/unfinished/pl_pl.json -da179be447f93814b5c2892a145ed8696f4cc1d6 assets/create/lang/unfinished/pt_br.json -980321ff0d197abdbc9e9421dc570cc1faeae530 assets/create/lang/unfinished/ru_ru.json -9a442edbadcb825bf0f22ba51d0761e18ae6942d assets/create/lang/unfinished/zh_cn.json -5f16a1de3c3686367d449d9ae6898fe365592e3f assets/create/lang/unfinished/zh_tw.json +1fa99fbea1418694aea41dea81f9cbf5e30066d4 assets/create/lang/en_ud.json +f38e0d6773f0618212e6d036290be02692302b1b assets/create/lang/en_us.json +8456877fca4c1c97a74c25c97e0dbd274e728d25 assets/create/lang/unfinished/de_de.json +4de8456cde05eecedec61c79522cbd6549de01a9 assets/create/lang/unfinished/es_es.json +2c72b40a22f6da68c179e875fecc471dfb63882c assets/create/lang/unfinished/es_mx.json +801a7fc4c0b83f94ee5fc6ff2dcfbc2c794e7fd5 assets/create/lang/unfinished/fr_fr.json +7c23104e6f627e2812391696550f7ac560a8543d assets/create/lang/unfinished/it_it.json +6a488e40ec2bd295e51447889e1643b12d744a1b assets/create/lang/unfinished/ja_jp.json +aea13865e1613a09110c6d3b52c3da68015d6a72 assets/create/lang/unfinished/ko_kr.json +7be41ad5b274297072b1cc17663686287bc3f618 assets/create/lang/unfinished/nl_nl.json +3e1957e45a5cc7586236517a5ee0f57788be9e8e assets/create/lang/unfinished/pl_pl.json +e57e2fbe82324c567d130f008865f34c45e2f9be assets/create/lang/unfinished/pt_br.json +e85f3a6441b932d3ebb4023a34d300ad196c7f41 assets/create/lang/unfinished/ru_ru.json +4186b08ae85862b6b73895507f6849d2f249d006 assets/create/lang/unfinished/zh_cn.json +90e0931966c8e272a2bd03378b25769c5daf64bb 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 diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index 373483d04..f6297f0e2 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -426,6 +426,7 @@ "block.create.yellow_valve_handle": "\u01DD\u05DFpu\u0250H \u01DD\u028C\u05DF\u0250\u039B \u028Do\u05DF\u05DF\u01DD\u028E", "block.create.zinc_block": "\u0254u\u0131Z \u025Fo \u029E\u0254o\u05DF\u15FA", "block.create.zinc_ore": "\u01DD\u0279O \u0254u\u0131Z", + "enchantment.create.potato_recovery": "\u028E\u0279\u01DD\u028Co\u0254\u01DD\u1D1A o\u0287\u0250\u0287o\u0500", "entity.create.contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186", "entity.create.crafting_blueprint": "\u0287u\u0131\u0279d\u01DDn\u05DF\u15FA bu\u0131\u0287\u025F\u0250\u0279\u0186", "entity.create.gantry_contraption": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 \u028E\u0279\u0287u\u0250\u2141", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 669e30021..50e7a2fb7 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -430,6 +430,8 @@ "block.create.zinc_block": "Block of Zinc", "block.create.zinc_ore": "Zinc Ore", + "enchantment.create.potato_recovery": "Potato Recovery", + "entity.create.contraption": "Contraption", "entity.create.crafting_blueprint": "Crafting Blueprint", "entity.create.gantry_contraption": "Gantry Contraption", @@ -1171,6 +1173,10 @@ "create.crafting_blueprint.secondary_display_slot": "Secondary Display Slot", "create.crafting_blueprint.optional": "Optional", + "create.potato_cannon.ammo.attack_damage": "%1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "%1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "%1$s Knockback", + "create.hint.hose_pulley.title": "Bottomless Supply", "create.hint.hose_pulley": "The targeted body of fluid is considered infinite.", "create.hint.mechanical_arm_no_targets.title": "No Targets", 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 160dc8776..dcd31b851 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: 1114", + "_": "Missing Localizations: 1118", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Zinkblock", "block.create.zinc_ore": "Zinkerz", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Vorrichtung", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "Portalkran Vorrichtung", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "Endlose Versorgung", "create.hint.hose_pulley": "Das angewählte Gewässer wird als unendlich betrachtet.", "create.hint.mechanical_arm_no_targets.title": "Keine Ziele", 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 fb6480da6..d3c239abf 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: 877", + "_": "Missing Localizations: 881", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Bloque de zinc", "block.create.zinc_ore": "Mineral de zinc", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Artilugio", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "Artilugio de grúa", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "Suministro sin fondo", "create.hint.hose_pulley": "La masa de fluido objetivo se considera infinita", "create.hint.mechanical_arm_no_targets.title": "No hay objetivos", 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 8d2d3f3c7..5a1a8c86a 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: 1481", + "_": "Missing Localizations: 1485", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Bloque de Zinc", "block.create.zinc_ore": "Mineral de Zinc", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Artefacto", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "UNLOCALIZED: Bottomless Supply", "create.hint.hose_pulley": "UNLOCALIZED: The targeted body of fluid is considered infinite.", "create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets", 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 154f68717..57b4c4194 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: 1366", + "_": "Missing Localizations: 1370", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Bloc de zinc", "block.create.zinc_ore": "Minerai de zinc", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Engin", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "UNLOCALIZED: Bottomless Supply", "create.hint.hose_pulley": "UNLOCALIZED: The targeted body of fluid is considered infinite.", "create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets", 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 66c67cc49..44d778471 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: 894", + "_": "Missing Localizations: 898", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Blocco di zinco", "block.create.zinc_ore": "Zinco grezzo", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Contrazione", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "Buco senza fondo", "create.hint.hose_pulley": "Il corpo fluido selezionato è considerato infinito.", "create.hint.mechanical_arm_no_targets.title": "Nessun bersaglio", 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 3f297aa27..75a7148cb 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: 26", + "_": "Missing Localizations: 30", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "亜鉛ブロック", "block.create.zinc_ore": "亜鉛鉱石", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "からくり", "entity.create.crafting_blueprint": "クラフトブループリント", "entity.create.gantry_contraption": "ガントリーからくり", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "第2表示スロット", "create.crafting_blueprint.optional": "オプション", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "底なし搬出", "create.hint.hose_pulley": "対象となる液体は無限とみなされています。", "create.hint.mechanical_arm_no_targets.title": "ターゲットが見つかりません", 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 5405c4ee9..ed57b3807 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: 272", + "_": "Missing Localizations: 276", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "아연 블록", "block.create.zinc_ore": "아연 광석", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "장치", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "다리 장치", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "무한한 공급량", "create.hint.hose_pulley": "액체를 무한하다고 간주합니다.", "create.hint.mechanical_arm_no_targets.title": "목표가 없음", 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 ab221d7c2..0c75091b9 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: 1747", + "_": "Missing Localizations: 1751", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "UNLOCALIZED: Block of Zinc", "block.create.zinc_ore": "UNLOCALIZED: Zinc Ore", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "UNLOCALIZED: Contraption", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "UNLOCALIZED: Bottomless Supply", "create.hint.hose_pulley": "UNLOCALIZED: The targeted body of fluid is considered infinite.", "create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets", 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 abb00d845..96f3defca 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: 236", + "_": "Missing Localizations: 240", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Blok cynku", "block.create.zinc_ore": "Ruda cynku", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Maszyna", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "Maszyna suwnicowa", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "Niewyczerpany zapas", "create.hint.hose_pulley": "Wybrane zbiornik cieczy jest uznany za nieskończony", "create.hint.mechanical_arm_no_targets.title": "Brak celi", 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 c1cdb9885..2e8ae8c56 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: 1788", + "_": "Missing Localizations: 1792", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "UNLOCALIZED: Block of Zinc", "block.create.zinc_ore": "UNLOCALIZED: Zinc Ore", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "UNLOCALIZED: Contraption", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "UNLOCALIZED: Gantry Contraption", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "UNLOCALIZED: Bottomless Supply", "create.hint.hose_pulley": "UNLOCALIZED: The targeted body of fluid is considered infinite.", "create.hint.mechanical_arm_no_targets.title": "UNLOCALIZED: No Targets", 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 fb92874ae..8fd4ba2b7 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: 267", + "_": "Missing Localizations: 271", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "Цинковый блок", "block.create.zinc_ore": "Цинковая руда", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "Штуковина", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "Крановая штуковина", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "Безграничное снабжение", "create.hint.hose_pulley": "Целевой водный резервуар считается бесконечным.", "create.hint.mechanical_arm_no_targets.title": "Нет целей", 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 566abe389..61b29d131 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: 277", + "_": "Missing Localizations: 281", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "锌块", "block.create.zinc_ore": "锌矿石", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "装置", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "起重机装置", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "无限供应", "create.hint.hose_pulley": "目标液体对象被视为无限量的。", "create.hint.mechanical_arm_no_targets.title": "没有目标", 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 5a767d91d..326dabd84 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: 272", + "_": "Missing Localizations: 276", "_": "->------------------------] Game Elements [------------------------<-", @@ -431,6 +431,8 @@ "block.create.zinc_block": "鋅磚", "block.create.zinc_ore": "鋅礦石", + "enchantment.create.potato_recovery": "UNLOCALIZED: Potato Recovery", + "entity.create.contraption": "結構", "entity.create.crafting_blueprint": "UNLOCALIZED: Crafting Blueprint", "entity.create.gantry_contraption": "門式結構", @@ -1172,6 +1174,10 @@ "create.crafting_blueprint.secondary_display_slot": "UNLOCALIZED: Secondary Display Slot", "create.crafting_blueprint.optional": "UNLOCALIZED: Optional", + "create.potato_cannon.ammo.attack_damage": "UNLOCALIZED: %1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "UNLOCALIZED: %1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "UNLOCALIZED: %1$s Knockback", + "create.hint.hose_pulley.title": "無限供應", "create.hint.hose_pulley": "目標液體為無限供應", "create.hint.mechanical_arm_no_targets.title": "沒有目標", diff --git a/src/main/java/com/simibubi/create/AllEnchantments.java b/src/main/java/com/simibubi/create/AllEnchantments.java new file mode 100644 index 000000000..d1931256f --- /dev/null +++ b/src/main/java/com/simibubi/create/AllEnchantments.java @@ -0,0 +1,24 @@ +package com.simibubi.create; + +import com.simibubi.create.content.curiosities.weapons.PotatoRecoveryEnchantment; +import com.simibubi.create.foundation.data.CreateRegistrate; +import com.tterrag.registrate.util.entry.RegistryEntry; + +import net.minecraft.enchantment.Enchantment.Rarity; +import net.minecraft.enchantment.EnchantmentType; +import net.minecraft.inventory.EquipmentSlotType; + +public class AllEnchantments { + + private static final CreateRegistrate REGISTRATE = Create.registrate(); + + public static final RegistryEntry POTATO_RECOVERY = REGISTRATE.object("potato_recovery") + .enchantment(EnchantmentType.BOW, PotatoRecoveryEnchantment::new) + .addSlots(EquipmentSlotType.MAINHAND, EquipmentSlotType.OFFHAND) + .lang("Potato Recovery") + .rarity(Rarity.UNCOMMON) + .register(); + + public static void register() {} + +} diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index b44b6b13b..db1a509fe 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -89,6 +89,7 @@ public class Create { AllMovementBehaviours.register(); AllWorldFeatures.register(); AllConfigs.register(); + AllEnchantments.register(); IEventBus modEventBus = FMLJavaModLoadingContext.get() .getModEventBus(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java index 403fc88be..87442245f 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Optional; import java.util.function.Predicate; +import com.simibubi.create.AllEnchantments; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.Create; import com.simibubi.create.CreateClient; @@ -11,12 +12,16 @@ import com.simibubi.create.content.curiosities.armor.BackTankUtil; import com.simibubi.create.content.curiosities.zapper.ShootableGadgetItemMethods; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -28,7 +33,9 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; @@ -52,6 +59,21 @@ public class PotatoCannonItem extends ShootableItem { return false; } + @Override + public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { + if (enchantment == Enchantments.POWER) + return true; + if (enchantment == Enchantments.PUNCH) + return true; + if (enchantment == Enchantments.FLAME) + return true; + if (enchantment == Enchantments.LOOTING) + return true; + if (enchantment == AllEnchantments.POTATO_RECOVERY.get()) + return true; + return super.canApplyAtEnchantingTable(stack, enchantment); + } + @Override public ActionResultType onItemUse(ItemUseContext context) { return onItemRightClick(context.getWorld(), context.getPlayer(), context.getHand()).getType(); @@ -118,25 +140,30 @@ public class PotatoCannonItem extends ShootableItem { PotatoCannonProjectileTypes projectileType = PotatoCannonProjectileTypes.getProjectileTypeOf(itemStack) .orElse(PotatoCannonProjectileTypes.FALLBACK); Vector3d lookVec = player.getLookVec(); - Vector3d motion = lookVec.add(correction).normalize().scale(projectileType.getVelocityMultiplier()); + Vector3d motion = lookVec.add(correction) + .normalize() + .scale(projectileType.getVelocityMultiplier()); float soundPitch = projectileType.getSoundPitch() + (Create.RANDOM.nextFloat() - .5f) / 4f; boolean spray = projectileType.getSplit() > 1; - Vector3d sprayBase = VecHelper.rotate(new Vector3d(0,0.1,0), - 360*Create.RANDOM.nextFloat(), Axis.Z); + Vector3d sprayBase = VecHelper.rotate(new Vector3d(0, 0.1, 0), 360 * Create.RANDOM.nextFloat(), Axis.Z); float sprayChange = 360f / projectileType.getSplit(); for (int i = 0; i < projectileType.getSplit(); i++) { PotatoProjectileEntity projectile = AllEntityTypes.POTATO_PROJECTILE.create(world); projectile.setItem(itemStack); + projectile.setEnchantmentEffectsFromCannon(stack); Vector3d splitMotion = motion; if (spray) { - float imperfection = 40*(Create.RANDOM.nextFloat() - 0.5f); + float imperfection = 40 * (Create.RANDOM.nextFloat() - 0.5f); Vector3d sprayOffset = VecHelper.rotate(sprayBase, i * sprayChange + imperfection, Axis.Z); splitMotion = splitMotion.add(VecHelper.lookAt(sprayOffset, motion)); } + + if (i != 0) + projectile.recoveryChance = 0; projectile.setPosition(barrelPos.x, barrelPos.y, barrelPos.z); projectile.setMotion(splitMotion); @@ -197,20 +224,45 @@ public class PotatoCannonItem extends ShootableItem { @Override @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { + int power = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, stack); + int punch = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack); + final float additionalDamage = power * 2; + final float additionalKnockback = punch * .5f; + getAmmoforPreview(stack).ifPresent(ammo -> { + String _attack = "potato_cannon.ammo.attack_damage"; + String _reload = "potato_cannon.ammo.reload_ticks"; + String _knockback = "potato_cannon.ammo.knockback"; + tooltip.add(new StringTextComponent("")); tooltip.add(new TranslationTextComponent(ammo.getTranslationKey()).append(new StringTextComponent(":")) .formatted(TextFormatting.GRAY)); PotatoCannonProjectileTypes type = PotatoCannonProjectileTypes.getProjectileTypeOf(ammo) .get(); StringTextComponent spacing = new StringTextComponent(" "); + TextFormatting green = TextFormatting.GREEN; TextFormatting darkGreen = TextFormatting.DARK_GREEN; + + float damageF = type.getDamage() + additionalDamage; + IFormattableTextComponent damage = new StringTextComponent( + damageF == MathHelper.floor(damageF) ? "" + MathHelper.floor(damageF) : "" + damageF); + IFormattableTextComponent reloadTicks = new StringTextComponent("" + type.getReloadTicks()); + IFormattableTextComponent knockback = + new StringTextComponent("" + (type.getKnockback() + additionalKnockback)); + + damage = damage.formatted(additionalDamage > 0 ? green : darkGreen); + knockback = knockback.formatted(additionalKnockback > 0 ? green : darkGreen); + reloadTicks = reloadTicks.formatted(darkGreen); + tooltip.add(spacing.copy() - .append(new StringTextComponent(type.getDamage() + " Attack Damage").formatted(darkGreen))); + .append(Lang.translate(_attack, damage) + .formatted(darkGreen))); tooltip.add(spacing.copy() - .append(new StringTextComponent(type.getReloadTicks() + " Reload Ticks").formatted(darkGreen))); + .append(Lang.translate(_reload, reloadTicks) + .formatted(darkGreen))); tooltip.add(spacing.copy() - .append(new StringTextComponent(type.getKnockback() + " Knockback").formatted(darkGreen))); + .append(Lang.translate(_knockback, knockback) + .formatted(darkGreen))); }); super.addInformation(stack, world, tooltip, flag); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonProjectileTypes.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonProjectileTypes.java index d6008d8ce..b14e84700 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonProjectileTypes.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonProjectileTypes.java @@ -3,8 +3,9 @@ package com.simibubi.create.content.curiosities.weapons; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import java.util.function.BiConsumer; +import java.util.function.BiPredicate; import java.util.function.Consumer; +import java.util.function.Predicate; import com.mojang.datafixers.util.Pair; import com.simibubi.create.AllItems; @@ -255,10 +256,8 @@ public class PotatoCannonProjectileTypes { private float fwoompPitch = 1; private boolean sticky = false; private PotatoProjectileRenderMode renderMode = new PotatoProjectileRenderMode.Billboard(); - private Consumer onEntityHit = e -> { - }; - private BiConsumer onBlockHit = (w, ray) -> { - }; + private Predicate onEntityHit = e -> false; + private BiPredicate onBlockHit = (w, ray) -> false; public float getGravityMultiplier() { return gravityMultiplier; @@ -298,12 +297,12 @@ public class PotatoCannonProjectileTypes { public boolean isSticky() { return sticky; } - public void onEntityHit(EntityRayTraceResult ray) { - onEntityHit.accept(ray); + public boolean onEntityHit(EntityRayTraceResult ray) { + return onEntityHit.test(ray); } - public void onBlockHit(IWorld world, BlockRayTraceResult ray) { - onBlockHit.accept(world, ray); + public boolean onBlockHit(IWorld world, BlockRayTraceResult ray) { + return onBlockHit.test(world, ray); } private static Consumer potion(Effect effect, int level, int ticks) { @@ -326,37 +325,38 @@ public class PotatoCannonProjectileTypes { }; } - private static BiConsumer plantCrop(IRegistryDelegate cropBlock) { + private static BiPredicate plantCrop(IRegistryDelegate cropBlock) { return (world, ray) -> { BlockPos hitPos = ray.getPos(); if (!world.isAreaLoaded(hitPos, 1)) - return; + return true; Direction face = ray.getFace(); BlockPos placePos = hitPos.offset(face); if (!world.getBlockState(placePos) .getMaterial() .isReplaceable()) - return; + return false; if (!(cropBlock.get() instanceof IPlantable)) - return; + return false; BlockState blockState = world.getBlockState(hitPos); if (!blockState.canSustainPlant(world, hitPos, face, (IPlantable) cropBlock.get())) - return; + return false; world.setBlockState(placePos, cropBlock.get().getDefaultState(), 3); + return true; }; } - private static BiConsumer placeBlockOnGround(IRegistryDelegate block) { + private static BiPredicate placeBlockOnGround(IRegistryDelegate block) { return (world, ray) -> { BlockPos hitPos = ray.getPos(); if (!world.isAreaLoaded(hitPos, 1)) - return; + return true; Direction face = ray.getFace(); BlockPos placePos = hitPos.offset(face); if (!world.getBlockState(placePos) .getMaterial() .isReplaceable()) - return; + return false; if (face == Direction.UP) { world.setBlockState(placePos, block.get().getDefaultState(), 3); @@ -372,6 +372,8 @@ public class PotatoCannonProjectileTypes { falling.fallTime = 1; world.addEntity(falling); } + + return true; }; } @@ -481,12 +483,20 @@ public class PotatoCannonProjectileTypes { return this; } - public Builder onEntityHit(Consumer callback) { + public Builder onEntityHitRecoveryCancelable(Predicate callback) { result.onEntityHit = callback; return this; } + + public Builder onEntityHit(Consumer callback) { + result.onEntityHit = ray -> { + callback.accept(ray); + return false; + }; + return this; + } - public Builder onBlockHit(BiConsumer callback) { + public Builder onBlockHit(BiPredicate callback) { result.onBlockHit = callback; return this; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java index 9c5a056a5..9dd80bc7e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java @@ -2,12 +2,14 @@ package com.simibubi.create.content.curiosities.weapons; import javax.annotation.Nullable; +import com.simibubi.create.AllEnchantments; import com.simibubi.create.AllSoundEvents; import com.simibubi.create.content.contraptions.particle.AirParticleData; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; @@ -32,9 +34,11 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.items.ItemHandlerHelper; public class PotatoProjectileEntity extends DamagingProjectileEntity implements IEntityAdditionalSpawnData { + PotatoCannonProjectileTypes type; ItemStack stack = ItemStack.EMPTY; Entity stuckEntity; @@ -42,7 +46,9 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements PotatoProjectileRenderMode stuckRenderer; double stuckFallSpeed; - PotatoCannonProjectileTypes type; + float additionalDamage = 0; + float additionalKnockback = 0; + float recoveryChance = .125f; public PotatoProjectileEntity(EntityType type, World world) { super(type, world); @@ -63,15 +69,37 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements return type; } + public void setEnchantmentEffectsFromCannon(ItemStack cannon) { + int power = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, cannon); + int punch = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, cannon); + int flame = EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, cannon); + int recovery = EnchantmentHelper.getEnchantmentLevel(AllEnchantments.POTATO_RECOVERY.get(), cannon); + + if (power > 0) + additionalDamage = power * 2; + if (punch > 0) + additionalKnockback = punch * .5f; + if (flame > 0) + setFire(100); + if (recovery > 0) + recoveryChance = .125f + recovery * .125f; + } + @Override public void readAdditional(CompoundNBT nbt) { stack = ItemStack.read(nbt.getCompound("Item")); + additionalDamage = nbt.getFloat("AdditionalDamage"); + additionalKnockback = nbt.getFloat("AdditionalKnockback"); + recoveryChance = nbt.getFloat("Recovery"); super.readAdditional(nbt); } @Override public void writeAdditional(CompoundNBT nbt) { nbt.put("Item", stack.serializeNBT()); + nbt.putFloat("AdditionalDamage", additionalDamage); + nbt.putFloat("AdditionalKnockback", additionalKnockback); + nbt.putFloat("Recovery", recoveryChance); super.writeAdditional(nbt); } @@ -109,7 +137,8 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements } else { stuckFallSpeed += 0.007 * projectileType.getGravityMultiplier(); stuckOffset = stuckOffset.add(0, -stuckFallSpeed, 0); - Vector3d pos = stuckEntity.getPositionVec().add(stuckOffset); + Vector3d pos = stuckEntity.getPositionVec() + .add(stuckOffset); setPosition(pos.x, pos.y, pos.z); } } else { @@ -145,8 +174,8 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements Vector3d hit = ray.getHitVec(); Entity target = ray.getEntity(); PotatoCannonProjectileTypes projectileType = getProjectileType(); - int damage = projectileType.getDamage(); - float knockback = projectileType.getKnockback(); + float damage = projectileType.getDamage() + additionalDamage; + float knockback = projectileType.getKnockback() + additionalKnockback; Entity owner = this.getOwner(); if (!target.isAlive()) @@ -173,7 +202,9 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements if (targetIsEnderman) return; - projectileType.onEntityHit(ray); + if (!projectileType.onEntityHit(ray)) + if (rand.nextDouble() <= recoveryChance) + recoverItem(); if (!(target instanceof LivingEntity)) { playHitSound(world, getPositionVec()); @@ -200,8 +231,8 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements EnchantmentHelper.applyArthropodEnchantments((LivingEntity) owner, livingentity); } - if (livingentity != owner && livingentity instanceof PlayerEntity - && owner instanceof ServerPlayerEntity && !this.isSilent()) { + if (livingentity != owner && livingentity instanceof PlayerEntity && owner instanceof ServerPlayerEntity + && !this.isSilent()) { ((ServerPlayerEntity) owner).connection .sendPacket(new SChangeGameStatePacket(SChangeGameStatePacket.PROJECTILE_HIT_PLAYER, 0.0F)); } @@ -222,6 +253,11 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements } + private void recoverItem() { + if (!stack.isEmpty()) + entityDropItem(ItemHandlerHelper.copyStackWithSize(stack, 1)); + } + public static void playHitSound(World world, Vector3d location) { AllSoundEvents.POTATO_HIT.playOnServer(world, new BlockPos(location)); } @@ -234,7 +270,9 @@ public class PotatoProjectileEntity extends DamagingProjectileEntity implements protected void onBlockHit(BlockRayTraceResult ray) { Vector3d hit = ray.getHitVec(); pop(hit); - getProjectileType().onBlockHit(world, ray); + if (!getProjectileType().onBlockHit(world, ray)) + if (rand.nextDouble() <= recoveryChance) + recoverItem(); super.onBlockHit(ray); remove(); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoRecoveryEnchantment.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoRecoveryEnchantment.java new file mode 100644 index 000000000..d6f770279 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoRecoveryEnchantment.java @@ -0,0 +1,24 @@ +package com.simibubi.create.content.curiosities.weapons; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentType; +import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.ItemStack; + +public class PotatoRecoveryEnchantment extends Enchantment { + + public PotatoRecoveryEnchantment(Rarity p_i46731_1_, EnchantmentType p_i46731_2_, EquipmentSlotType[] p_i46731_3_) { + super(p_i46731_1_, p_i46731_2_, p_i46731_3_); + } + + @Override + public int getMaxLevel() { + return 3; + } + + @Override + public boolean canApplyAtEnchantingTable(ItemStack stack) { + return stack.getItem() instanceof PotatoCannonItem; + } + +} diff --git a/src/main/resources/assets/create/lang/default/messages.json b/src/main/resources/assets/create/lang/default/messages.json index 5746e2e58..4fc54ecfd 100644 --- a/src/main/resources/assets/create/lang/default/messages.json +++ b/src/main/resources/assets/create/lang/default/messages.json @@ -504,6 +504,10 @@ "create.crafting_blueprint.manually_assigned": "Manually assigned", "create.crafting_blueprint.secondary_display_slot": "Secondary Display Slot", "create.crafting_blueprint.optional": "Optional", + + "create.potato_cannon.ammo.attack_damage": "%1$s Attack Damage", + "create.potato_cannon.ammo.reload_ticks": "%1$s Reload Ticks", + "create.potato_cannon.ammo.knockback": "%1$s Knockback", "create.hint.hose_pulley.title": "Bottomless Supply", "create.hint.hose_pulley": "The targeted body of fluid is considered infinite.",