From e81533f59bf1746c85f2cf45874c101dd1d42468 Mon Sep 17 00:00:00 2001 From: direwolf20 <39863894+Direwolf20-MC@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:24:12 -0500 Subject: [PATCH 1/6] Add Polymorphic Wand - Item only --- .../69ee5e809dff011efe049b68501078221ca37cb0 | 3 ++- .../8202586f691eec5ad0bb88d13a278951d0c130fb | 4 ++-- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +++- .../assets/justdirethings/lang/en_us.json | 1 + .../common/items/PolymorphicWand.java | 15 +++++++++++++++ .../datagen/JustDireItemModels.java | 1 + .../datagen/JustDireLanguageProvider.java | 1 + .../justdirethings/datagen/JustDireRecipes.java | 9 +++++++++ .../justdirethings/setup/Registration.java | 1 + .../textures/item/polymorphic_wand.png | Bin 0 -> 260 bytes 10 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java create mode 100644 src/main/resources/assets/justdirethings/textures/item/polymorphic_wand.png diff --git a/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 b/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 index 5e831925..16c6b10d 100644 --- a/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 +++ b/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 @@ -1,4 +1,4 @@ -// 1.21.1 2024-12-04T17:22:22.4686514 Item Models: justdirethings +// 1.21.1 2024-12-07T12:22:16.5077405 Item Models: justdirethings c197a1b2a5ae31fcfabfe6cab9ab95a9dc0e1af6 assets/justdirethings/models/item/blazegold_axe.json dddf215922d40d92c2d8bce4229f2e2af8b3c7ba assets/justdirethings/models/item/blazegold_axe_active.json 6396fb6e503760080534bc26337236d4d09a4cb8 assets/justdirethings/models/item/blazegold_block.json @@ -292,6 +292,7 @@ b10bbca68270e48599af7174531b0235c8e7c9a4 assets/justdirethings/models/item/playe 86e8b463737ba209a47a1f3544b51525598d38a3 assets/justdirethings/models/item/pocket_generator_active.json 6ac490fc1ca0a7b3663a770a09e3cd3ade652bb5 assets/justdirethings/models/item/polymorphic_catalyst.json c51b41b9c484aa6724dfe24732b06a196ee05ffe assets/justdirethings/models/item/polymorphic_fluid_bucket.json +af285bda921f3fea66dd01b7b30fadfd8669ee14 assets/justdirethings/models/item/polymorphic_wand.json 403d14795debb89f422eefb10f3b8188e148190a assets/justdirethings/models/item/portal_fluid_bucket.json ea9b4416ff95371822cbc5808fd425323b170cc9 assets/justdirethings/models/item/portal_fluid_catalyst.json d8ea68a75b8b49f7765e715d62ad23c2f1939281 assets/justdirethings/models/item/raw_blazegold.json diff --git a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb index e2105355..4985fc6b 100644 --- a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb +++ b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-05T15:28:54.1394864 Languages: en_us for mod: justdirethings -34988637a21b45b6d93036e8fe9525ffdd8c9e97 assets/justdirethings/lang/en_us.json +// 1.21.1 2024-12-07T12:22:16.5157473 Languages: en_us for mod: justdirethings +3b47394404270f860109f4004040665ac95dfef0 assets/justdirethings/lang/en_us.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 4ea6ce03..bc0f9db0 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.21.1 2024-11-02T12:45:23.0801389 Recipes +// 1.21.1 2024-12-07T12:22:16.5167479 Recipes 39cd44c838de7f56aeac73aec8b3bfb64ad7fec2 data/justdirethings/advancement/recipes/building_blocks/blazegold_ingot_9x9.json 2f2a0f948f272df9713010dbcb75beb81c328b01 data/justdirethings/advancement/recipes/building_blocks/celestigem_9x9.json 4c183b67eff4bc24117606cdc45ebcd987dd4138 data/justdirethings/advancement/recipes/building_blocks/charcoal_9x9.json @@ -307,6 +307,7 @@ dad2a7782e9a1e1d8e7099a6596640b309925ed9 data/justdirethings/advancement/recipes 2cf19ff627966b28128eb42fd47c9b9e84bc43d8 data/justdirethings/advancement/recipes/misc/pocket_generator.json 858af81155eff55f8b4cff67f9bade9f64071902 data/justdirethings/advancement/recipes/misc/polymorphic_catalyst.json d028ad197c2078a4c30eafcbde2282aff17f1df1 data/justdirethings/advancement/recipes/misc/polymorphic_fluid_block-fluiddrop.json +8d77029166db109c5f6f34ecd68888bbb458b36f data/justdirethings/advancement/recipes/misc/polymorphic_wand.json 5570c3f5f6bf47c6d6026ead547ac4516bad5da9 data/justdirethings/advancement/recipes/misc/portalgun.json f921713cd6dfa2ad74a0b7144f7778c2fe33bc72 data/justdirethings/advancement/recipes/misc/portalgun_v2.json c811419aba5aeaf1be214e7f29492a7ccb300ddd data/justdirethings/advancement/recipes/misc/portal_fluid_block-goospread.json @@ -696,6 +697,7 @@ de4d6dd744789b903d6828fec4ce5847a1dfef60 data/justdirethings/recipe/paradoxmachi cc73b7c24448814a0e8663c8065a6625cbd30072 data/justdirethings/recipe/pocket_generator.json 035ed5c68eac114352b166d38b7f8308e5db63c0 data/justdirethings/recipe/polymorphic_catalyst.json 6cfafeb9ae58abc121bd78f1c67b11aedec8297b data/justdirethings/recipe/polymorphic_fluid_block-fluiddrop.json +fc60c6a1885dc44e50e451ea8e12eb4f9d7acf4c data/justdirethings/recipe/polymorphic_wand.json 1494fe69edb92207b18a251b9c4a4d7ef2487b45 data/justdirethings/recipe/portalgun.json 4ed1bcc18461694ef969bb8820a6a4433cec054f data/justdirethings/recipe/portalgun_v2.json 881053ecbb4f27590666128cfd52f2c212cf6a37 data/justdirethings/recipe/portal_fluid_block-goospread.json diff --git a/src/generated/resources/assets/justdirethings/lang/en_us.json b/src/generated/resources/assets/justdirethings/lang/en_us.json index 015e8066..6d9c1192 100644 --- a/src/generated/resources/assets/justdirethings/lang/en_us.json +++ b/src/generated/resources/assets/justdirethings/lang/en_us.json @@ -144,6 +144,7 @@ "item.justdirethings.pocket_generator": "Pocket Generator", "item.justdirethings.polymorphic_catalyst": "Polymorphic Catalyst", "item.justdirethings.polymorphic_fluid_bucket": "Polymorphic Fluid Bucket", + "item.justdirethings.polymorphic_wand": "Polymorphic Wand", "item.justdirethings.portal_fluid_bucket": "Portal Fluid Bucket", "item.justdirethings.portal_fluid_catalyst": "Portal Fluid Catalyst", "item.justdirethings.portalgun": "Portal Gun", diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java new file mode 100644 index 00000000..4a2e654f --- /dev/null +++ b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java @@ -0,0 +1,15 @@ +package com.direwolf20.justdirethings.common.items; + +import com.direwolf20.justdirethings.common.items.interfaces.Ability; +import com.direwolf20.justdirethings.common.items.interfaces.BaseToggleableTool; +import com.direwolf20.justdirethings.common.items.interfaces.LeftClickableTool; + +public class PolymorphicWand extends BaseToggleableTool implements LeftClickableTool { + public PolymorphicWand() { + super(new Properties() + .fireResistant() + .durability(200)); + registerAbility(Ability.LAVAREPAIR); + //registerAbility(Ability.AIRBURST, new AbilityParams(1, 2, 1, 2)); + } +} diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java index 5f60da8c..0139c61d 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java @@ -118,6 +118,7 @@ protected void registerModels() { singleTexture(Registration.TEMPLATE_CELESTIGEM.getId().getPath(), mcLoc("item/generated"), "layer0", modLoc("item/template_celestigem")); singleTexture(Registration.TEMPLATE_ECLIPSEALLOY.getId().getPath(), mcLoc("item/generated"), "layer0", modLoc("item/template_eclipsealloy")); singleTexture(Registration.TimeWand.getId().getPath(), mcLoc("item/generated"), "layer0", modLoc("item/time_wand")); + singleTexture(Registration.PolymorphicWand.getId().getPath(), mcLoc("item/handheld"), "layer0", modLoc("item/polymorphic_wand")); registerBowModels(); diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java index 60f653e5..5448d045 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java @@ -132,6 +132,7 @@ protected void addTranslations() { add(Registration.FluidCanister.get(), "Fluid Canister"); add(Registration.PotionCanister.get(), "Potion Canister"); add(Registration.TimeWand.get(), "Time Wand"); + add(Registration.PolymorphicWand.get(), "Polymorphic Wand"); //Tools add(Registration.FerricoreSword.get(), "Ferricore Sword"); diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java index 90dae373..ccca70ca 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java @@ -454,6 +454,15 @@ protected void buildRecipes(RecipeOutput consumer) { .group("justdirethings") .unlockedBy("has_eclipsealloy_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.EclipseAlloyIngot.get())) .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Registration.PolymorphicWand.get()) + .pattern(" b") + .pattern(" i ") + .pattern("i ") + .define('i', Registration.BlazegoldIngot.get()) + .define('b', Registration.FluidCanister.get()) + .group("justdirethings") + .unlockedBy("has_blazegold_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.BlazegoldIngot.get())) + .save(consumer); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Registration.TimeWand.get()) .pattern(" bt") .pattern(" ib") diff --git a/src/main/java/com/direwolf20/justdirethings/setup/Registration.java b/src/main/java/com/direwolf20/justdirethings/setup/Registration.java index 5967ea36..6cf824b0 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/Registration.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/Registration.java @@ -518,6 +518,7 @@ public static void init(IEventBus eventBus) { public static final DeferredHolder BlazegoldBow = BOWS.register("bow_blazegold", BlazegoldBow::new); public static final DeferredHolder CelestigemBow = BOWS.register("bow_celestigem", CelestigemBow::new); public static final DeferredHolder EclipseAlloyBow = BOWS.register("bow_eclipsealloy", EclipseAlloyBow::new); + public static final DeferredHolder PolymorphicWand = ITEMS.register("polymorphic_wand", PolymorphicWand::new); //Items - Tools public static final DeferredHolder FerricoreSword = TOOLS.register("ferricore_sword", FerricoreSword::new); diff --git a/src/main/resources/assets/justdirethings/textures/item/polymorphic_wand.png b/src/main/resources/assets/justdirethings/textures/item/polymorphic_wand.png new file mode 100644 index 0000000000000000000000000000000000000000..4b1fd36dad54e4caf3a39ec654624230d77f66ac GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}H0G|-oI33$_=g$5A|9|b;wcj@6+9?{Z3k!ZZA^2jR4^RoK0vI-((K!zk7ExqUo7EgezsnVL0gsKij~lTjJZn~rmRp+*s#*$-GKn%IL!p!4L>Jx=h(g9|F`G} t!;Mbq1v6!{?mv8KeW!Hyqc Date: Sat, 7 Dec 2024 12:24:27 -0500 Subject: [PATCH 2/6] Add Polymorphic Wand - Item only (JSONS) --- .../models/item/polymorphic_wand.json | 6 ++++ .../recipes/misc/polymorphic_wand.json | 32 +++++++++++++++++++ .../recipe/polymorphic_wand.json | 22 +++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 src/generated/resources/assets/justdirethings/models/item/polymorphic_wand.json create mode 100644 src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand.json create mode 100644 src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json diff --git a/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand.json b/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand.json new file mode 100644 index 00000000..ad069fb2 --- /dev/null +++ b/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "justdirethings:item/polymorphic_wand" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand.json b/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand.json new file mode 100644 index 00000000..1927185c --- /dev/null +++ b/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_blazegold_ingot": { + "conditions": { + "items": [ + { + "items": "justdirethings:blazegold_ingot" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "justdirethings:polymorphic_wand" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_blazegold_ingot" + ] + ], + "rewards": { + "recipes": [ + "justdirethings:polymorphic_wand" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json new file mode 100644 index 00000000..cb1a03d1 --- /dev/null +++ b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "justdirethings", + "key": { + "b": { + "item": "justdirethings:fluid_canister" + }, + "i": { + "item": "justdirethings:blazegold_ingot" + } + }, + "pattern": [ + " b", + " i ", + "i " + ], + "result": { + "count": 1, + "id": "justdirethings:polymorphic_wand" + } +} \ No newline at end of file From 2eee62ca86605fc9fe81aa69050b3bad0a0b0f41 Mon Sep 17 00:00:00 2001 From: direwolf20 <39863894+Direwolf20-MC@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:27:25 -0500 Subject: [PATCH 3/6] Add Random Polymorph Functionality --- .../7e4928c403af173c11f4d1675461c34bf5d23056 | 4 +- .../8202586f691eec5ad0bb88d13a278951d0c130fb | 4 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../assets/justdirethings/lang/en_us.json | 3 + .../recipe/polymorphic_wand.json | 5 +- .../tags/entity_type/polymorphic_hostile.json | 35 ++++++++ .../entity_type/polymorphic_peaceful.json | 40 ++++++++++ .../justdirethings/JustDireThings.java | 18 ++++- .../itemcustomrenders/FluidbarDecorator.java | 2 + .../common/items/PolymorphicWand.java | 72 +++++++++++++++-- .../common/items/interfaces/Ability.java | 3 + .../items/interfaces/AbilityMethods.java | 68 +++++++++++++++- .../items/interfaces/FluidContainingItem.java | 43 +++++++++- .../datagen/JustDireEntityTags.java | 75 +++++++++++++++++- .../datagen/JustDireLanguageProvider.java | 3 + .../datagen/JustDireRecipes.java | 3 +- .../justdirethings/setup/ClientSetup.java | 1 + .../justdirethings/setup/Config.java | 14 ++++ .../textures/gui/buttons/polymorph_random.png | Bin 0 -> 508 bytes .../textures/gui/buttons/polymorph_target.png | Bin 0 -> 534 bytes .../item/abilityupgrades/polymorph_random.png | Bin 0 -> 508 bytes .../item/abilityupgrades/polymorph_target.png | Bin 0 -> 534 bytes 22 files changed, 378 insertions(+), 19 deletions(-) create mode 100644 src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_hostile.json create mode 100644 src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_peaceful.json create mode 100644 src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_random.png create mode 100644 src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_target.png create mode 100644 src/main/resources/assets/justdirethings/textures/item/abilityupgrades/polymorph_random.png create mode 100644 src/main/resources/assets/justdirethings/textures/item/abilityupgrades/polymorph_target.png diff --git a/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 b/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 index 65eeb096..e7945e0e 100644 --- a/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 +++ b/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 @@ -1,8 +1,10 @@ -// 1.21.1 2024-09-25T19:43:29.0537222 Tags for minecraft:entity_type mod id justdirethings +// 1.21.1 2024-12-07T15:14:23.6887728 Tags for minecraft:entity_type mod id justdirethings b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/c/tags/entity_type/teleporting_not_supported.json e00f2931577049b9a4400a87ed9c249373be376c data/justdirethings/tags/entity_type/creature_catcher_deny.json 669025814936e708d42d9d0a5b88c11e62cf12ef data/justdirethings/tags/entity_type/no_ai_deny.json 669025814936e708d42d9d0a5b88c11e62cf12ef data/justdirethings/tags/entity_type/no_earthquake.json b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/justdirethings/tags/entity_type/paradox_absorb_deny.json b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/justdirethings/tags/entity_type/paradox_deny.json +263995270039da950f2e27b535f1b7c71a5f5423 data/justdirethings/tags/entity_type/polymorphic_hostile.json +d53ddb5be22b17ec02beda6e2e3695f074abc70f data/justdirethings/tags/entity_type/polymorphic_peaceful.json 6a890ea62d03cc1110fa8d1fe5a0669082d9d96b data/minecraft/tags/entity_type/arrows.json diff --git a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb index 4985fc6b..b8a522b2 100644 --- a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb +++ b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-07T12:22:16.5157473 Languages: en_us for mod: justdirethings -3b47394404270f860109f4004040665ac95dfef0 assets/justdirethings/lang/en_us.json +// 1.21.1 2024-12-07T15:35:26.0358297 Languages: en_us for mod: justdirethings +dc7bbea3a13870709a7bafccf7758ac21f7bffec assets/justdirethings/lang/en_us.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index bc0f9db0..534a7276 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.21.1 2024-12-07T12:22:16.5167479 Recipes +// 1.21.1 2024-12-07T15:39:40.3847313 Recipes 39cd44c838de7f56aeac73aec8b3bfb64ad7fec2 data/justdirethings/advancement/recipes/building_blocks/blazegold_ingot_9x9.json 2f2a0f948f272df9713010dbcb75beb81c328b01 data/justdirethings/advancement/recipes/building_blocks/celestigem_9x9.json 4c183b67eff4bc24117606cdc45ebcd987dd4138 data/justdirethings/advancement/recipes/building_blocks/charcoal_9x9.json @@ -697,7 +697,7 @@ de4d6dd744789b903d6828fec4ce5847a1dfef60 data/justdirethings/recipe/paradoxmachi cc73b7c24448814a0e8663c8065a6625cbd30072 data/justdirethings/recipe/pocket_generator.json 035ed5c68eac114352b166d38b7f8308e5db63c0 data/justdirethings/recipe/polymorphic_catalyst.json 6cfafeb9ae58abc121bd78f1c67b11aedec8297b data/justdirethings/recipe/polymorphic_fluid_block-fluiddrop.json -fc60c6a1885dc44e50e451ea8e12eb4f9d7acf4c data/justdirethings/recipe/polymorphic_wand.json +52f1c1f4d04ba53cc38b2dbfc49fb1d19a35b344 data/justdirethings/recipe/polymorphic_wand.json 1494fe69edb92207b18a251b9c4a4d7ef2487b45 data/justdirethings/recipe/portalgun.json 4ed1bcc18461694ef969bb8820a6a4433cec054f data/justdirethings/recipe/portalgun_v2.json 881053ecbb4f27590666128cfd52f2c212cf6a37 data/justdirethings/recipe/portal_fluid_block-goospread.json diff --git a/src/generated/resources/assets/justdirethings/lang/en_us.json b/src/generated/resources/assets/justdirethings/lang/en_us.json index 6d9c1192..dcefc0ca 100644 --- a/src/generated/resources/assets/justdirethings/lang/en_us.json +++ b/src/generated/resources/assets/justdirethings/lang/en_us.json @@ -253,6 +253,7 @@ "justdirethings.ability.orescanner": "Ore Scanner", "justdirethings.ability.orexray": "X-Ray", "justdirethings.ability.phase": "Phase", + "justdirethings.ability.polymorph_random": "Random Polymorph", "justdirethings.ability.potionarrow": "Potion Arrow", "justdirethings.ability.runspeed": "Run Speed", "justdirethings.ability.skysweeper": "Sky Sweeper", @@ -317,6 +318,7 @@ "justdirethings.hint.dropinwater": "Drop in Water", "justdirethings.homing.detailtext": "Arrows seek their targets", "justdirethings.instabreak.detailtext": "Instantly break all blocks", + "justdirethings.invalidpolymorphentity": "Invalid Entity for Polymorphing", "justdirethings.invulnerability.detailtext": "Activate for a few seconds of invulnerability", "justdirethings.invulnerability.flavortext": "Bring it!!", "justdirethings.jumpboost.detailtext": "Jump Higher", @@ -350,6 +352,7 @@ "justdirethings.pocketgeneratorburntime": "Burn Time: %f / %f", "justdirethings.pocketgeneratorfuelstack": "Fuel: %f %s", "justdirethings.pocketgeneratornofuel": "Fuel Empty", + "justdirethings.polymorphicfluidamt": "Polymorphic Fluid: %s / %s", "justdirethings.portalfluidamt": "Portal Fluid: %s / %s", "justdirethings.potionarrow.detailtext": "Insert a Potion Canister to apply effects to enemies", "justdirethings.potionarrow.flavortext": "Like Vanilla, without inventory issues...", diff --git a/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json index cb1a03d1..1f589247 100644 --- a/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json +++ b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand.json @@ -8,11 +8,14 @@ }, "i": { "item": "justdirethings:blazegold_ingot" + }, + "r": { + "item": "justdirethings:polymorphic_catalyst" } }, "pattern": [ " b", - " i ", + " r ", "i " ], "result": { diff --git a/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_hostile.json b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_hostile.json new file mode 100644 index 00000000..5bb8bb99 --- /dev/null +++ b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_hostile.json @@ -0,0 +1,35 @@ +{ + "values": [ + "minecraft:zombie", + "minecraft:skeleton", + "minecraft:creeper", + "minecraft:spider", + "minecraft:enderman", + "minecraft:silverfish", + "minecraft:zombified_piglin", + "minecraft:piglin", + "minecraft:piglin_brute", + "minecraft:hoglin", + "minecraft:zoglin", + "minecraft:ghast", + "minecraft:blaze", + "minecraft:slime", + "minecraft:witch", + "minecraft:rabbit", + "minecraft:endermite", + "minecraft:stray", + "minecraft:wither_skeleton", + "minecraft:skeleton_horse", + "minecraft:zombie_horse", + "minecraft:zombie_villager", + "minecraft:husk", + "minecraft:guardian", + "minecraft:evoker", + "minecraft:vex", + "minecraft:vindicator", + "minecraft:shulker", + "minecraft:drowned", + "minecraft:phantom", + "minecraft:pillager" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_peaceful.json b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_peaceful.json new file mode 100644 index 00000000..e94db878 --- /dev/null +++ b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_peaceful.json @@ -0,0 +1,40 @@ +{ + "values": [ + "minecraft:sheep", + "minecraft:pig", + "minecraft:cow", + "minecraft:mooshroom", + "minecraft:chicken", + "minecraft:bat", + "minecraft:villager", + "minecraft:squid", + "minecraft:ocelot", + "minecraft:wolf", + "minecraft:horse", + "minecraft:rabbit", + "minecraft:donkey", + "minecraft:mule", + "minecraft:polar_bear", + "minecraft:llama", + "minecraft:parrot", + "minecraft:dolphin", + "minecraft:cod", + "minecraft:salmon", + "minecraft:pufferfish", + "minecraft:tropical_fish", + "minecraft:turtle", + "minecraft:cat", + "minecraft:fox", + "minecraft:panda", + "minecraft:trader_llama", + "minecraft:wandering_trader", + "minecraft:strider", + "minecraft:glow_squid", + "minecraft:goat", + "minecraft:bee", + "minecraft:frog", + "minecraft:tadpole", + "minecraft:camel", + "minecraft:axolotl" + ] +} \ No newline at end of file diff --git a/src/main/java/com/direwolf20/justdirethings/JustDireThings.java b/src/main/java/com/direwolf20/justdirethings/JustDireThings.java index a325cf74..87161baa 100644 --- a/src/main/java/com/direwolf20/justdirethings/JustDireThings.java +++ b/src/main/java/com/direwolf20/justdirethings/JustDireThings.java @@ -10,6 +10,7 @@ import com.direwolf20.justdirethings.common.containers.handlers.PotionCanisterHandler; import com.direwolf20.justdirethings.common.entities.DecoyEntity; import com.direwolf20.justdirethings.common.items.FluidCanister; +import com.direwolf20.justdirethings.common.items.PolymorphicWand; import com.direwolf20.justdirethings.common.items.PortalGunV2; import com.direwolf20.justdirethings.common.items.TimeWand; import com.direwolf20.justdirethings.common.items.datacomponents.JustDireDataComponents; @@ -168,6 +169,20 @@ public boolean canFillFluidType(FluidStack fluid) { }; } + if (itemStack.getItem() instanceof PolymorphicWand polymorphicWand) { + return new FluidHandlerItemStack(JustDireDataComponents.FLUID_CONTAINER, itemStack, polymorphicWand.getMaxMB()) { + @Override + public boolean isFluidValid(int tank, FluidStack stack) { + return stack.is(Registration.POLYMORPHIC_FLUID_TYPE.get()); + } + + @Override + public boolean canFillFluidType(FluidStack fluid) { + return fluid.is(Registration.POLYMORPHIC_FLUID_TYPE.get()); + } + + }; + } if (itemStack.getItem() instanceof FluidCanister fluidCanister) { return new FluidHandlerItemStack(JustDireDataComponents.FLUID_CONTAINER, itemStack, fluidCanister.getMaxMB()); } @@ -175,7 +190,8 @@ public boolean canFillFluidType(FluidStack fluid) { }, Registration.PortalGunV2.get(), Registration.FluidCanister.get(), - Registration.TimeWand.get() + Registration.TimeWand.get(), + Registration.PolymorphicWand.get() ); //Blocks diff --git a/src/main/java/com/direwolf20/justdirethings/client/itemcustomrenders/FluidbarDecorator.java b/src/main/java/com/direwolf20/justdirethings/client/itemcustomrenders/FluidbarDecorator.java index 2fa8d9ec..eb95b84f 100644 --- a/src/main/java/com/direwolf20/justdirethings/client/itemcustomrenders/FluidbarDecorator.java +++ b/src/main/java/com/direwolf20/justdirethings/client/itemcustomrenders/FluidbarDecorator.java @@ -17,6 +17,8 @@ public boolean render(GuiGraphics guiGraphics, Font font, ItemStack stack, int x if (stack.getItem() instanceof PoweredItem poweredItem) { isPowerBarVisible = poweredItem.isPowerBarVisible(stack); } + if (stack.isBarVisible()) + isPowerBarVisible = true; // Retrieve fluid capability boolean isFluidBarVisible = fluidContainingItem.isFluidBarVisible(stack); diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java index 4a2e654f..f75c541e 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java @@ -1,15 +1,77 @@ package com.direwolf20.justdirethings.common.items; -import com.direwolf20.justdirethings.common.items.interfaces.Ability; -import com.direwolf20.justdirethings.common.items.interfaces.BaseToggleableTool; -import com.direwolf20.justdirethings.common.items.interfaces.LeftClickableTool; +import com.direwolf20.justdirethings.common.items.interfaces.*; +import com.direwolf20.justdirethings.setup.Config; +import com.direwolf20.justdirethings.util.MagicHelpers; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; -public class PolymorphicWand extends BaseToggleableTool implements LeftClickableTool { +import java.util.List; + +public class PolymorphicWand extends BaseToggleableTool implements LeftClickableTool, FluidContainingItem { public PolymorphicWand() { super(new Properties() .fireResistant() .durability(200)); registerAbility(Ability.LAVAREPAIR); - //registerAbility(Ability.AIRBURST, new AbilityParams(1, 2, 1, 2)); + registerAbility(Ability.POLYMORPH_RANDOM); + } + + @Override + public int getMaxMB() { + return Config.POLYMORPHIC_WAND_MAX_FLUID.get(); + } + + @Override + public InteractionResult useOn(UseOnContext pContext) { + ItemStack itemStack = pContext.getItemInHand(); + Player player = pContext.getPlayer(); + if (player == null || itemStack.isEmpty()) return InteractionResult.FAIL; + BlockHitResult blockhitresult = getPlayerPOVHitResult(player.level(), player, ClipContext.Fluid.SOURCE_ONLY); + if (blockhitresult.getType() == HitResult.Type.BLOCK) { + if (FluidContainingItem.pickupFluid(player.level(), player, itemStack, blockhitresult)) + return InteractionResult.SUCCESS; + } + return super.useOn(pContext); } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); + BlockHitResult blockhitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); + if (blockhitresult.getType() == HitResult.Type.BLOCK) { + if (FluidContainingItem.pickupFluid(level, player, itemStack, blockhitresult)) + return InteractionResultHolder.fail(itemStack); + } + return super.use(level, player, hand); + } + + @Override + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipFlag flagIn) { + super.appendHoverText(stack, context, tooltip, flagIn); + Level level = context.level(); + if (level == null) { + return; + } + IFluidHandlerItem fluidHandler = stack.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandler == null) { + return; + } + tooltip.add(Component.translatable("justdirethings.polymorphicfluidamt", MagicHelpers.formatted(fluidHandler.getFluidInTank(0).getAmount()), MagicHelpers.formatted(fluidHandler.getTankCapacity(0))).withStyle(ChatFormatting.GREEN)); + } + } diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java index fc30c092..35dbc3c1 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java @@ -62,6 +62,9 @@ public enum Ability { AbilityMethods::stupefy, CustomSettingType.NONE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "textures/gui/overlay/stupefy.png"), Registration.UPGRADE_STUPEFY), SPLASH(SettingType.TOGGLE, 20, 250, UseType.PASSIVE, BindingType.CUSTOM_ONLY, Registration.UPGRADE_SPLASH), + POLYMORPH_RANDOM(SettingType.TOGGLE, 10, 1000, UseType.USE, BindingType.LEFT_AND_CUSTOM, + AbilityMethods::polymorphRandom, CustomSettingType.NONE, + ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "textures/gui/overlay/polymorph_random.png")), //Tier 3 DROPTELEPORT(SettingType.TOGGLE, 2, 100, UseType.PASSIVE, BindingType.CUSTOM_ONLY, CustomSettingType.RENDER, Registration.UPGRADE_DROPTELEPORT), diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java index 370d5cbd..bff61469 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java @@ -9,12 +9,15 @@ import com.direwolf20.justdirethings.common.network.data.ClientSoundPayload; import com.direwolf20.justdirethings.datagen.JustDireBlockTags; import com.direwolf20.justdirethings.datagen.JustDireEntityTags; +import com.direwolf20.justdirethings.setup.Config; import com.direwolf20.justdirethings.setup.Registration; import com.direwolf20.justdirethings.util.MiscTools; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -26,10 +29,7 @@ import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TieredItem; @@ -47,6 +47,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.entity.PartEntity; +import net.neoforged.neoforge.event.EventHooks; import net.neoforged.neoforge.items.IItemHandler; import net.neoforged.neoforge.network.PacketDistributor; @@ -471,6 +472,57 @@ public static boolean stupefy(Level level, Player player, ItemStack itemStack) { return false; } + public static boolean polymorphRandom(Level level, Player player, ItemStack itemStack) { + if (level.isClientSide) return false; + if (itemStack.getItem() instanceof ToggleableTool toggleableTool && toggleableTool.canUseAbilityAndDurability(itemStack, Ability.POLYMORPH_RANDOM)) { + int fuelAmt = Config.RANDOM_POLYMORPH_COST.get(); + if (!FluidContainingItem.hasEnoughFluid(itemStack, fuelAmt)) + return false; + Entity entity = MiscTools.getEntityLookedAt(player, 4); + if (entity == null) return false; + boolean peaceful = entity.getType().is(JustDireEntityTags.POLYMORPHIC_PEACEFUL); + if (!peaceful && !entity.getType().is(JustDireEntityTags.POLYMORPHIC_HOSTILE)) { + player.displayClientMessage(Component.translatable("justdirethings.invalidpolymorphentity"), true); + return false; //If not peaceful or hostile tagged, return + } + if (entity instanceof Mob mob) { + EntityType newType = getRandomMobTypeByCategory(level, peaceful); + if (newType != null) { + // Spawn new mob at the same location + Mob newMob = (Mob) newType.create(level); + if (newMob != null) { + EventHooks.finalizeMobSpawn(mob, (ServerLevel) level, level.getCurrentDifficultyAt(player.blockPosition()), MobSpawnType.SPAWNER, null); + + newMob.moveTo(mob.getX(), mob.getY(), mob.getZ(), mob.getYRot(), mob.getXRot()); + newMob.setHealth(newMob.getMaxHealth()); // Reset health to maximum + ((ServerLevel) level).addFreshEntityWithPassengers(newMob); + + if (!newMob.isAddedToLevel()) + return false; //If it failed to add for some reason? + + // Play effects + player.playNotifySound(SoundEvents.ILLUSIONER_CAST_SPELL, SoundSource.PLAYERS, 0.5F, 0.75F); + ((ServerLevel) level).sendParticles(ParticleTypes.WHITE_SMOKE, + mob.getX(), mob.getEyeY(), mob.getZ(), + 20, 0.25, 0.2, 0.25, 0); + + // Remove the old mob + mob.discard(); + + // Damage the tool + FluidContainingItem.consumeFluid(itemStack, fuelAmt); + Helpers.damageTool(itemStack, player, Ability.POLYMORPH_RANDOM); + } + } + + //player.playNotifySound(SoundEvents.ILLUSIONER_CAST_SPELL, SoundSource.PLAYERS, 0.5F, 0.75F); + //((ServerLevel) level).sendParticles(ParticleTypes.WHITE_SMOKE, mob.getX(), mob.getEyeY(), mob.getZ(), 20, 0.25, 0.2, 0.25, 0); + //Helpers.damageTool(itemStack, player, Ability.POLYMORPH_RANDOM); + } + } + return false; + } + public static boolean groundstomp(Level level, Player player, ItemStack itemStack) { if (level.isClientSide) return false; int currentCooldown = ToggleableTool.getAnyCooldown(itemStack, Ability.GROUNDSTOMP); @@ -662,4 +714,12 @@ public static void clearStupefyTargets(ItemStack itemStack) { itemStack.set(JustDireDataComponents.STUPEFY_TARGETS, new ArrayList<>()); } + private static EntityType getRandomMobTypeByCategory(Level level, boolean peaceful) { + List> mobTypes = BuiltInRegistries.ENTITY_TYPE.stream() + .filter(type -> peaceful ? type.is(JustDireEntityTags.POLYMORPHIC_PEACEFUL) : type.is(JustDireEntityTags.POLYMORPHIC_HOSTILE)) + .toList(); + + return mobTypes.isEmpty() ? null : mobTypes.get(level.random.nextInt(mobTypes.size())); + } + } diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/FluidContainingItem.java b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/FluidContainingItem.java index baf1559f..6738190f 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/FluidContainingItem.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/FluidContainingItem.java @@ -1,8 +1,22 @@ package com.direwolf20.justdirethings.common.items.interfaces; +import com.direwolf20.justdirethings.common.fluids.portalfluid.PortalFluidBlock; +import com.direwolf20.justdirethings.setup.Registration; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.capability.IFluidHandler; import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; @@ -32,7 +46,8 @@ default int getFluidBarWidth(ItemStack stack) { if (fluidHandler == null) { return 13; } - return Math.min(13 * fluidHandler.getFluidInTank(0).getAmount() / fluidHandler.getTankCapacity(0), 13); + return Math.min(Math.round((float) fluidHandler.getFluidInTank(0).getAmount() * 13.0F / (float) fluidHandler.getTankCapacity(0)), 13); + //return Math.min(13 * fluidHandler.getFluidInTank(0).getAmount() / fluidHandler.getTankCapacity(0), 13); } default int getFluidBarColor(ItemStack stack) { @@ -61,4 +76,30 @@ static void consumeFluid(ItemStack itemStack, int amt) { } fluidHandler.drain(amt, IFluidHandler.FluidAction.EXECUTE); } + + static LiquidBlock getLiquidBlockAt(Level level, BlockPos blockPos) { + if (level.getBlockState(blockPos).getBlock() instanceof LiquidBlock liquidBlock) + return liquidBlock; + return null; + } + + static boolean pickupFluid(Level level, Player player, ItemStack itemStack, BlockHitResult blockhitresult) { + BlockPos blockpos = blockhitresult.getBlockPos(); + BlockState blockstate1 = level.getBlockState(blockpos); + LiquidBlock liquidBlock = getLiquidBlockAt(player.level(), blockpos); + if (liquidBlock == null) return false; + IFluidHandlerItem fluidHandler = itemStack.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandler == null) return false; + int filledAmt = fluidHandler.fill(new FluidStack(liquidBlock.fluid, 1000), IFluidHandler.FluidAction.SIMULATE); + if (filledAmt == 1000) { + ItemStack itemstack2 = liquidBlock.pickupBlock(player, level, blockpos, blockstate1); + fluidHandler.fill(new FluidStack(liquidBlock.fluid, 1000), IFluidHandler.FluidAction.EXECUTE); + liquidBlock.getPickupSound(blockstate1).ifPresent(p_150709_ -> player.playSound(p_150709_, 1.0F, 1.0F)); + if (!level.isClientSide) { + CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) player, itemstack2); + } + return true; + } + return false; + } } diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java index c55efd8b..53de0a2b 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java @@ -26,7 +26,8 @@ public JustDireEntityTags(PackOutput packOutput, CompletableFuture> NO_EARTHQUAKE = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "no_earthquake")); public static final TagKey> PARADOX_DENY = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "paradox_deny")); public static final TagKey> PARADOX_ABSORB_DENY = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "paradox_absorb_deny")); - + public static final TagKey> POLYMORPHIC_PEACEFUL = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "polymorphic_peaceful")); + public static final TagKey> POLYMORPHIC_HOSTILE = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "polymorphic_hostile")); @Override public void addTags(HolderLookup.Provider lookupProvider) { @@ -50,5 +51,77 @@ public void addTags(HolderLookup.Provider lookupProvider) { .add(Registration.ParadoxEntity.get()); tag(EntityTypeTags.ARROWS) .add(Registration.JustDireArrow.get()); + tag(POLYMORPHIC_PEACEFUL).add( + EntityType.SHEEP, + EntityType.PIG, + EntityType.COW, + EntityType.MOOSHROOM, + EntityType.CHICKEN, + EntityType.BAT, + EntityType.VILLAGER, + EntityType.SQUID, + EntityType.OCELOT, + EntityType.WOLF, + EntityType.HORSE, + EntityType.RABBIT, + EntityType.DONKEY, + EntityType.MULE, + EntityType.POLAR_BEAR, + EntityType.LLAMA, + EntityType.PARROT, + EntityType.DOLPHIN, + EntityType.COD, + EntityType.SALMON, + EntityType.PUFFERFISH, + EntityType.TROPICAL_FISH, + EntityType.TURTLE, + EntityType.CAT, + EntityType.FOX, + EntityType.PANDA, + EntityType.TRADER_LLAMA, + EntityType.WANDERING_TRADER, + EntityType.STRIDER, + EntityType.GLOW_SQUID, + EntityType.GOAT, + EntityType.BEE, + EntityType.FROG, + EntityType.TADPOLE, + EntityType.CAMEL, + EntityType.AXOLOTL + ); + tag(POLYMORPHIC_HOSTILE).add( + EntityType.ZOMBIE, + EntityType.SKELETON, + EntityType.CREEPER, + EntityType.SPIDER, + EntityType.ENDERMAN, + EntityType.SILVERFISH, + EntityType.ZOMBIFIED_PIGLIN, + EntityType.PIGLIN, + EntityType.PIGLIN_BRUTE, + EntityType.HOGLIN, + EntityType.ZOGLIN, + EntityType.GHAST, + EntityType.BLAZE, + EntityType.SLIME, + EntityType.WITCH, + EntityType.RABBIT, + EntityType.ENDERMITE, + EntityType.STRAY, + EntityType.WITHER_SKELETON, + EntityType.SKELETON_HORSE, + EntityType.ZOMBIE_HORSE, + EntityType.ZOMBIE_VILLAGER, + EntityType.HUSK, + EntityType.GUARDIAN, + EntityType.EVOKER, + EntityType.VEX, + EntityType.VINDICATOR, + EntityType.SHULKER, + EntityType.DROWNED, + EntityType.PHANTOM, + EntityType.PILLAGER + ); + } } diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java index 5448d045..a3e4de20 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java @@ -357,9 +357,11 @@ protected void addTranslations() { add("justdirethings.festored", "Forge Energy: %s / %s"); add("justdirethings.portalfluidamt", "Portal Fluid: %s / %s"); add("justdirethings.timefluidamt", "Time Fluid: %s / %s"); + add("justdirethings.polymorphicfluidamt", "Polymorphic Fluid: %s / %s"); add("justdirethings.paradoxenergy", "Paradox Energy: %s / %s"); add("justdirethings.lowportalfluid", "Insufficient Portal Fluid"); add("justdirethings.lowtimefluid", "Insufficient Time Fluid"); + add("justdirethings.invalidpolymorphentity", "Invalid Entity for Polymorphing"); add("justdirethings.boundto", "Bound to: %s:%s"); add("justdirethings.boundto-missing", "Bound to (MISSING BLOCK): %s:%s"); add("justdirethings.unbound", " -Not Bound"); @@ -445,6 +447,7 @@ protected void addTranslations() { add(Ability.EPICARROW.getLocalization(), "Yondu Arrow"); add(Ability.TIMEPROTECTION.getLocalization(), "Time Protection"); add(Ability.WATERBREATHING.getLocalization(), "Water Breathing"); + add(Ability.POLYMORPH_RANDOM.getLocalization(), "Random Polymorph"); //GUI add("justdirethings.screen.energy", "Energy: %s/%s FE"); diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java index ccca70ca..4bc05dde 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java @@ -456,9 +456,10 @@ protected void buildRecipes(RecipeOutput consumer) { .save(consumer); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Registration.PolymorphicWand.get()) .pattern(" b") - .pattern(" i ") + .pattern(" r ") .pattern("i ") .define('i', Registration.BlazegoldIngot.get()) + .define('r', Registration.PolymorphicCatalyst.get()) .define('b', Registration.FluidCanister.get()) .group("justdirethings") .unlockedBy("has_blazegold_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.BlazegoldIngot.get())) diff --git a/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java b/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java index aa6fdd9e..b24650c1 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java @@ -197,6 +197,7 @@ public static void registerItemDecorators(RegisterItemDecorationsEvent event) { event.register(Registration.TimeWand.get(), new FluidbarDecorator()); event.register(Registration.PortalGunV2.get(), new FluidbarDecorator()); event.register(Registration.FluidCanister.get(), new FluidbarDecorator()); + event.register(Registration.PolymorphicWand.get(), new FluidbarDecorator()); } @SubscribeEvent diff --git a/src/main/java/com/direwolf20/justdirethings/setup/Config.java b/src/main/java/com/direwolf20/justdirethings/setup/Config.java index 4db46512..a9489d18 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/Config.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/Config.java @@ -90,6 +90,10 @@ public class Config { public static ModConfigSpec.IntValue POCKET_GENERATOR_MAX_FE; public static ModConfigSpec.IntValue POCKET_GENERATOR_FE_PER_TICK; + public static final String CATEGORY_POLYMORPHIC_WAND = "polymorphic_wand"; + public static ModConfigSpec.IntValue POLYMORPHIC_WAND_MAX_FLUID; + public static ModConfigSpec.IntValue RANDOM_POLYMORPH_COST; + public static void register(ModContainer container) { //registerServerConfigs(container); registerCommonConfigs(container); @@ -112,6 +116,7 @@ private static void registerCommonConfigs(ModContainer container) { pocketGeneratorConfig(); portalGunConfig(); timeWandConfig(); + polymorphWandConfig(); paradoxConfig(); COMMON_CONFIG = COMMON_BUILDER.build(); container.registerConfig(ModConfig.Type.COMMON, COMMON_CONFIG); @@ -264,6 +269,15 @@ private static void timeWandConfig() { COMMON_BUILDER.pop(); } + private static void polymorphWandConfig() { + COMMON_BUILDER.comment("Polymorphic Wand").push(CATEGORY_POLYMORPHIC_WAND); + RANDOM_POLYMORPH_COST = COMMON_BUILDER.comment("The polymorphic fluid cost to use the polymorph wand") + .defineInRange("polymorphic_wand_fluid_cost", 100, 1, Integer.MAX_VALUE); + POLYMORPHIC_WAND_MAX_FLUID = COMMON_BUILDER.comment("The amount of fluid the Polymorphic Wand can hold") + .defineInRange("polymorphic_wand_max_fluid", 2000, 1, Integer.MAX_VALUE); + COMMON_BUILDER.pop(); + } + public static int logBase2(final int value) { return (int) (Math.log(value) / Math.log(2)); } diff --git a/src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_random.png b/src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_random.png new file mode 100644 index 0000000000000000000000000000000000000000..e6e03cf012780ce7fb21601d16203b5cf9fa0dce GIT binary patch literal 508 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}r0G|-oxVSh|Q`2|v-rcxyW5tRUALq?@zi##C&!7MQ|Ift0cyEQx@luUO zZSz&DRsnSczTQy;r1(pM{DOfBkO0G#J2Msnr8o;bB8wRqxP?KOkzv*x380`viEBhj zaDG}zd16s2LqK9?UWuNcYlwoWo}r#$($*jzpqg!|5uRzDo>~kXKn^Q|6eBAGBar0< z#L`eU$cGw?%wTaQAls0U3GCx2AUm_21uUKgWP^aGBqPHMU_iiVG)ozPQWMx2Sb!=G zjEoH!7eGt}*~q#8V$u{K8w7x%0K_1bL6#Ok7F3s^fdNSNZn0MsyN1XPAT!+4#W6%9 zIQINSz6J#jhd>R-D^LF0n|mvLIVXNz#`(fp_6OYR2Ojb^7TWJ^5x(%NaYpep4wpzJ z5k<|@+|Q!K9kOy~7wQ_X;oPCWY(~}g&+F`tY`)(XlCQsr&9;Q2XA{UePgg&ebxsLQ E0E9z{761SM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_target.png b/src/main/resources/assets/justdirethings/textures/gui/buttons/polymorph_target.png new file mode 100644 index 0000000000000000000000000000000000000000..395fc364afc6c1555d6bc29df915772db3a78b30 GIT binary patch literal 534 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}B0G|-oxVSh|Q`2|v-c=onzj5P+U%%Um6)Qf@oAG|#>d&7)|NsA=iGlIn z3Y+7l8jafK<^|TPR;>bRjhN_K38aKdg8YJkYES{gqy77ZfU=wg9+AZi4BWyX%*Zfn zjs#FpqQo_#Bsf2 zL5h);ff2~^0%B<>8{}IJMrN=$6Oe7l$OQI%6p)?S&H@(C0Ealo5gdCylCMF5$2D+X(CGzE-}gsO6m!l0@vz0A@Y8EH^QNZgd9!wGix0oA zd}{$ib_096Kyp)kqvbNmqDNEg)tzp9=WpnLTz=g0uH!c?FLoUltB62>oUONBEjF** cblFVdQ&MBb@0H6<NS%G}r0G|-oxVSh|Q`2|v-rcxyW5tRUALq?@zi##C&!7MQ|Ift0cyEQx@luUO zZSz&DRsnSczTQy;r1(pM{DOfBkO0G#J2Msnr8o;bB8wRqxP?KOkzv*x380`viEBhj zaDG}zd16s2LqK9?UWuNcYlwoWo}r#$($*jzpqg!|5uRzDo>~kXKn^Q|6eBAGBar0< z#L`eU$cGw?%wTaQAls0U3GCx2AUm_21uUKgWP^aGBqPHMU_iiVG)ozPQWMx2Sb!=G zjEoH!7eGt}*~q#8V$u{K8w7x%0K_1bL6#Ok7F3s^fdNSNZn0MsyN1XPAT!+4#W6%9 zIQINSz6J#jhd>R-D^LF0n|mvLIVXNz#`(fp_6OYR2Ojb^7TWJ^5x(%NaYpep4wpzJ z5k<|@+|Q!K9kOy~7wQ_X;oPCWY(~}g&+F`tY`)(XlCQsr&9;Q2XA{UePgg&ebxsLQ E0E9z{761SM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/justdirethings/textures/item/abilityupgrades/polymorph_target.png b/src/main/resources/assets/justdirethings/textures/item/abilityupgrades/polymorph_target.png new file mode 100644 index 0000000000000000000000000000000000000000..395fc364afc6c1555d6bc29df915772db3a78b30 GIT binary patch literal 534 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}B0G|-oxVSh|Q`2|v-c=onzj5P+U%%Um6)Qf@oAG|#>d&7)|NsA=iGlIn z3Y+7l8jafK<^|TPR;>bRjhN_K38aKdg8YJkYES{gqy77ZfU=wg9+AZi4BWyX%*Zfn zjs#FpqQo_#Bsf2 zL5h);ff2~^0%B<>8{}IJMrN=$6Oe7l$OQI%6p)?S&H@(C0Ealo5gdCylCMF5$2D+X(CGzE-}gsO6m!l0@vz0A@Y8EH^QNZgd9!wGix0oA zd}{$ib_096Kyp)kqvbNmqDNEg)tzp9=WpnLTz=g0uH!c?FLoUltB62>oUONBEjF** cblFVdQ&MBb@0H6< Date: Sat, 7 Dec 2024 22:31:06 -0500 Subject: [PATCH 4/6] Make left clicking work on polymorph wand --- .../common/items/PolymorphicWand.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java index f75c541e..bb40da14 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWand.java @@ -8,6 +8,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -21,6 +22,7 @@ import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import java.util.List; +import java.util.Set; public class PolymorphicWand extends BaseToggleableTool implements LeftClickableTool, FluidContainingItem { public PolymorphicWand() { @@ -49,6 +51,18 @@ public InteractionResult useOn(UseOnContext pContext) { return super.useOn(pContext); } + @Override + public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { + Level level = player.level(); + if (level.isClientSide) return true; + ItemStack itemStack = player.getMainHandItem(); + Set abilities = LeftClickableTool.getLeftClickList(itemStack); + if (itemStack.getItem() instanceof ToggleableTool toggleableTool && !abilities.isEmpty()) { + toggleableTool.useAbility(player.level(), player, InteractionHand.MAIN_HAND, false); + } + return true; + } + @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); From 7687ab9d833c2d48384e746892b4eb6692d81b17 Mon Sep 17 00:00:00 2001 From: direwolf20 <39863894+Direwolf20-MC@users.noreply.github.com> Date: Sun, 8 Dec 2024 15:51:41 -0500 Subject: [PATCH 5/6] Advanced Polymorphic Wand --- .../69ee5e809dff011efe049b68501078221ca37cb0 | 3 +- .../7e4928c403af173c11f4d1675461c34bf5d23056 | 3 +- .../8202586f691eec5ad0bb88d13a278951d0c130fb | 4 +- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 4 +- .../assets/justdirethings/lang/en_us.json | 3 + .../models/item/polymorphic_wand_v2.json | 6 + .../recipes/misc/polymorphic_wand_v2.json | 32 +++++ .../recipe/polymorphic_wand_v2.json | 25 ++++ .../entity_type/polymorphic_target_deny.json | 7 + .../justdirethings/JustDireThings.java | 25 +++- .../common/events/PlayerEvents.java | 10 ++ .../common/items/PolymorphicWandV2.java | 132 ++++++++++++++++++ .../common/items/interfaces/Ability.java | 3 + .../items/interfaces/AbilityMethods.java | 50 ++++++- .../datagen/JustDireEntityTags.java | 5 + .../datagen/JustDireItemModels.java | 1 + .../datagen/JustDireLanguageProvider.java | 3 + .../datagen/JustDireRecipes.java | 10 ++ .../justdirethings/setup/ClientSetup.java | 1 + .../justdirethings/setup/Config.java | 12 ++ .../justdirethings/setup/Registration.java | 1 + .../textures/item/polymorphic_wand_v2.png | Bin 0 -> 534 bytes 22 files changed, 325 insertions(+), 15 deletions(-) create mode 100644 src/generated/resources/assets/justdirethings/models/item/polymorphic_wand_v2.json create mode 100644 src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand_v2.json create mode 100644 src/generated/resources/data/justdirethings/recipe/polymorphic_wand_v2.json create mode 100644 src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_target_deny.json create mode 100644 src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWandV2.java create mode 100644 src/main/resources/assets/justdirethings/textures/item/polymorphic_wand_v2.png diff --git a/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 b/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 index 16c6b10d..2ea64b3e 100644 --- a/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 +++ b/src/generated/resources/.cache/69ee5e809dff011efe049b68501078221ca37cb0 @@ -1,4 +1,4 @@ -// 1.21.1 2024-12-07T12:22:16.5077405 Item Models: justdirethings +// 1.21.1 2024-12-08T14:36:24.9489547 Item Models: justdirethings c197a1b2a5ae31fcfabfe6cab9ab95a9dc0e1af6 assets/justdirethings/models/item/blazegold_axe.json dddf215922d40d92c2d8bce4229f2e2af8b3c7ba assets/justdirethings/models/item/blazegold_axe_active.json 6396fb6e503760080534bc26337236d4d09a4cb8 assets/justdirethings/models/item/blazegold_block.json @@ -293,6 +293,7 @@ b10bbca68270e48599af7174531b0235c8e7c9a4 assets/justdirethings/models/item/playe 6ac490fc1ca0a7b3663a770a09e3cd3ade652bb5 assets/justdirethings/models/item/polymorphic_catalyst.json c51b41b9c484aa6724dfe24732b06a196ee05ffe assets/justdirethings/models/item/polymorphic_fluid_bucket.json af285bda921f3fea66dd01b7b30fadfd8669ee14 assets/justdirethings/models/item/polymorphic_wand.json +481f0aeeff37a0ab6393bd83161537fd688e0a2e assets/justdirethings/models/item/polymorphic_wand_v2.json 403d14795debb89f422eefb10f3b8188e148190a assets/justdirethings/models/item/portal_fluid_bucket.json ea9b4416ff95371822cbc5808fd425323b170cc9 assets/justdirethings/models/item/portal_fluid_catalyst.json d8ea68a75b8b49f7765e715d62ad23c2f1939281 assets/justdirethings/models/item/raw_blazegold.json diff --git a/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 b/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 index e7945e0e..9099077c 100644 --- a/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 +++ b/src/generated/resources/.cache/7e4928c403af173c11f4d1675461c34bf5d23056 @@ -1,4 +1,4 @@ -// 1.21.1 2024-12-07T15:14:23.6887728 Tags for minecraft:entity_type mod id justdirethings +// 1.21.1 2024-12-08T14:36:24.946453 Tags for minecraft:entity_type mod id justdirethings b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/c/tags/entity_type/teleporting_not_supported.json e00f2931577049b9a4400a87ed9c249373be376c data/justdirethings/tags/entity_type/creature_catcher_deny.json 669025814936e708d42d9d0a5b88c11e62cf12ef data/justdirethings/tags/entity_type/no_ai_deny.json @@ -7,4 +7,5 @@ b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/justdirethings/tags/entity_type/pa b7ee8eaecff151e619b9a22ecae620a5b3ce15a0 data/justdirethings/tags/entity_type/paradox_deny.json 263995270039da950f2e27b535f1b7c71a5f5423 data/justdirethings/tags/entity_type/polymorphic_hostile.json d53ddb5be22b17ec02beda6e2e3695f074abc70f data/justdirethings/tags/entity_type/polymorphic_peaceful.json +669025814936e708d42d9d0a5b88c11e62cf12ef data/justdirethings/tags/entity_type/polymorphic_target_deny.json 6a890ea62d03cc1110fa8d1fe5a0669082d9d96b data/minecraft/tags/entity_type/arrows.json diff --git a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb index b8a522b2..c557f786 100644 --- a/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb +++ b/src/generated/resources/.cache/8202586f691eec5ad0bb88d13a278951d0c130fb @@ -1,2 +1,2 @@ -// 1.21.1 2024-12-07T15:35:26.0358297 Languages: en_us for mod: justdirethings -dc7bbea3a13870709a7bafccf7758ac21f7bffec assets/justdirethings/lang/en_us.json +// 1.21.1 2024-12-08T15:06:57.5943778 Languages: en_us for mod: justdirethings +95e97e5674d08f0f4e96cc7bef842e9923332325 assets/justdirethings/lang/en_us.json diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index 534a7276..74c712af 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.21.1 2024-12-07T15:39:40.3847313 Recipes +// 1.21.1 2024-12-08T14:36:24.9704735 Recipes 39cd44c838de7f56aeac73aec8b3bfb64ad7fec2 data/justdirethings/advancement/recipes/building_blocks/blazegold_ingot_9x9.json 2f2a0f948f272df9713010dbcb75beb81c328b01 data/justdirethings/advancement/recipes/building_blocks/celestigem_9x9.json 4c183b67eff4bc24117606cdc45ebcd987dd4138 data/justdirethings/advancement/recipes/building_blocks/charcoal_9x9.json @@ -308,6 +308,7 @@ dad2a7782e9a1e1d8e7099a6596640b309925ed9 data/justdirethings/advancement/recipes 858af81155eff55f8b4cff67f9bade9f64071902 data/justdirethings/advancement/recipes/misc/polymorphic_catalyst.json d028ad197c2078a4c30eafcbde2282aff17f1df1 data/justdirethings/advancement/recipes/misc/polymorphic_fluid_block-fluiddrop.json 8d77029166db109c5f6f34ecd68888bbb458b36f data/justdirethings/advancement/recipes/misc/polymorphic_wand.json +cbd75ef6a410d18537c75609ed9a8dc03e4eedf6 data/justdirethings/advancement/recipes/misc/polymorphic_wand_v2.json 5570c3f5f6bf47c6d6026ead547ac4516bad5da9 data/justdirethings/advancement/recipes/misc/portalgun.json f921713cd6dfa2ad74a0b7144f7778c2fe33bc72 data/justdirethings/advancement/recipes/misc/portalgun_v2.json c811419aba5aeaf1be214e7f29492a7ccb300ddd data/justdirethings/advancement/recipes/misc/portal_fluid_block-goospread.json @@ -698,6 +699,7 @@ cc73b7c24448814a0e8663c8065a6625cbd30072 data/justdirethings/recipe/pocket_gener 035ed5c68eac114352b166d38b7f8308e5db63c0 data/justdirethings/recipe/polymorphic_catalyst.json 6cfafeb9ae58abc121bd78f1c67b11aedec8297b data/justdirethings/recipe/polymorphic_fluid_block-fluiddrop.json 52f1c1f4d04ba53cc38b2dbfc49fb1d19a35b344 data/justdirethings/recipe/polymorphic_wand.json +f0837b24753abb981c18893958974a4306f8b4d8 data/justdirethings/recipe/polymorphic_wand_v2.json 1494fe69edb92207b18a251b9c4a4d7ef2487b45 data/justdirethings/recipe/portalgun.json 4ed1bcc18461694ef969bb8820a6a4433cec054f data/justdirethings/recipe/portalgun_v2.json 881053ecbb4f27590666128cfd52f2c212cf6a37 data/justdirethings/recipe/portal_fluid_block-goospread.json diff --git a/src/generated/resources/assets/justdirethings/lang/en_us.json b/src/generated/resources/assets/justdirethings/lang/en_us.json index dcefc0ca..f13db59e 100644 --- a/src/generated/resources/assets/justdirethings/lang/en_us.json +++ b/src/generated/resources/assets/justdirethings/lang/en_us.json @@ -145,6 +145,7 @@ "item.justdirethings.polymorphic_catalyst": "Polymorphic Catalyst", "item.justdirethings.polymorphic_fluid_bucket": "Polymorphic Fluid Bucket", "item.justdirethings.polymorphic_wand": "Polymorphic Wand", + "item.justdirethings.polymorphic_wand_v2": "Advanced Polymorphic Wand", "item.justdirethings.portal_fluid_bucket": "Portal Fluid Bucket", "item.justdirethings.portal_fluid_catalyst": "Portal Fluid Catalyst", "item.justdirethings.portalgun": "Portal Gun", @@ -254,6 +255,7 @@ "justdirethings.ability.orexray": "X-Ray", "justdirethings.ability.phase": "Phase", "justdirethings.ability.polymorph_random": "Random Polymorph", + "justdirethings.ability.polymorph_target": "Targeted Polymorph", "justdirethings.ability.potionarrow": "Potion Arrow", "justdirethings.ability.runspeed": "Run Speed", "justdirethings.ability.skysweeper": "Sky Sweeper", @@ -353,6 +355,7 @@ "justdirethings.pocketgeneratorfuelstack": "Fuel: %f %s", "justdirethings.pocketgeneratornofuel": "Fuel Empty", "justdirethings.polymorphicfluidamt": "Polymorphic Fluid: %s / %s", + "justdirethings.polymorphset": "Polymorph Target: %s", "justdirethings.portalfluidamt": "Portal Fluid: %s / %s", "justdirethings.potionarrow.detailtext": "Insert a Potion Canister to apply effects to enemies", "justdirethings.potionarrow.flavortext": "Like Vanilla, without inventory issues...", diff --git a/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand_v2.json b/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand_v2.json new file mode 100644 index 00000000..534cd032 --- /dev/null +++ b/src/generated/resources/assets/justdirethings/models/item/polymorphic_wand_v2.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "justdirethings:item/polymorphic_wand_v2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand_v2.json b/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand_v2.json new file mode 100644 index 00000000..1a74824d --- /dev/null +++ b/src/generated/resources/data/justdirethings/advancement/recipes/misc/polymorphic_wand_v2.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_eclipsealloy_ingot": { + "conditions": { + "items": [ + { + "items": "justdirethings:eclipsealloy_ingot" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "justdirethings:polymorphic_wand_v2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_eclipsealloy_ingot" + ] + ], + "rewards": { + "recipes": [ + "justdirethings:polymorphic_wand_v2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/recipe/polymorphic_wand_v2.json b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand_v2.json new file mode 100644 index 00000000..68f0bdf4 --- /dev/null +++ b/src/generated/resources/data/justdirethings/recipe/polymorphic_wand_v2.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "justdirethings", + "key": { + "b": { + "item": "justdirethings:eclipsealloy_ingot" + }, + "i": { + "item": "justdirethings:celestigem" + }, + "r": { + "item": "justdirethings:polymorphic_wand" + } + }, + "pattern": [ + " b", + " r ", + "i " + ], + "result": { + "count": 1, + "id": "justdirethings:polymorphic_wand_v2" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_target_deny.json b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_target_deny.json new file mode 100644 index 00000000..d48013b9 --- /dev/null +++ b/src/generated/resources/data/justdirethings/tags/entity_type/polymorphic_target_deny.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:ender_dragon", + "minecraft:wither", + "minecraft:warden" + ] +} \ No newline at end of file diff --git a/src/main/java/com/direwolf20/justdirethings/JustDireThings.java b/src/main/java/com/direwolf20/justdirethings/JustDireThings.java index 87161baa..3cb80c0b 100644 --- a/src/main/java/com/direwolf20/justdirethings/JustDireThings.java +++ b/src/main/java/com/direwolf20/justdirethings/JustDireThings.java @@ -9,10 +9,7 @@ import com.direwolf20.justdirethings.common.capabilities.ExperienceHolderFluidTank; import com.direwolf20.justdirethings.common.containers.handlers.PotionCanisterHandler; import com.direwolf20.justdirethings.common.entities.DecoyEntity; -import com.direwolf20.justdirethings.common.items.FluidCanister; -import com.direwolf20.justdirethings.common.items.PolymorphicWand; -import com.direwolf20.justdirethings.common.items.PortalGunV2; -import com.direwolf20.justdirethings.common.items.TimeWand; +import com.direwolf20.justdirethings.common.items.*; import com.direwolf20.justdirethings.common.items.datacomponents.JustDireDataComponents; import com.direwolf20.justdirethings.common.items.interfaces.PoweredItem; import com.direwolf20.justdirethings.common.network.PacketHandler; @@ -137,7 +134,8 @@ private void registerCapabilities(RegisterCapabilitiesEvent event) { Registration.EclipseAlloyHelmet.get(), Registration.CelestigemBow.get(), Registration.EclipseAlloyBow.get(), - Registration.TimeWand.get() + Registration.TimeWand.get(), + Registration.PolymorphicWandV2.get() ); event.registerItem(Capabilities.FluidHandler.ITEM, (itemStack, context) -> { @@ -183,6 +181,20 @@ public boolean canFillFluidType(FluidStack fluid) { }; } + if (itemStack.getItem() instanceof PolymorphicWandV2 polymorphicWandv2) { + return new FluidHandlerItemStack(JustDireDataComponents.FLUID_CONTAINER, itemStack, polymorphicWandv2.getMaxMB()) { + @Override + public boolean isFluidValid(int tank, FluidStack stack) { + return stack.is(Registration.POLYMORPHIC_FLUID_TYPE.get()); + } + + @Override + public boolean canFillFluidType(FluidStack fluid) { + return fluid.is(Registration.POLYMORPHIC_FLUID_TYPE.get()); + } + + }; + } if (itemStack.getItem() instanceof FluidCanister fluidCanister) { return new FluidHandlerItemStack(JustDireDataComponents.FLUID_CONTAINER, itemStack, fluidCanister.getMaxMB()); } @@ -191,7 +203,8 @@ public boolean canFillFluidType(FluidStack fluid) { Registration.PortalGunV2.get(), Registration.FluidCanister.get(), Registration.TimeWand.get(), - Registration.PolymorphicWand.get() + Registration.PolymorphicWand.get(), + Registration.PolymorphicWandV2.get() ); //Blocks diff --git a/src/main/java/com/direwolf20/justdirethings/common/events/PlayerEvents.java b/src/main/java/com/direwolf20/justdirethings/common/events/PlayerEvents.java index 6dd31c75..a77196e4 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/events/PlayerEvents.java +++ b/src/main/java/com/direwolf20/justdirethings/common/events/PlayerEvents.java @@ -1,6 +1,8 @@ package com.direwolf20.justdirethings.common.events; import com.direwolf20.justdirethings.JustDireThings; +import com.direwolf20.justdirethings.common.items.PolymorphicWand; +import com.direwolf20.justdirethings.common.items.PolymorphicWandV2; import com.direwolf20.justdirethings.common.items.interfaces.Ability; import com.direwolf20.justdirethings.common.items.interfaces.PoweredItem; import com.direwolf20.justdirethings.common.items.interfaces.PoweredTool; @@ -21,6 +23,7 @@ import net.neoforged.neoforge.event.ItemAttributeModifierEvent; import net.neoforged.neoforge.event.entity.player.PlayerDestroyItemEvent; import net.neoforged.neoforge.event.entity.player.PlayerEvent; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; import java.util.EnumSet; import java.util.Set; @@ -110,4 +113,11 @@ public static void BreakSpeed(PlayerEvent.BreakSpeed event) { if (targetSpeed != event.getNewSpeed()) event.setNewSpeed(targetSpeed); } + + @SubscribeEvent + public static void CancelEntityInteraction(PlayerInteractEvent.EntityInteract event) { + ItemStack itemStack = event.getItemStack(); + if (itemStack.getItem() instanceof PolymorphicWand || itemStack.getItem() instanceof PolymorphicWandV2) + event.setCanceled(true); + } } \ No newline at end of file diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWandV2.java b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWandV2.java new file mode 100644 index 00000000..a1979ec9 --- /dev/null +++ b/src/main/java/com/direwolf20/justdirethings/common/items/PolymorphicWandV2.java @@ -0,0 +1,132 @@ +package com.direwolf20.justdirethings.common.items; + +import com.direwolf20.justdirethings.common.items.interfaces.*; +import com.direwolf20.justdirethings.datagen.JustDireEntityTags; +import com.direwolf20.justdirethings.setup.Config; +import com.direwolf20.justdirethings.util.MagicHelpers; +import com.direwolf20.justdirethings.util.MiscTools; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; + +import java.util.List; +import java.util.Set; + +import static com.direwolf20.justdirethings.common.items.datacomponents.JustDireDataComponents.ENTITIYTYPE; + +public class PolymorphicWandV2 extends BaseToggleableTool implements LeftClickableTool, FluidContainingItem, PoweredItem { + public PolymorphicWandV2() { + super(new Properties() + .fireResistant()); + registerAbility(Ability.POLYMORPH_RANDOM); + registerAbility(Ability.POLYMORPH_TARGET); + } + + @Override + public int getMaxMB() { + return Config.POLYMORPHIC_WAND_V2_MAX_FLUID.get(); + } + + @Override + public InteractionResult useOn(UseOnContext pContext) { + ItemStack itemStack = pContext.getItemInHand(); + Player player = pContext.getPlayer(); + if (player == null || itemStack.isEmpty()) return InteractionResult.FAIL; + BlockHitResult blockhitresult = getPlayerPOVHitResult(player.level(), player, ClipContext.Fluid.SOURCE_ONLY); + if (blockhitresult.getType() == HitResult.Type.BLOCK) { + if (FluidContainingItem.pickupFluid(player.level(), player, itemStack, blockhitresult)) + return InteractionResult.SUCCESS; + } + return super.useOn(pContext); + } + + @Override + public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { + Level level = player.level(); + if (level.isClientSide) return true; + ItemStack itemStack = player.getMainHandItem(); + Set abilities = LeftClickableTool.getLeftClickList(itemStack); + if (itemStack.getItem() instanceof ToggleableTool toggleableTool && !abilities.isEmpty()) { + toggleableTool.useAbility(player.level(), player, InteractionHand.MAIN_HAND, false); + } + return true; + } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); + BlockHitResult blockhitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY); + if (blockhitresult.getType() == HitResult.Type.BLOCK) { + if (FluidContainingItem.pickupFluid(level, player, itemStack, blockhitresult)) + return InteractionResultHolder.fail(itemStack); + } + Entity entity = MiscTools.getEntityLookedAt(player, 4); + if (!level.isClientSide && player.isShiftKeyDown() && entity instanceof LivingEntity livingEntity) { //Custom Handling due to shift-clicking mobs to set target + savePolymorphTarget(itemStack, player, livingEntity); + return InteractionResultHolder.pass(player.getItemInHand(hand)); + } + return super.use(level, player, hand); + } + + public static void savePolymorphTarget(ItemStack stack, Player player, LivingEntity interactionTarget) { + if (interactionTarget instanceof Mob && !interactionTarget.getType().is(JustDireEntityTags.POLYMORPHIC_TARGET_DENY)) { + stack.set(ENTITIYTYPE, EntityType.getKey(interactionTarget.getType()).toString()); + player.displayClientMessage(Component.translatable("justdirethings.polymorphset", interactionTarget.getType().getDescription()), true); + } else { + player.displayClientMessage(Component.translatable("justdirethings.invalidpolymorphentity"), true); + } + } + + @Override + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { + super.appendHoverText(stack, context, tooltip, flagIn); + Level level = context.level(); + if (level == null) { + return; + } + IFluidHandlerItem fluidHandler = stack.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandler == null) { + return; + } + tooltip.add(Component.translatable("justdirethings.polymorphicfluidamt", MagicHelpers.formatted(fluidHandler.getFluidInTank(0).getAmount()), MagicHelpers.formatted(fluidHandler.getTankCapacity(0))).withStyle(ChatFormatting.GREEN)); + + if (!stack.has(ENTITIYTYPE)) return; + EntityType newType = EntityType.byString(stack.get(ENTITIYTYPE)).orElse(null); + if (newType == null) return; + tooltip.add(Component.translatable("justdirethings.polymorphset", newType.getDescription()) + .withStyle(ChatFormatting.AQUA)); + } + + @Override + public int getMaxEnergy() { + return Config.POLYMORPHIC_WAND_V2_FE_CAPACITY.get(); + } + + @Override + public UseAnim getUseAnimation(ItemStack stack) { + return UseAnim.NONE; + } + + @Override + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { + return false; + } + +} diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java index 35dbc3c1..2104a1dd 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/Ability.java @@ -105,6 +105,9 @@ public enum Ability { LAVAIMMUNITY(SettingType.SLIDER, 1, 1000, UseType.PASSIVE, BindingType.CUSTOM_ONLY, Registration.UPGRADE_LAVAIMMUNITY), PHASE(SettingType.SLIDER, 1, 50000, UseType.PASSIVE, BindingType.CUSTOM_ONLY, Registration.UPGRADE_PHASE), TIMEPROTECTION(SettingType.SLIDER, 1, 5000, UseType.PASSIVE, BindingType.CUSTOM_ONLY, Registration.UPGRADE_TIMEPROTECTION), + POLYMORPH_TARGET(SettingType.TOGGLE, 10, 50000, UseType.USE, BindingType.LEFT_AND_CUSTOM, + AbilityMethods::polymorphTarget, CustomSettingType.NONE, + ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "textures/gui/overlay/polymorph_target.png")), EPICARROW(SettingType.SLIDER, 25, 100000, UseType.USE_COOLDOWN, BindingType.CUSTOM_ONLY, AbilityMethods::epicArrow, CustomSettingType.NONE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "textures/gui/overlay/epicarrow.png"), Registration.UPGRADE_EPICARROW); diff --git a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java index bff61469..ace517d5 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java +++ b/src/main/java/com/direwolf20/justdirethings/common/items/interfaces/AbilityMethods.java @@ -54,6 +54,7 @@ import java.util.*; import java.util.stream.Collectors; +import static com.direwolf20.justdirethings.common.items.datacomponents.JustDireDataComponents.ENTITIYTYPE; import static com.direwolf20.justdirethings.common.items.interfaces.Helpers.*; import static com.direwolf20.justdirethings.common.items.interfaces.ToggleableTool.*; @@ -491,7 +492,7 @@ public static boolean polymorphRandom(Level level, Player player, ItemStack item // Spawn new mob at the same location Mob newMob = (Mob) newType.create(level); if (newMob != null) { - EventHooks.finalizeMobSpawn(mob, (ServerLevel) level, level.getCurrentDifficultyAt(player.blockPosition()), MobSpawnType.SPAWNER, null); + EventHooks.finalizeMobSpawn(newMob, (ServerLevel) level, level.getCurrentDifficultyAt(player.blockPosition()), MobSpawnType.SPAWNER, null); newMob.moveTo(mob.getX(), mob.getY(), mob.getZ(), mob.getYRot(), mob.getXRot()); newMob.setHealth(newMob.getMaxHealth()); // Reset health to maximum @@ -514,10 +515,51 @@ public static boolean polymorphRandom(Level level, Player player, ItemStack item Helpers.damageTool(itemStack, player, Ability.POLYMORPH_RANDOM); } } + } + } + return false; + } - //player.playNotifySound(SoundEvents.ILLUSIONER_CAST_SPELL, SoundSource.PLAYERS, 0.5F, 0.75F); - //((ServerLevel) level).sendParticles(ParticleTypes.WHITE_SMOKE, mob.getX(), mob.getEyeY(), mob.getZ(), 20, 0.25, 0.2, 0.25, 0); - //Helpers.damageTool(itemStack, player, Ability.POLYMORPH_RANDOM); + public static boolean polymorphTarget(Level level, Player player, ItemStack itemStack) { + if (level.isClientSide) return false; + if (itemStack.getItem() instanceof ToggleableTool toggleableTool && toggleableTool.canUseAbilityAndDurability(itemStack, Ability.POLYMORPH_TARGET)) { + Entity entity = MiscTools.getEntityLookedAt(player, 4); + if (entity == null) return false; + + int fuelAmt = Config.TARGET_POLYMORPH_COST.get(); + if (!FluidContainingItem.hasEnoughFluid(itemStack, fuelAmt)) + return false; + + if (entity instanceof Mob mob) { + if (!itemStack.has(ENTITIYTYPE)) return false; + EntityType newType = EntityType.byString(itemStack.get(ENTITIYTYPE)).orElse(null); + if (newType == null) return false; + + // Spawn new mob at the same location + Mob newMob = (Mob) newType.create(level); + if (newMob != null) { + EventHooks.finalizeMobSpawn(newMob, (ServerLevel) level, level.getCurrentDifficultyAt(player.blockPosition()), MobSpawnType.SPAWNER, null); + + newMob.moveTo(mob.getX(), mob.getY(), mob.getZ(), mob.getYRot(), mob.getXRot()); + newMob.setHealth(newMob.getMaxHealth()); // Reset health to maximum + ((ServerLevel) level).addFreshEntity(newMob); + + if (!newMob.isAddedToLevel()) + return false; //If it failed to add for some reason? + + // Play effects + player.playNotifySound(SoundEvents.ILLUSIONER_CAST_SPELL, SoundSource.PLAYERS, 0.5F, 0.75F); + ((ServerLevel) level).sendParticles(ParticleTypes.WHITE_SMOKE, + mob.getX(), mob.getEyeY(), mob.getZ(), + 20, 0.25, 0.2, 0.25, 0); + + // Remove the old mob + mob.discard(); + + // Damage the tool + FluidContainingItem.consumeFluid(itemStack, fuelAmt); + Helpers.damageTool(itemStack, player, Ability.POLYMORPH_RANDOM); + } } } return false; diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java index 53de0a2b..4be2cee8 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireEntityTags.java @@ -28,6 +28,7 @@ public JustDireEntityTags(PackOutput packOutput, CompletableFuture> PARADOX_ABSORB_DENY = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "paradox_absorb_deny")); public static final TagKey> POLYMORPHIC_PEACEFUL = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "polymorphic_peaceful")); public static final TagKey> POLYMORPHIC_HOSTILE = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "polymorphic_hostile")); + public static final TagKey> POLYMORPHIC_TARGET_DENY = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(JustDireThings.MODID, "polymorphic_target_deny")); @Override public void addTags(HolderLookup.Provider lookupProvider) { @@ -122,6 +123,10 @@ public void addTags(HolderLookup.Provider lookupProvider) { EntityType.PHANTOM, EntityType.PILLAGER ); + tag(POLYMORPHIC_TARGET_DENY) + .add(EntityType.ENDER_DRAGON) + .add(EntityType.WITHER) + .add(EntityType.WARDEN); } } diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java index 0139c61d..f5e05f0d 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireItemModels.java @@ -119,6 +119,7 @@ protected void registerModels() { singleTexture(Registration.TEMPLATE_ECLIPSEALLOY.getId().getPath(), mcLoc("item/generated"), "layer0", modLoc("item/template_eclipsealloy")); singleTexture(Registration.TimeWand.getId().getPath(), mcLoc("item/generated"), "layer0", modLoc("item/time_wand")); singleTexture(Registration.PolymorphicWand.getId().getPath(), mcLoc("item/handheld"), "layer0", modLoc("item/polymorphic_wand")); + singleTexture(Registration.PolymorphicWandV2.getId().getPath(), mcLoc("item/handheld"), "layer0", modLoc("item/polymorphic_wand_v2")); registerBowModels(); diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java index a3e4de20..538c1a2c 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireLanguageProvider.java @@ -133,6 +133,7 @@ protected void addTranslations() { add(Registration.PotionCanister.get(), "Potion Canister"); add(Registration.TimeWand.get(), "Time Wand"); add(Registration.PolymorphicWand.get(), "Polymorphic Wand"); + add(Registration.PolymorphicWandV2.get(), "Advanced Polymorphic Wand"); //Tools add(Registration.FerricoreSword.get(), "Ferricore Sword"); @@ -362,6 +363,7 @@ protected void addTranslations() { add("justdirethings.lowportalfluid", "Insufficient Portal Fluid"); add("justdirethings.lowtimefluid", "Insufficient Time Fluid"); add("justdirethings.invalidpolymorphentity", "Invalid Entity for Polymorphing"); + add("justdirethings.polymorphset", "Polymorph Target: %s"); add("justdirethings.boundto", "Bound to: %s:%s"); add("justdirethings.boundto-missing", "Bound to (MISSING BLOCK): %s:%s"); add("justdirethings.unbound", " -Not Bound"); @@ -448,6 +450,7 @@ protected void addTranslations() { add(Ability.TIMEPROTECTION.getLocalization(), "Time Protection"); add(Ability.WATERBREATHING.getLocalization(), "Water Breathing"); add(Ability.POLYMORPH_RANDOM.getLocalization(), "Random Polymorph"); + add(Ability.POLYMORPH_TARGET.getLocalization(), "Targeted Polymorph"); //GUI add("justdirethings.screen.energy", "Energy: %s/%s FE"); diff --git a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java index 4bc05dde..00c87f7a 100644 --- a/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java +++ b/src/main/java/com/direwolf20/justdirethings/datagen/JustDireRecipes.java @@ -464,6 +464,16 @@ protected void buildRecipes(RecipeOutput consumer) { .group("justdirethings") .unlockedBy("has_blazegold_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.BlazegoldIngot.get())) .save(consumer); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Registration.PolymorphicWandV2.get()) + .pattern(" b") + .pattern(" r ") + .pattern("i ") + .define('i', Registration.Celestigem.get()) + .define('r', Registration.PolymorphicWand.get()) + .define('b', Registration.EclipseAlloyIngot.get()) + .group("justdirethings") + .unlockedBy("has_eclipsealloy_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(Registration.EclipseAlloyIngot.get())) + .save(consumer); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Registration.TimeWand.get()) .pattern(" bt") .pattern(" ib") diff --git a/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java b/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java index b24650c1..868c8c2d 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/ClientSetup.java @@ -198,6 +198,7 @@ public static void registerItemDecorators(RegisterItemDecorationsEvent event) { event.register(Registration.PortalGunV2.get(), new FluidbarDecorator()); event.register(Registration.FluidCanister.get(), new FluidbarDecorator()); event.register(Registration.PolymorphicWand.get(), new FluidbarDecorator()); + event.register(Registration.PolymorphicWandV2.get(), new FluidbarDecorator()); } @SubscribeEvent diff --git a/src/main/java/com/direwolf20/justdirethings/setup/Config.java b/src/main/java/com/direwolf20/justdirethings/setup/Config.java index a9489d18..5af916da 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/Config.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/Config.java @@ -93,6 +93,10 @@ public class Config { public static final String CATEGORY_POLYMORPHIC_WAND = "polymorphic_wand"; public static ModConfigSpec.IntValue POLYMORPHIC_WAND_MAX_FLUID; public static ModConfigSpec.IntValue RANDOM_POLYMORPH_COST; + public static ModConfigSpec.IntValue POLYMORPHIC_WAND_V2_MAX_FLUID; + public static ModConfigSpec.IntValue TARGET_POLYMORPH_COST; + public static ModConfigSpec.IntValue POLYMORPHIC_WAND_V2_FE_CAPACITY; + public static ModConfigSpec.IntValue POLYMORPHIC_WAND_V2_FE_COST; public static void register(ModContainer container) { //registerServerConfigs(container); @@ -275,6 +279,14 @@ private static void polymorphWandConfig() { .defineInRange("polymorphic_wand_fluid_cost", 100, 1, Integer.MAX_VALUE); POLYMORPHIC_WAND_MAX_FLUID = COMMON_BUILDER.comment("The amount of fluid the Polymorphic Wand can hold") .defineInRange("polymorphic_wand_max_fluid", 2000, 1, Integer.MAX_VALUE); + POLYMORPHIC_WAND_V2_FE_COST = COMMON_BUILDER.comment("The FE cost to use the Advanced Polymorphic Wand") + .defineInRange("polymorphic_wand_v2_fe_cost", 50000, 1, Integer.MAX_VALUE); + POLYMORPHIC_WAND_V2_FE_CAPACITY = COMMON_BUILDER.comment("The amount of FE the Advanced Polymorphic Wand can hold") + .defineInRange("polymorphic_wand_v2_fe_capacity", 1000000, 1, Integer.MAX_VALUE); + TARGET_POLYMORPH_COST = COMMON_BUILDER.comment("The polymorphic fluid cost to use the Advanced Polymorphic Wand") + .defineInRange("polymorphic_wand_v2_fluid_cost", 250, 1, Integer.MAX_VALUE); + POLYMORPHIC_WAND_V2_MAX_FLUID = COMMON_BUILDER.comment("The amount of fluid the Advanced Polymorphic Wand can hold") + .defineInRange("polymorphic_wand_v2_max_fluid", 8000, 1, Integer.MAX_VALUE); COMMON_BUILDER.pop(); } diff --git a/src/main/java/com/direwolf20/justdirethings/setup/Registration.java b/src/main/java/com/direwolf20/justdirethings/setup/Registration.java index 6cf824b0..f1c24579 100644 --- a/src/main/java/com/direwolf20/justdirethings/setup/Registration.java +++ b/src/main/java/com/direwolf20/justdirethings/setup/Registration.java @@ -519,6 +519,7 @@ public static void init(IEventBus eventBus) { public static final DeferredHolder CelestigemBow = BOWS.register("bow_celestigem", CelestigemBow::new); public static final DeferredHolder EclipseAlloyBow = BOWS.register("bow_eclipsealloy", EclipseAlloyBow::new); public static final DeferredHolder PolymorphicWand = ITEMS.register("polymorphic_wand", PolymorphicWand::new); + public static final DeferredHolder PolymorphicWandV2 = ITEMS.register("polymorphic_wand_v2", PolymorphicWandV2::new); //Items - Tools public static final DeferredHolder FerricoreSword = TOOLS.register("ferricore_sword", FerricoreSword::new); diff --git a/src/main/resources/assets/justdirethings/textures/item/polymorphic_wand_v2.png b/src/main/resources/assets/justdirethings/textures/item/polymorphic_wand_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..45491f51c04d857828637f9492856e68a7677f04 GIT binary patch literal 534 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}Z0G|+7RZTPHu8wo(&i()Yf9=|}A&)Lf$*N1{n8koy!pjFv!LkKom;Y|&jjk8o$!7MkP~kb zQ&<_K7+Dz@fh;c|mWHxHKGtAl28%NR*@lcv;1GxcvNPLRz~WgzHVAl1GBUgX1`Lcw zvy=fSHG!Rh1*p=%$k>2!0mM|0jjRhGCQSjdL4XNpE)!T~kfjBX1=VF}U;vW6TkI9Z zt|77m$V~KfaSYK2jy-!*tU-Z;B_M`D_wuLz_Gaa4DwFh{GdzheW6 Date: Sun, 8 Dec 2024 16:00:34 -0500 Subject: [PATCH 6/6] Polymorphic Book entries --- .../en_us/entries/item_polymorphic_wand.json | 21 +++++++++++++++++++ .../entries/item_polymorphic_wand_v2.json | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand.json create mode 100644 src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand_v2.json diff --git a/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand.json b/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand.json new file mode 100644 index 00000000..00b67328 --- /dev/null +++ b/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand.json @@ -0,0 +1,21 @@ +{ + "name": "Polymorphic Wand", + "sortnum": 21, + "category": "justdirethings:items", + "icon": "justdirethings:polymorphic_wand", + "pages": [ + { + "type": "patchouli:text", + "text": "The polymorphic wand uses the latent energy available in Blazegold to activate the Polymorphic Fluid, randomly changing mobs from one form to another!$(br2)Simply activate the wand on a hostile entity, and it'll convert randomly into another hostile entity. The same can happen with peaceful entities." + }, + { + "type": "patchouli:text", + "text": "With this simple form of the wand, it is not possible to guarantee which mob you will get, nor is is possible to swap hostile and friendly mobs with each other. You suspect the wand can be upgraded to allow for these features, however!" + }, + { + "type": "patchouli:crafting", + "title": "Polymorphic Wand", + "recipe": "justdirethings:polymorphic_wand" + } + ] +} diff --git a/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand_v2.json b/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand_v2.json new file mode 100644 index 00000000..3314c458 --- /dev/null +++ b/src/main/resources/assets/justdirethings/patchouli_books/justdirethingsbook/en_us/entries/item_polymorphic_wand_v2.json @@ -0,0 +1,21 @@ +{ + "name": "Adv. Polymorphic Wand", + "sortnum": 22, + "category": "justdirethings:items", + "icon": "justdirethings:polymorphic_wand_v2", + "pages": [ + { + "type": "patchouli:text", + "text": "The advanced polymorphic wand is an upgrade to the Polymorphic Wand. The existing 'random polymorph' ability still exists, but a new ability, 'targetted polymorph' is now available!" + }, + { + "type": "patchouli:text", + "text": "Simply shift-right click on any mob to save that type of mob to the wand, then activate the targeted polymorph ability to convert any mob to that type automatically!$(br2)Some mobs cannot be saved to the wand (You can edit these with Tags).$(br2)It is recommended to set the two abilities to different clicks or hotkeys." + }, + { + "type": "patchouli:crafting", + "title": "Adv. Polymorphic Wand", + "recipe": "justdirethings:polymorphic_wand_v2" + } + ] +}