From 1d51abf5c9af9b52685addf5958269fe88275739 Mon Sep 17 00:00:00 2001 From: Waterpicker Date: Tue, 19 Nov 2024 16:59:27 -0600 Subject: [PATCH] Implement Ogerpon mask and various other form change items. --- .../assets/generations_core/lang/en_us.json | 5 +- .../models/item/cornerstone_mask.json | 6 + .../models/item/heartflame_mask.json | 6 + .../models/item/teal_mask.json | 6 + .../models/item/wellspring_mask.json | 6 + .../tags/items/held_items.json | 6 +- .../tags/items/legendary_items.json | 4 +- .../minecraft/tags/blocks/mineable/axe.json | 98 +++++++++++- .../tags/blocks/mineable/pickaxe.json | 148 ++++++++++++++++-- .../common/GenerationsArchitecturyEvents.kt | 8 + .../common/GenerationsCobblemonEvents.kt | 2 + .../common/GenerationsCore.java | 3 + .../common/world/item/FormChanging.kt | 5 + .../common/world/item/FormChangingItem.kt | 6 - .../common/world/item/FormChangingItems.kt | 22 +++ .../item/GenerationsCobblemonInteractions.kt | 75 +++++++-- .../common/world/item/GenerationsItems.kt | 34 ++-- .../common/world/item/PpUpItem.java | 19 --- .../common/world/item/PrisonBottleItem.java | 9 -- .../world/item/legends/DoggoImplmentItem.java | 11 -- .../ElementalPostBattleUpdateItemImpl.java | 21 --- .../ElementalPostBattleUpdateItemImpl.kt | 14 ++ ...ElementalPostBattleUpdateItemImplImpl.java | 54 ------- .../ElementalPostBattleUpdateItemImplImpl.kt | 49 ++++++ .../level/block/FormChangingBlockItem.kt | 3 +- .../world/level/block/GenerationsShrines.java | 2 +- .../item/held_items/cornerstone_mask.png | Bin 0 -> 540 bytes .../item/held_items/hearthflame_mask.png | Bin 0 -> 303 bytes .../textures/item/held_items/teal_mask.png | Bin 0 -> 320 bytes .../item/held_items/wellspring_mask.png | Bin 0 -> 362 bytes .../ogerpon_mask.json | 4 + .../species_features/ogerpon_mask.json | 13 ++ .../datagen/generators/items/ItemDatagen.java | 5 + 33 files changed, 484 insertions(+), 160 deletions(-) create mode 100644 common/src/main/generated/resources/assets/generations_core/models/item/cornerstone_mask.json create mode 100644 common/src/main/generated/resources/assets/generations_core/models/item/heartflame_mask.json create mode 100644 common/src/main/generated/resources/assets/generations_core/models/item/teal_mask.json create mode 100644 common/src/main/generated/resources/assets/generations_core/models/item/wellspring_mask.json delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItem.kt create mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItems.kt delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PpUpItem.java delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PrisonBottleItem.java delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/DoggoImplmentItem.java delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.java create mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.kt delete mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.java create mode 100644 common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.kt create mode 100644 common/src/main/resources/assets/generations_core/textures/item/held_items/cornerstone_mask.png create mode 100644 common/src/main/resources/assets/generations_core/textures/item/held_items/hearthflame_mask.png create mode 100644 common/src/main/resources/assets/generations_core/textures/item/held_items/teal_mask.png create mode 100644 common/src/main/resources/assets/generations_core/textures/item/held_items/wellspring_mask.png create mode 100644 common/src/main/resources/data/generations_core/species_feature_assignments/ogerpon_mask.json create mode 100644 common/src/main/resources/data/generations_core/species_features/ogerpon_mask.json diff --git a/common/src/main/generated/resources/assets/generations_core/lang/en_us.json b/common/src/main/generated/resources/assets/generations_core/lang/en_us.json index c5e5d02ff..7e079c266 100644 --- a/common/src/main/generated/resources/assets/generations_core/lang/en_us.json +++ b/common/src/main/generated/resources/assets/generations_core/lang/en_us.json @@ -1673,6 +1673,7 @@ "item.generations_core.coolness_master_ribbon": "Coolness Master Ribbon", "item.generations_core.copper_plate": "Copper Plate", "item.generations_core.coraleye_badge": "Coraleye Badge", + "item.generations_core.cornerstone_mask": "Cornerstone Mask", "item.generations_core.country_ribbon": "Country Ribbon", "item.generations_core.coupon_1": "Coupon 1", "item.generations_core.coupon_1.desc": "Not currently implemented", @@ -2007,6 +2008,7 @@ "item.generations_core.health_candy_xl": "Health Candy Xl", "item.generations_core.health_candy_xl.desc": "Not currently implemented", "item.generations_core.heart_scale": "Heart Scale", + "item.generations_core.heartflame_mask": "Heartflame Mask", "item.generations_core.heat_badge": "Heat Badge", "item.generations_core.heracronite": "Heracronite", "item.generations_core.hi_tech_earbuds": "Hi Tech Earbuds", @@ -2256,7 +2258,6 @@ "item.generations_core.mine_badge": "Mine Badge", "item.generations_core.mineral_badge": "Mineral Badge", "item.generations_core.mirror": "Mirror", - "item.generations_core.mirror.tooltip": "§7HINT: Instead of seeing your reflection, you see Gems. They’re pink, blue, and white and laid out in a frame.", "item.generations_core.misty_seed": "Misty Seed", "item.generations_core.mixed_mushrooms": "Mixed Mushrooms", "item.generations_core.moomoo_cheese": "Moomoo Cheese", @@ -2823,6 +2824,7 @@ "item.generations_core.tapunium_z": "Tapunium Z", "item.generations_core.teachy_tv": "Teachy Tv", "item.generations_core.teachy_tv.desc": "Not currently implemented", + "item.generations_core.teal_mask": "Teal Mask", "item.generations_core.team_rocket_disc": "Team Rocket Disc", "item.generations_core.team_rocket_disc.desc": "GlitchxCity - Team Rocket", "item.generations_core.terrain_extender": "Terrain Extender", @@ -3174,6 +3176,7 @@ "item.generations_core.waterium_z": "Waterium Z", "item.generations_core.wave_badge": "Wave Badge", "item.generations_core.wave_incense": "Wave Incense", + "item.generations_core.wellspring_mask": "Wellspring Mask", "item.generations_core.white_flute": "White Flute", "item.generations_core.white_mane_hair": "White Mane Hair", "item.generations_core.white_mane_hair.tooltip": "§7HINT: This majestic steed requires a generous offering of carrots if you wish to lay your eyes upon them.", diff --git a/common/src/main/generated/resources/assets/generations_core/models/item/cornerstone_mask.json b/common/src/main/generated/resources/assets/generations_core/models/item/cornerstone_mask.json new file mode 100644 index 000000000..0a2571e04 --- /dev/null +++ b/common/src/main/generated/resources/assets/generations_core/models/item/cornerstone_mask.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "generations_core:item/held_items/cornerstone_mask" + } +} \ No newline at end of file diff --git a/common/src/main/generated/resources/assets/generations_core/models/item/heartflame_mask.json b/common/src/main/generated/resources/assets/generations_core/models/item/heartflame_mask.json new file mode 100644 index 000000000..5c9422279 --- /dev/null +++ b/common/src/main/generated/resources/assets/generations_core/models/item/heartflame_mask.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "generations_core:item/placeholder" + } +} \ No newline at end of file diff --git a/common/src/main/generated/resources/assets/generations_core/models/item/teal_mask.json b/common/src/main/generated/resources/assets/generations_core/models/item/teal_mask.json new file mode 100644 index 000000000..dcc149af9 --- /dev/null +++ b/common/src/main/generated/resources/assets/generations_core/models/item/teal_mask.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "generations_core:item/held_items/teal_mask" + } +} \ No newline at end of file diff --git a/common/src/main/generated/resources/assets/generations_core/models/item/wellspring_mask.json b/common/src/main/generated/resources/assets/generations_core/models/item/wellspring_mask.json new file mode 100644 index 000000000..eee25d457 --- /dev/null +++ b/common/src/main/generated/resources/assets/generations_core/models/item/wellspring_mask.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "generations_core:item/held_items/wellspring_mask" + } +} \ No newline at end of file diff --git a/common/src/main/generated/resources/data/generations_core/tags/items/held_items.json b/common/src/main/generated/resources/data/generations_core/tags/items/held_items.json index 5df88882e..6d338fb7a 100644 --- a/common/src/main/generated/resources/data/generations_core/tags/items/held_items.json +++ b/common/src/main/generated/resources/data/generations_core/tags/items/held_items.json @@ -152,6 +152,10 @@ "generations_core:punching_glove", "generations_core:clear_amulet", "generations_core:booster_energy", - "generations_core:fairy_feather" + "generations_core:fairy_feather", + "generations_core:teal_mask", + "generations_core:wellspring_mask", + "generations_core:heartflame_mask", + "generations_core:cornerstone_mask" ] } \ No newline at end of file diff --git a/common/src/main/generated/resources/data/generations_core/tags/items/legendary_items.json b/common/src/main/generated/resources/data/generations_core/tags/items/legendary_items.json index 98030de9f..a48d35458 100644 --- a/common/src/main/generated/resources/data/generations_core/tags/items/legendary_items.json +++ b/common/src/main/generated/resources/data/generations_core/tags/items/legendary_items.json @@ -59,10 +59,10 @@ "generations_core:sparkling_shard", "generations_core:sparkling_stone", "generations_core:rusty_fragment", - "generations_core:rusty_sword", "generations_core:crowned_sword", - "generations_core:rusty_shield", + "generations_core:rusty_sword", "generations_core:crowned_shield", + "generations_core:rusty_shield", "generations_core:scroll_page", "generations_core:secret_armor_scroll", "generations_core:zygarde_cube", diff --git a/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/axe.json b/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/axe.json index cd70c3f76..06e60a640 100644 --- a/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/axe.json +++ b/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -55,6 +55,102 @@ "generations_core:cursed_jack_o_lantern", "generations_core:cursed_carved_pumpkin", "generations_core:scarecrow", - "generations_core:box" + "generations_core:box", + "generations_core:purple_couch_arm_left", + "generations_core:light_blue_couch_arm_left", + "generations_core:pink_couch_arm_left", + "generations_core:brown_couch_arm_left", + "generations_core:cyan_couch_arm_left", + "generations_core:orange_couch_arm_left", + "generations_core:light_gray_couch_arm_left", + "generations_core:blue_couch_arm_left", + "generations_core:green_couch_arm_left", + "generations_core:black_couch_arm_left", + "generations_core:yellow_couch_arm_left", + "generations_core:magenta_couch_arm_left", + "generations_core:red_couch_arm_left", + "generations_core:gray_couch_arm_left", + "generations_core:white_couch_arm_left", + "generations_core:lime_couch_arm_left", + "generations_core:purple_couch_arm_right", + "generations_core:light_blue_couch_arm_right", + "generations_core:pink_couch_arm_right", + "generations_core:brown_couch_arm_right", + "generations_core:cyan_couch_arm_right", + "generations_core:orange_couch_arm_right", + "generations_core:light_gray_couch_arm_right", + "generations_core:blue_couch_arm_right", + "generations_core:green_couch_arm_right", + "generations_core:black_couch_arm_right", + "generations_core:yellow_couch_arm_right", + "generations_core:magenta_couch_arm_right", + "generations_core:red_couch_arm_right", + "generations_core:gray_couch_arm_right", + "generations_core:white_couch_arm_right", + "generations_core:lime_couch_arm_right", + "generations_core:purple_couch_corner_left", + "generations_core:light_blue_couch_corner_left", + "generations_core:pink_couch_corner_left", + "generations_core:brown_couch_corner_left", + "generations_core:cyan_couch_corner_left", + "generations_core:orange_couch_corner_left", + "generations_core:light_gray_couch_corner_left", + "generations_core:blue_couch_corner_left", + "generations_core:green_couch_corner_left", + "generations_core:black_couch_corner_left", + "generations_core:yellow_couch_corner_left", + "generations_core:magenta_couch_corner_left", + "generations_core:red_couch_corner_left", + "generations_core:gray_couch_corner_left", + "generations_core:white_couch_corner_left", + "generations_core:lime_couch_corner_left", + "generations_core:purple_couch_corner_right", + "generations_core:light_blue_couch_corner_right", + "generations_core:pink_couch_corner_right", + "generations_core:brown_couch_corner_right", + "generations_core:cyan_couch_corner_right", + "generations_core:orange_couch_corner_right", + "generations_core:light_gray_couch_corner_right", + "generations_core:blue_couch_corner_right", + "generations_core:green_couch_corner_right", + "generations_core:black_couch_corner_right", + "generations_core:yellow_couch_corner_right", + "generations_core:magenta_couch_corner_right", + "generations_core:red_couch_corner_right", + "generations_core:gray_couch_corner_right", + "generations_core:white_couch_corner_right", + "generations_core:lime_couch_corner_right", + "generations_core:purple_couch_middle", + "generations_core:light_blue_couch_middle", + "generations_core:pink_couch_middle", + "generations_core:brown_couch_middle", + "generations_core:cyan_couch_middle", + "generations_core:orange_couch_middle", + "generations_core:light_gray_couch_middle", + "generations_core:blue_couch_middle", + "generations_core:green_couch_middle", + "generations_core:black_couch_middle", + "generations_core:yellow_couch_middle", + "generations_core:magenta_couch_middle", + "generations_core:red_couch_middle", + "generations_core:gray_couch_middle", + "generations_core:white_couch_middle", + "generations_core:lime_couch_middle", + "generations_core:purple_couch_ottoman", + "generations_core:light_blue_couch_ottoman", + "generations_core:pink_couch_ottoman", + "generations_core:brown_couch_ottoman", + "generations_core:cyan_couch_ottoman", + "generations_core:orange_couch_ottoman", + "generations_core:light_gray_couch_ottoman", + "generations_core:blue_couch_ottoman", + "generations_core:green_couch_ottoman", + "generations_core:black_couch_ottoman", + "generations_core:yellow_couch_ottoman", + "generations_core:magenta_couch_ottoman", + "generations_core:red_couch_ottoman", + "generations_core:gray_couch_ottoman", + "generations_core:white_couch_ottoman", + "generations_core:lime_couch_ottoman" ] } \ No newline at end of file diff --git a/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index fff4bd0d0..9626f6e4b 100644 --- a/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/common/src/main/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -796,22 +796,150 @@ "generations_core:pink_elevator", "generations_core:desk", "generations_core:fridge", - "generations_core:green_pc", - "generations_core:white_pc", - "generations_core:magenta_pc", - "generations_core:blue_pc", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_street_lamp", + "generations_core:light_blue_street_lamp", + "generations_core:pink_street_lamp", + "generations_core:brown_street_lamp", + "generations_core:cyan_street_lamp", + "generations_core:orange_street_lamp", + "generations_core:light_gray_street_lamp", + "generations_core:blue_street_lamp", + "generations_core:green_street_lamp", + "generations_core:black_street_lamp", + "generations_core:yellow_street_lamp", + "generations_core:magenta_street_lamp", + "generations_core:red_street_lamp", + "generations_core:gray_street_lamp", + "generations_core:white_street_lamp", + "generations_core:lime_street_lamp", + "generations_core:purple_pc", "generations_core:light_blue_pc", "generations_core:pink_pc", - "generations_core:light_gray_pc", "generations_core:brown_pc", - "generations_core:gray_pc", - "generations_core:purple_pc", - "generations_core:yellow_pc", - "generations_core:black_pc", "generations_core:cyan_pc", - "generations_core:lime_pc", "generations_core:orange_pc", + "generations_core:light_gray_pc", + "generations_core:blue_pc", + "generations_core:green_pc", + "generations_core:black_pc", + "generations_core:yellow_pc", + "generations_core:magenta_pc", "generations_core:red_pc", + "generations_core:gray_pc", + "generations_core:white_pc", + "generations_core:lime_pc", "generations_core:empty_ball_display", "generations_core:poke_ball_display", "generations_core:great_ball_display", diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsArchitecturyEvents.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsArchitecturyEvents.kt index 49ef3d967..35a3428b1 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsArchitecturyEvents.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsArchitecturyEvents.kt @@ -2,6 +2,7 @@ package generations.gg.generations.core.generationscore.common import com.cobblemon.mod.common.api.dialogue.Dialogue import com.cobblemon.mod.common.api.dialogue.Dialogues +import com.cobblemon.mod.common.entity.pokemon.PokemonEntity import com.cobblemon.mod.common.util.asTranslated import com.cobblemon.mod.common.util.openDialogue import dev.architectury.event.EventResult @@ -9,6 +10,7 @@ import dev.architectury.event.events.common.InteractionEvent import generations.gg.generations.core.generationscore.common.api.events.general.EntityEvents import generations.gg.generations.core.generationscore.common.tags.GenerationsBlockTags import generations.gg.generations.core.generationscore.common.world.entity.ZygardeCellEntity +import generations.gg.generations.core.generationscore.common.world.item.GenerationsCobblemonInteractions import generations.gg.generations.core.generationscore.common.world.item.GenerationsItems import generations.gg.generations.core.generationscore.common.world.item.ZygardeCubeItem import generations.gg.generations.core.generationscore.common.world.level.block.ElevatorBlock @@ -63,6 +65,8 @@ object GenerationsArchitecturyEvents { } InteractionEvent.INTERACT_ENTITY.register { player, entity, hand -> + if(player !is ServerPlayer) return@register EventResult.pass() + val stack = player.getItemInHand(hand) if (stack.`is`(GenerationsItems.ZYGARDE_CUBE.get()) && entity is ZygardeCellEntity) { if (stack.damageValue != ZygardeCubeItem.FULL) { @@ -74,6 +78,10 @@ object GenerationsArchitecturyEvents { } else { player.displayClientMessage("item.generations_core.zygarde_cube.tooltip.cell_full".asTranslated(), false) } + } else { + if(entity is PokemonEntity) { + return@register if(GenerationsCobblemonInteractions.triggerCustomInteraction(entity, player, stack)) EventResult.interruptTrue() else EventResult.pass() + } } return@register EventResult.pass() diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCobblemonEvents.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCobblemonEvents.kt index ef5c8a227..96b4521d6 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCobblemonEvents.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCobblemonEvents.kt @@ -156,6 +156,8 @@ class GenerationsCobblemonEvents { } } + + // CobblemonEvents.POKEMON_ENTITY_SPAWN.subscribe { it.entity.taskBuilder().infiniteIterations().identifier("castform") } CobblemonEvents.LOOT_DROPPED.subscribe(Priority.HIGHEST) { diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCore.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCore.java index dbb678ab1..b2ee5c843 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCore.java +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/GenerationsCore.java @@ -26,6 +26,7 @@ import generations.gg.generations.core.generationscore.common.world.container.GenerationsContainers; import generations.gg.generations.core.generationscore.common.world.entity.GenerationsEntities; import generations.gg.generations.core.generationscore.common.world.item.GenerationsArmor; +import generations.gg.generations.core.generationscore.common.world.item.GenerationsCobblemonInteractions; import generations.gg.generations.core.generationscore.common.world.item.GenerationsItems; import generations.gg.generations.core.generationscore.common.world.item.GenerationsTools; import generations.gg.generations.core.generationscore.common.world.item.creativetab.GenerationsCreativeTabs; @@ -126,6 +127,8 @@ public static void init(GenerationsImplementation implementation) { GenerationsCobblemonEvents.init(); GenerationsArchitecturyEvents.init(); + + GenerationsCobblemonInteractions.INSTANCE.registerDefaultCustomInteractions(); } private static void initRecipes() { diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChanging.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChanging.kt index 5b9752547..df2cb157e 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChanging.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChanging.kt @@ -6,10 +6,13 @@ import com.cobblemon.mod.common.api.pokemon.feature.FlagSpeciesFeatureProvider import com.cobblemon.mod.common.entity.pokemon.PokemonEntity import com.cobblemon.mod.common.pokemon.Pokemon import generations.gg.generations.core.generationscore.common.util.getProviderOrNull +import net.minecraft.resources.ResourceLocation interface FormChanging { val provider: String + val species: ResourceLocation? + fun process(pokemon : Pokemon, returned: Boolean): Boolean } @@ -17,6 +20,8 @@ interface FormChangingString : FormChanging { val value: String override fun process(pokemon: Pokemon, returned: Boolean): Boolean { + if(species != null && (species?.equals(pokemon.species.resourceIdentifier) == true)) return false + var provider: ChoiceSpeciesFeatureProvider? = null val value: String diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItem.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItem.kt deleted file mode 100644 index 2ec089fe5..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItem.kt +++ /dev/null @@ -1,6 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item - -import net.minecraft.world.item.Item - - -open class FormChangingItem(properties: Properties, override val provider: String, override val value: String): Item(properties), FormChangingString diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItems.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItems.kt new file mode 100644 index 000000000..62e02aeb5 --- /dev/null +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/FormChangingItems.kt @@ -0,0 +1,22 @@ +package generations.gg.generations.core.generationscore.common.world.item + +import net.minecraft.resources.ResourceLocation +import net.minecraft.world.item.Item +import net.minecraft.world.item.Item.Properties + + +abstract class FormChangingItem(properties: Properties, override val provider: String): Item(properties), FormChanging + +open class FormChangingItemString(properties: Properties, provider: String, override val value: String, override val species: ResourceLocation? = null): FormChangingItem(properties, provider), FormChangingString +open class FormChangingItemBoolean(properties: Properties, provider: String, override val species: ResourceLocation? = null): FormChangingItem(properties, provider), FormChangingToggle + +class FormChangingItems { + companion object { + fun createFormChangingItem(properties: Properties, provider: String, value: String? = null, species: ResourceLocation? = null): FormChangingItem { + return when { + value != null -> FormChangingItemString(properties, provider, value, species) + else -> FormChangingItemBoolean(properties, provider, species) + } + } + } +} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsCobblemonInteractions.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsCobblemonInteractions.kt index f41a4e7ab..84efc5fb4 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsCobblemonInteractions.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsCobblemonInteractions.kt @@ -1,8 +1,18 @@ package generations.gg.generations.core.generationscore.common.world.item import com.cobblemon.mod.common.api.interaction.PokemonEntityInteraction +import com.cobblemon.mod.common.api.pokemon.feature.ChoiceSpeciesFeatureProvider +import com.cobblemon.mod.common.api.pokemon.feature.FlagSpeciesFeatureProvider import com.cobblemon.mod.common.entity.pokemon.PokemonEntity +import com.cobblemon.mod.common.pokemon.feature.TagSeasonResolver +import com.cobblemon.mod.common.util.asTranslated +import generations.gg.generations.core.generationscore.common.util.cycle +import generations.gg.generations.core.generationscore.common.util.getOrCreate +import generations.gg.generations.core.generationscore.common.util.getProviderOrNull +import generations.gg.generations.core.generationscore.common.util.isSpecies import net.minecraft.server.level.ServerPlayer +import net.minecraft.tags.ItemTags +import net.minecraft.tags.TagKey import net.minecraft.world.entity.Entity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack @@ -11,11 +21,9 @@ object GenerationsCobblemonInteractions { fun registerCustomInteraction(customInteraction: PokemonInteraction) { customInteractions.add(customInteraction) } - private fun triggerCustomInteraction(pixelmonEntity: PokemonEntity, player: Player, itemInHand: ItemStack): Boolean { - return customInteractions - .map { interaction: PokemonInteraction -> interaction.processInteraction(player as ServerPlayer, pixelmonEntity, itemInHand) } - .firstOrNull { it } - ?: false + fun triggerCustomInteraction(pixelmonEntity: PokemonEntity, player: ServerPlayer, itemInHand: ItemStack): Boolean { + System.out.println("Testing bullshit:") + return customInteractions.any { interaction: PokemonInteraction -> interaction.processInteraction(player, pixelmonEntity, itemInHand) } } interface PokemonInteraction : PokemonEntityInteraction { @@ -32,15 +40,62 @@ object GenerationsCobblemonInteractions { fun process(entity: Entity, player: Player, stack: ItemStack): Boolean { return if (entity is PokemonEntity) { - if (stack.item is PokemonInteraction) { - (stack.item as PokemonInteraction).processInteraction(player as ServerPlayer, entity, stack) - } else { - triggerCustomInteraction(entity, player, stack) - } + return triggerCustomInteraction(entity, player, stack) } else { false } } + fun registerDefaultCustomInteractions() { + registerCustomInteraction(KeldeoInteraction) + registerCustomInteraction(MeloettaInteraction) + } + private val customInteractions: MutableList = ArrayList() + + object KeldeoInteraction: PokemonInteraction { + override fun processInteraction(player: ServerPlayer, entity: PokemonEntity, stack: ItemStack): Boolean { + if (stack.`is`(ItemTags.SWORDS) && entity.pokemon.isSpecies("keldeo")) { + + var pokemon = entity.pokemon + + val provider = pokemon.getProviderOrNull("resolute") ?: return false + val feature = provider.getOrCreate(pokemon) + feature.enabled = !feature.enabled + pokemon.updateAspects() + pokemon.markFeatureDirty(feature) + + player.sendSystemMessage("generations_core.ability.formchange".asTranslated(entity.pokemon.getDisplayName().string), true) + return true + } + + return false + } + + override val isConsumed: Boolean + get() = false + } + + object MeloettaInteraction: PokemonInteraction { + override fun processInteraction(player: ServerPlayer, entity: PokemonEntity, stack: ItemStack): Boolean { + if (stack.`is`(GenerationsItems.INERT_RELIC_SONG.get()) && entity.pokemon.isSpecies("meloetta")) { + + var pokemon = entity.pokemon + + val provider = pokemon.getProviderOrNull("piroette") ?: return false + val feature = provider.getOrCreate(pokemon) + feature.enabled = !feature.enabled + pokemon.updateAspects() + pokemon.markFeatureDirty(feature) + + player.sendSystemMessage("generations_core.ability.formchange".asTranslated(entity.pokemon.getDisplayName().string), true) + return true + } + + return false + } + + override val isConsumed: Boolean + get() = false + } } diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsItems.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsItems.kt index 2edc16164..038d7da00 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsItems.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/GenerationsItems.kt @@ -4,6 +4,8 @@ import com.cobblemon.mod.common.api.types.ElementalType import com.cobblemon.mod.common.api.types.ElementalTypes import com.cobblemon.mod.common.item.PokeBallItem import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager +import com.cobblemon.mod.common.util.asResource +import com.cobblemon.mod.common.util.cobblemonResource import dev.architectury.core.item.ArchitecturyRecordItem import dev.architectury.registry.registries.DeferredRegister import dev.architectury.registry.registries.RegistrySupplier @@ -12,6 +14,7 @@ import generations.gg.generations.core.generationscore.common.config.LegendKeys import generations.gg.generations.core.generationscore.common.world.GenerationsPokeBalls import generations.gg.generations.core.generationscore.common.world.entity.GenerationsBoatEntity import generations.gg.generations.core.generationscore.common.world.entity.TieredFishingHookEntity +import generations.gg.generations.core.generationscore.common.world.item.FormChangingItems.Companion.createFormChangingItem import generations.gg.generations.core.generationscore.common.world.item.curry.CurryIngredient import generations.gg.generations.core.generationscore.common.world.item.curry.CurryType import generations.gg.generations.core.generationscore.common.world.item.curry.ItemCurry @@ -734,14 +737,19 @@ object GenerationsItems { @JvmField val PSYCHIC_SEED = registerHeldItem("psychic_seed") @JvmField val RED_SCARF = registerHeldItem("red_scarf") @JvmField val LEGEND_PLATE = registerHeldItem("legend_plate") - @JvmField val LUSTROUS_GLOBE = registerHeldItem("lustrous_globe") - @JvmField val ADAMANT_CRYSTAL = registerHeldItem("adamant_crystal") - @JvmField val GRISEOUS_CORE = registerHeldItem("griseous_core") + @JvmField val LUSTROUS_GLOBE = registerHeldItem("lustrous_globe") { properties -> createFormChangingItem(properties, "origin", species = cobblemonResource("palkia")) } + @JvmField val ADAMANT_CRYSTAL = registerHeldItem("adamant_crystal") { properties -> createFormChangingItem(properties, "origin", species = cobblemonResource("dialga")) } + @JvmField val GRISEOUS_CORE = registerHeldItem("griseous_core") { properties -> createFormChangingItem(properties, "origin", species = cobblemonResource("giratina")) } @JvmField val PUNCHING_GLOVE = registerHeldItem("punching_glove") @JvmField val CLEAR_AMULET = registerHeldItem("clear_amulet") @JvmField val BOOSTER_ENERGY = registerHeldItem("booster_energy") @JvmField val FAIRY_FEATHER = registerHeldItem("fairy_feather") + @JvmField val TEAL_MASK = registerHeldItem("teal_mask") { properties -> createFormChangingItem(properties, "ogerpon_mask", "teal") } + @JvmField val WELLSPRING_MASK = registerHeldItem("wellspring_mask") { properties -> createFormChangingItem(properties, "ogerpon_mask", "wellspring") } + @JvmField val HEARTFLAME_MASK = registerHeldItem("heartflame_mask") { properties -> createFormChangingItem(properties, "ogerpon_mask", "heartflame") } + @JvmField val CORNERSTONE_MASK = registerHeldItem("cornerstone_mask") { properties -> createFormChangingItem(properties, "ogerpon_mask", "cornerstone") } + /** * Vanilla Like Materials */ @@ -860,10 +868,10 @@ object GenerationsItems { @JvmField val N_LUNARIZER = register("n_lunarizer", { NecroizerItemItem(it, "lunala", "moongeistbeam", "dawnwings") }, LEGENDARY_ITEMS) @JvmField val LEGEND_FINDER = register("legend_finder", ::Item, LEGENDARY_ITEMS) @JvmField val HOOPA_RING = register("hoopa_ring", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) - @JvmField val RED_ORB = register("red_orb", ::Item, LEGENDARY_ITEMS) @JvmField val FADED_RED_ORB = register("faded_red_orb", { ElementalPostBattleUpdateItemImpl(it.stacksTo(1).durability(250), ElementalTypes.FIRE) }, LEGENDARY_ITEMS) @JvmField val FADED_BLUE_ORB = register("faded_blue_orb", { ElementalPostBattleUpdateItemImpl(it.stacksTo(1).durability(250), ElementalTypes.WATER) }, LEGENDARY_ITEMS) - @JvmField val FADED_JADE_ORB = register("faded_jade_orb", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(250), LegendKeys.RAYQUAZA, ElementalTypes.FLYING) }, LEGENDARY_ITEMS) + @JvmField val FADED_JADE_ORB = register("faded_jade_orb", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(250), key = LegendKeys.RAYQUAZA, types = listOf(ElementalTypes.FLYING)) }, LEGENDARY_ITEMS) + @JvmField val RED_ORB = register("red_orb", ::Item, LEGENDARY_ITEMS) @JvmField val BLUE_ORB = register("blue_orb", ::Item, LEGENDARY_ITEMS) @JvmField val JADE_ORB = register("jade_orb", { JadeOrb(it.stacksTo(1)) }, LEGENDARY_ITEMS) @JvmField val LIGHT_STONE = register("light_stone", { TaoTrioStoneItem(it.stacksTo(1).durability(100), LegendKeys.RESHIRAM) }, LEGENDARY_ITEMS) @@ -877,10 +885,10 @@ object GenerationsItems { @JvmField val SPARKLING_SHARD = register("sparkling_shard", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) @JvmField val SPARKLING_STONE = register("sparkling_stone", { ElementalPostBattleUpdateItemImpl(it.stacksTo(1).durability(100), ElementalTypes.FAIRY) }, LEGENDARY_ITEMS) @JvmField val RUSTY_FRAGMENT = register("rusty_fragment", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) - @JvmField val RUSTY_SWORD = register("rusty_sword", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(100), LegendKeys.ZACIAN, ElementalTypes.STEEL) }, LEGENDARY_ITEMS) - @JvmField val CROWNED_SWORD = register("crowned_sword", ::Item, LEGENDARY_ITEMS) - @JvmField val RUSTY_SHIELD = register("rusty_shield", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(100), LegendKeys.ZAMAZENTA, ElementalTypes.STEEL) }, LEGENDARY_ITEMS) - @JvmField val CROWNED_SHIELD = register("crowned_shield", ::Item, LEGENDARY_ITEMS) + @JvmField val CROWNED_SWORD = register("crowned_sword", { createFormChangingItem(it, "crowned", species = cobblemonResource("zacian")) }, LEGENDARY_ITEMS) + @JvmField val RUSTY_SWORD = register("rusty_sword", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(100), key = LegendKeys.ZACIAN, itemToGiveUponSpawn = CROWNED_SWORD.get(), types = listOf(ElementalTypes.STEEL)) }, LEGENDARY_ITEMS) + @JvmField val CROWNED_SHIELD = register("crowned_shield", { createFormChangingItem(it, "crowned", species = cobblemonResource("zamazenta")) }, LEGENDARY_ITEMS) + @JvmField val RUSTY_SHIELD = register("rusty_shield", { ElementalPostBattleUpdateItemImplImpl(it.stacksTo(1).durability(100), key = LegendKeys.ZAMAZENTA, itemToGiveUponSpawn = CROWNED_SHIELD.get(), types = listOf(ElementalTypes.STEEL)) }, LEGENDARY_ITEMS) @JvmField val SCROLL_PAGE = register("scroll_page", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) @JvmField val SECRET_ARMOR_SCROLL = register("secret_armor_scroll", ::SecretArmorScroll, LEGENDARY_ITEMS) @JvmField val ZYGARDE_CUBE = register("zygarde_cube", { ZygardeCubeItem(it.stacksTo(1).durability(ZygardeCubeItem.FULL)) }, LEGENDARY_ITEMS) @@ -891,7 +899,7 @@ object GenerationsItems { @JvmField val SUN_FLUTE = register("sun_flute", ::Item, LEGENDARY_ITEMS) @JvmField val LAVA_CRYSTAL = register("lava_crystal", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) @JvmField val JEWEL_OF_LIFE = register("jewel_of_life", ::Item, LEGENDARY_ITEMS) - @JvmField val MIRROR = register("mirror", ::ItemWithLangTooltipImpl, LEGENDARY_ITEMS) + @JvmField val MIRROR = register("mirror", { createFormChangingItem(it, "therian") }, LEGENDARY_ITEMS) @JvmField val UNENCHANTED_ICEROOT_CARROT = register("unenchanted_iceroot_carrot", ::Item, LEGENDARY_ITEMS) @JvmField val ICEROOT_CARROT = register("iceroot_carrot", { CalyrexSteedItem("iceroot", it.stacksTo(1).food(FoodProperties.Builder().alwaysEat().build()), LegendKeys.GLASTRIER, UNENCHANTED_ICEROOT_CARROT) }, LEGENDARY_ITEMS) @JvmField val UNENCHANTED_SHADEROOT_CARROT = register("unenchanted_shaderoot_carrot", ::Item, LEGENDARY_ITEMS) @@ -1478,7 +1486,7 @@ object GenerationsItems { private fun createRelicSong(inert: Boolean): RegistrySupplier = register((if(inert) "inert_" else "") + "relic_song", { RelicSongItem(it.stacksTo(1), inert) }, LEGENDARY_ITEMS) - private fun registerHeldItem(name: String): RegistrySupplier = register(name, { Item(it).also { CobblemonHeldItemManager.registerRemap(it, name.replace("_", "")) } }, HELD_ITEMS) + private fun registerHeldItem(name: String, function: Function = Function { properties -> Item(properties) }): RegistrySupplier = register(name, { function.apply(it).also { CobblemonHeldItemManager.registerRemap(it, name.replace("_", "")) } }, HELD_ITEMS) fun of() : Item.Properties = Item.Properties() @@ -1498,9 +1506,9 @@ object GenerationsItems { private fun registerMail(name: String, type: MailType): RegistrySupplier = register(name, type::createMailItem, POKEMAIL) - private fun registerPlate(name: String, type: ElementalType): RegistrySupplier = register(name, { FormChangingItem(it, "type", type.name) }, FORM_ITEMS) + private fun registerPlate(name: String, type: ElementalType): RegistrySupplier = register(name, { createFormChangingItem(it, "type", type.name) }, FORM_ITEMS) - private fun registerCap(name: String): RegistrySupplier = register("${name}_cap", { FormChangingItem(it, "pikachu_cap", name) }, FORM_ITEMS) + private fun registerCap(name: String): RegistrySupplier = register("${name}_cap", { createFormChangingItem(it, "pikachu_cap", name) }, FORM_ITEMS) @JvmStatic fun init() { GenerationsCore.LOGGER.info("Registering Generations Items") diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PpUpItem.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PpUpItem.java deleted file mode 100644 index 3a2254eb3..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PpUpItem.java +++ /dev/null @@ -1,19 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item; - -import net.minecraft.world.item.Item; - -public class PpUpItem extends Item/* implements PixelmonInteractions.PixelmonInteraction*/ { - - public PpUpItem(Properties arg) { - this(arg, false); - } - - public PpUpItem(Properties of, boolean max) { - super(of); - } - -// @Override -// public InteractionResult interact(PixelmonEntity pixelmonEntity, Player player, ItemStack itemInHand) { -// return InteractionResult.PASS; -// } -} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PrisonBottleItem.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PrisonBottleItem.java deleted file mode 100644 index bae7f13a0..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/PrisonBottleItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item; - -import net.minecraft.world.level.block.Block; - -public class PrisonBottleItem extends BlockItemWithLang { - public PrisonBottleItem(Block block, Properties properties) { - super(block, properties); - } -} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/DoggoImplmentItem.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/DoggoImplmentItem.java deleted file mode 100644 index 509101af9..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/DoggoImplmentItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item.legends; - -import com.cobblemon.mod.common.api.types.ElementalTypes; -import generations.gg.generations.core.generationscore.common.config.SpeciesKey; -import net.minecraft.world.item.Item; - -public class DoggoImplmentItem extends ElementalPostBattleUpdateItemImplImpl { - public DoggoImplmentItem(Item.Properties properties, SpeciesKey key) { - super(properties, "pixelmon.rusty_shield.amountfull", key, ElementalTypes.INSTANCE.getFIGHTING()); - } -} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.java deleted file mode 100644 index 3dfd32065..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item.legends; - -import com.cobblemon.mod.common.api.types.ElementalType; -import com.cobblemon.mod.common.battles.actor.PlayerBattleActor; -import net.minecraft.world.item.ItemStack; - -import java.util.List; - -public class ElementalPostBattleUpdateItemImpl extends ElementalPostBattleUpdateItem { - private final List types; - - public ElementalPostBattleUpdateItemImpl(Properties properties, ElementalType... types) { - super(properties); - this.types = List.of(types); - } - - @Override - public boolean checkType(PlayerBattleActor actor, ItemStack stack, ElementalType type) { - return types.contains(type); - } -} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.kt new file mode 100644 index 000000000..2fdb0bcdc --- /dev/null +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImpl.kt @@ -0,0 +1,14 @@ +package generations.gg.generations.core.generationscore.common.world.item.legends + +import com.cobblemon.mod.common.api.types.ElementalType +import com.cobblemon.mod.common.battles.actor.PlayerBattleActor +import net.minecraft.world.item.ItemStack + +open class ElementalPostBattleUpdateItemImpl(properties: Properties?, private val types: List) : + ElementalPostBattleUpdateItem(properties) { + constructor(properties: Properties?, type: ElementalType) : this(properties, java.util.List.of(type)) + + override fun checkType(actor: PlayerBattleActor, stack: ItemStack, type: ElementalType): Boolean { + return types.contains(type) + } +} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.java deleted file mode 100644 index 422467ba6..000000000 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package generations.gg.generations.core.generationscore.common.world.item.legends; - -import com.cobblemon.mod.common.api.types.ElementalType; -import generations.gg.generations.core.generationscore.common.config.SpeciesKey; -import generations.gg.generations.core.generationscore.common.world.entity.block.PokemonUtil; -import net.minecraft.network.chat.Component; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import org.jetbrains.annotations.NotNull; - -public class ElementalPostBattleUpdateItemImplImpl extends ElementalPostBattleUpdateItemImpl { - public static final String DEFAULT_LANG_KEY = "generations_core.orb.amountfull"; - - private final String lang; - private final SpeciesKey key; - - public ElementalPostBattleUpdateItemImplImpl(Properties properties, SpeciesKey key, ElementalType... types) { - this(properties, DEFAULT_LANG_KEY, key, types); - } - - - public ElementalPostBattleUpdateItemImplImpl(Properties properties, String lang, SpeciesKey key, ElementalType... types) { - super(properties, types); - this.lang = lang; - this.key = key; - } - - @Override - public @NotNull InteractionResultHolder use(Level level, Player player, @NotNull InteractionHand usedHand) { - var stack = player.getItemInHand(usedHand); - - if (!level.isClientSide()) { - int damage = stack.getDamageValue(); - - if (damage >= getMaxDamage()) { - stack.shrink(1); - PokemonUtil.spawn(key.createProperties(70), level, player.getOnPos()); - postSpawn(level, player, usedHand); - } else { - player.displayClientMessage(Component.translatable(lang, getMaxDamage() - damage), true); - } - - return InteractionResultHolder.success(stack); - } - - return InteractionResultHolder.pass(stack); - } - - protected void postSpawn(Level level, Player player, InteractionHand usedHand) { - } -} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.kt new file mode 100644 index 000000000..3777bb7b3 --- /dev/null +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/legends/ElementalPostBattleUpdateItemImplImpl.kt @@ -0,0 +1,49 @@ +package generations.gg.generations.core.generationscore.common.world.item.legends + +import com.cobblemon.mod.common.api.types.ElementalType +import generations.gg.generations.core.generationscore.common.config.SpeciesKey +import generations.gg.generations.core.generationscore.common.world.entity.block.PokemonUtil +import net.minecraft.network.chat.Component +import net.minecraft.world.InteractionHand +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.level.Level + +open class ElementalPostBattleUpdateItemImplImpl( + properties: Properties?, + private val lang: String = DEFAULT_LANG_KEY, + private val key: SpeciesKey, + private val itemToGiveUponSpawn : Item? = null, + types: List = listOf() +) : ElementalPostBattleUpdateItemImpl(properties, types) { + + override fun use(level: Level, player: Player, usedHand: InteractionHand): InteractionResultHolder { + val stack = player.getItemInHand(usedHand) + + if (!level.isClientSide()) { + val damage = stack.damageValue + + if (damage >= maxDamage) { + stack.shrink(1) + PokemonUtil.spawn(key.createProperties(70), level, player.onPos) + postSpawn(level, player, usedHand) + } else { + player.displayClientMessage(Component.translatable(lang, maxDamage - damage), true) + } + + return InteractionResultHolder.success(stack) + } + + return InteractionResultHolder.pass(stack) + } + + protected fun postSpawn(level: Level, player: Player, usedHand: InteractionHand) { + itemToGiveUponSpawn?.defaultInstance?.let { player.setItemInHand(usedHand, it) } + } + + companion object { + const val DEFAULT_LANG_KEY: String = "generations_core.orb.amountfull" + } +} diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/FormChangingBlockItem.kt b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/FormChangingBlockItem.kt index ca2bcc242..ee20876b7 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/FormChangingBlockItem.kt +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/FormChangingBlockItem.kt @@ -3,7 +3,8 @@ package generations.gg.generations.core.generationscore.common.world.level.block import generations.gg.generations.core.generationscore.common.world.item.BlockItemWithLang import generations.gg.generations.core.generationscore.common.world.item.FormChanging import generations.gg.generations.core.generationscore.common.world.item.FormChangingToggle +import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.BlockItem import net.minecraft.world.level.block.Block -class FormChangingBlockItem(block: Block, properties: Properties, override val provider: String): BlockItemWithLang(block, properties), FormChangingToggle +class FormChangingBlockItem(block: Block, properties: Properties, override val provider: String, override val species: ResourceLocation? = null): BlockItemWithLang(block, properties), FormChangingToggle diff --git a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/GenerationsShrines.java b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/GenerationsShrines.java index 0d3e2184c..b0a82878f 100644 --- a/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/GenerationsShrines.java +++ b/common/src/main/java/generations/gg/generations/core/generationscore/common/world/level/block/GenerationsShrines.java @@ -70,7 +70,7 @@ protected boolean placeBlock(BlockPlaceContext context, BlockState state) { public static final RegistrySupplier TAPU_SHRINE = registerBlockItem("tapu_shrine", () -> new TapuShrineBlock(SHRINE_PROPERTIES)); public static final RegistrySupplier PRISON_BOTTLE_STEM = registerBlockItem("prison_bottle_stem", () -> new PrisonBottleStemBlock(BOTTLE_PROPERTIES), BlockItemWithLang::new, GenerationsItems.LEGENDARY_ITEMS); - public static final RegistrySupplier PRISON_BOTTLE = registerBlockItem("prison_bottle", () -> new PrisonBottleBlock(BOTTLE_PROPERTIES), (block, properties) -> new FormChangingBlockItem(block, properties, "unbound"), GenerationsItems.LEGENDARY_ITEMS); + public static final RegistrySupplier PRISON_BOTTLE = registerBlockItem("prison_bottle", () -> new PrisonBottleBlock(BOTTLE_PROPERTIES), (block, properties) -> new FormChangingBlockItem(block, properties, "unbound", null), GenerationsItems.LEGENDARY_ITEMS); private static RegistrySupplier registerBlockItem(String name, Supplier blockSupplier, BiFunction function, DeferredRegister register) { diff --git a/common/src/main/resources/assets/generations_core/textures/item/held_items/cornerstone_mask.png b/common/src/main/resources/assets/generations_core/textures/item/held_items/cornerstone_mask.png new file mode 100644 index 0000000000000000000000000000000000000000..777aabb19ea9fcde1d8c6b05a64745988b6ce560 GIT binary patch literal 540 zcmV+%0^|LOP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0kKI$K~y+TeN(?n zLQxbx@6i;94oyns-qM^J5rr-`8sxvAP=OBB){ns;1^pL{u>5Do~mlgeHfgf^3Nz zf~M+rzVq&RJ|z0!`kf!&ci+3$^Bk(4(0_;?l?`~XS#hK=0@tz#RUG7ctxAPr(XRnP zt!$t|ERB`>clVG`GL`a;h!ta&eW(df1^0SA+wnFTg>3LL<2CeYTji2)ZY?j|I&KPU z4ycEmOy0z5X9j#wImEe)xm+^lc12>zIYtdJZz5Xt3@9Q)u%6mg*ukzk^Z-6pp_nb@gx-J`SF26 zqU%sx7}#H&6~^5t<~}@KY&vfL9s34Yi9|vcfLx)m_EqnB`6oI#HGD0*fWKlaXyK6~ zAi(q$*EhK50aMthd$+B?6m~lun+yFfjh<*Vc`XPTrz(+y=0000NS%G}@0G|-oWLx(CN4+jib(|Q<{r~^}3}MkncE)RT^NS%G}r0G|+7K|6cLU0eVE|1Y*=j$A>pn3$NHEsxDgh5wfqKboJ=8DwBRMSf+0 zk41(YP{-6#6Kf#FUlQaO4Ag=I7_Quzu@ET5S>O>_%)r2R7=#&*=dVZs3O0JWIEH8h z+xBqtu^4hV>8}0uxaYh5yM((snJfAQRJ=afpITyi>%E#MbB6d5@7GLTRmuiZmyA8- zZ*pEdH~WsMW{!sGDcvK_0u(y!mThd@DfaDHlyDBqNS%G}}0G|+72G^>Bf&zxlzlV(iBLaV2{5`*veY?t{&uuL2*OZ*PZ}CS> zDZ1IhrS73+na=4w@T<*i39YSaQ7h-IEth_G zxN5&%Ls@t4@xPMC%2!65dG`Kw;hTmd^*QHW_I+bFG&+3W%0Zy`_$=KrE;g$}{~3g4 i*3SHIdtu+TUySq2xuWMf7jFPMkHOQ`&t;ucLK6V0HImH$ literal 0 HcmV?d00001 diff --git a/common/src/main/resources/data/generations_core/species_feature_assignments/ogerpon_mask.json b/common/src/main/resources/data/generations_core/species_feature_assignments/ogerpon_mask.json new file mode 100644 index 000000000..89bfcf9e8 --- /dev/null +++ b/common/src/main/resources/data/generations_core/species_feature_assignments/ogerpon_mask.json @@ -0,0 +1,4 @@ +{ + "pokemon": ["ogerpon"], + "features": ["ogerpon_mask"] +} diff --git a/common/src/main/resources/data/generations_core/species_features/ogerpon_mask.json b/common/src/main/resources/data/generations_core/species_features/ogerpon_mask.json new file mode 100644 index 000000000..90af633a1 --- /dev/null +++ b/common/src/main/resources/data/generations_core/species_features/ogerpon_mask.json @@ -0,0 +1,13 @@ +{ + "type": "choice", + "keys": ["ogerpon_mask"], + "default": "false", + "choices": [ + "teal", + "wellspring", + "heartflame", + "cornerstone" + ], + "isAspect": true, + "aspectFormat": "{{choice}}" +} \ No newline at end of file diff --git a/forge/src/main/java/generations/gg/generations/core/generationscore/forge/datagen/generators/items/ItemDatagen.java b/forge/src/main/java/generations/gg/generations/core/generationscore/forge/datagen/generators/items/ItemDatagen.java index 9ec835795..ee10c2642 100644 --- a/forge/src/main/java/generations/gg/generations/core/generationscore/forge/datagen/generators/items/ItemDatagen.java +++ b/forge/src/main/java/generations/gg/generations/core/generationscore/forge/datagen/generators/items/ItemDatagen.java @@ -258,6 +258,11 @@ protected void registerModels() { createHeldItem(GenerationsItems.BOOSTER_ENERGY.get()); createHeldItem(GenerationsItems.FAIRY_FEATHER.get()); + createHeldItem(GenerationsItems.TEAL_MASK.get()); + createHeldItem(GenerationsItems.HEARTFLAME_MASK.get()); + createHeldItem(GenerationsItems.WELLSPRING_MASK.get()); + createHeldItem(GenerationsItems.CORNERSTONE_MASK.get()); + GenerationsPokeDolls.POKEDOLLS.forEach(ball -> createPokedoll(ball.get())); createItem(GenerationsItems.RELIC_GOLD.get(), "valuables/");