From fb972b143141753507c94cbf145c06f4da72de32 Mon Sep 17 00:00:00 2001 From: WenXin2 Date: Sun, 5 Jan 2025 16:04:18 -0600 Subject: [PATCH] Fix 1-Up tag --- .../marioverse/entities/power_ups/FireFlowerEntity.java | 1 - .../entities/power_ups/OneUpMushroomEntity.java | 8 +++++--- .../java/com/wenxin2/marioverse/init/TagRegistry.java | 5 +++-- .../marioverse/tags/entity_type/can_consume_one_ups.json | 8 ++++++++ .../tags/entity_type/cannot_consume_one_ups.json | 7 ------- 5 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 src/main/resources/data/marioverse/tags/entity_type/can_consume_one_ups.json delete mode 100644 src/main/resources/data/marioverse/tags/entity_type/cannot_consume_one_ups.json diff --git a/src/main/java/com/wenxin2/marioverse/entities/power_ups/FireFlowerEntity.java b/src/main/java/com/wenxin2/marioverse/entities/power_ups/FireFlowerEntity.java index 963e5e18..6284f223 100644 --- a/src/main/java/com/wenxin2/marioverse/entities/power_ups/FireFlowerEntity.java +++ b/src/main/java/com/wenxin2/marioverse/entities/power_ups/FireFlowerEntity.java @@ -14,7 +14,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.goal.FloatGoal; import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/com/wenxin2/marioverse/entities/power_ups/OneUpMushroomEntity.java b/src/main/java/com/wenxin2/marioverse/entities/power_ups/OneUpMushroomEntity.java index a9d3188b..658f8d21 100644 --- a/src/main/java/com/wenxin2/marioverse/entities/power_ups/OneUpMushroomEntity.java +++ b/src/main/java/com/wenxin2/marioverse/entities/power_ups/OneUpMushroomEntity.java @@ -42,7 +42,8 @@ public void handleCollision(Entity entity) { lastCollisionTime = currentTime; if (entity instanceof Player player && !player.isSpectator() - && !player.getType().is(TagRegistry.DAMAGE_CANNOT_SHRINK)) { + && !player.getType().is(TagRegistry.DAMAGE_CANNOT_SHRINK) + && player.getType().is(TagRegistry.CAN_CONSUME_ONE_UPS)) { AccessoriesCapability capability = AccessoriesCapability.get(player); ItemStack offhandStack = player.getOffhandItem(); @@ -63,8 +64,9 @@ else if (offhandStack.getItem() instanceof OneUpMushroomItem) { this.level().broadcastEntityEvent(player, (byte) 126); // 1-Up Collected particle this.remove(RemovalReason.KILLED); } - } else if (entity instanceof LivingEntity livingEntity && ConfigRegistry.ONE_UP_HEALS_ALL_MOBS.get() - && !entity.getType().is(TagRegistry.DAMAGE_CANNOT_SHRINK)) { + } else if (entity instanceof LivingEntity livingEntity + && !entity.getType().is(TagRegistry.DAMAGE_CANNOT_SHRINK) + && (entity.getType().is(TagRegistry.CAN_CONSUME_ONE_UPS) || ConfigRegistry.ONE_UP_HEALS_ALL_MOBS.get())) { AccessoriesCapability capability = AccessoriesCapability.get(livingEntity); ItemStack offhandStack = livingEntity.getOffhandItem(); diff --git a/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java b/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java index 3920c45a..5f63febf 100644 --- a/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java +++ b/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java @@ -41,7 +41,6 @@ public class TagRegistry { public static final TagKey QUESTION_BLOCK_ITEM_BLACKLIST = itemTags("question_block_blacklist"); public static final TagKey WARP_PIPE_ITEMS = itemTags("warp_pipes"); - public static final TagKey> CANNOT_CONSUME_ONE_UPS = entityTypeTags("cannot_consume_one_ups"); public static final TagKey> CANNOT_CONSUME_POWER_UPS = entityTypeTags("cannot_consume_power_ups"); public static final TagKey> CANNOT_DROP_COINS = entityTypeTags("cannot_drop_coins"); public static final TagKey> CANNOT_LOSE_POWER_UP = entityTypeTags("cannot_lose_power_up"); @@ -49,9 +48,10 @@ public class TagRegistry { public static final TagKey> CANNOT_WARP = entityTypeTags("cannot_warp"); public static final TagKey> CAN_BE_INSTAKILL_STOMPED = entityTypeTags("can_be_instakill_stomped"); public static final TagKey> CAN_BE_STOMPED = entityTypeTags("can_be_stomped"); + public static final TagKey> CAN_BONK_BLOCKS = entityTypeTags("can_bonk_blocks"); public static final TagKey> CAN_CONSUME_FIRE_FLOWERS = entityTypeTags("can_consume_fire_flowers"); + public static final TagKey> CAN_CONSUME_ONE_UPS = entityTypeTags("can_consume_one_ups"); public static final TagKey> CAN_CONSUME_SUPER_STARS = entityTypeTags("can_consume_super_stars"); - public static final TagKey> CAN_BONK_BLOCKS = entityTypeTags("can_bonk_blocks"); public static final TagKey> CAN_HIT_QUESTION_BLOCKS = entityTypeTags("can_hit_question_blocks"); public static final TagKey> CAN_LOWER_FLAGS = entityTypeTags("can_lower_flags"); public static final TagKey> CAN_SMASH_BLOCKS = entityTypeTags("can_smash_blocks"); @@ -66,6 +66,7 @@ public class TagRegistry { public static final TagKey> HEFTY_GOOMBA_CAN_ATTACK = entityTypeTags("hefty_goomba_can_attack"); public static final TagKey> MEGA_GOOMBA_CAN_ATTACK = entityTypeTags("mega_goomba_can_attack"); public static final TagKey> MINI_GOOMBA_CAN_ATTACH = entityTypeTags("mini_goomba_can_attach"); + public static final TagKey> PIRANHA_PLANT_CAN_ATTACK = entityTypeTags("piranha_plant_can_attack"); public static final TagKey> POWER_UP_ENTITIES = entityTypeTags("power_ups"); public static final TagKey> QUESTION_BLOCK_CANNOT_SPAWN = entityTypeTags("question_block_cannot_spawn"); public static final TagKey> DECORATED_POT_CANNOT_SPAWN = entityTypeTags("decorated_pot_cannot_spawn"); diff --git a/src/main/resources/data/marioverse/tags/entity_type/can_consume_one_ups.json b/src/main/resources/data/marioverse/tags/entity_type/can_consume_one_ups.json new file mode 100644 index 00000000..88a69fdb --- /dev/null +++ b/src/main/resources/data/marioverse/tags/entity_type/can_consume_one_ups.json @@ -0,0 +1,8 @@ +{ + "_comment": "Tag for entities that can use a 1-Up", + "replace": false, + "values": [ + "minecraft:player", + "minecraft:villager" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/marioverse/tags/entity_type/cannot_consume_one_ups.json b/src/main/resources/data/marioverse/tags/entity_type/cannot_consume_one_ups.json deleted file mode 100644 index 98d3cdcf..00000000 --- a/src/main/resources/data/marioverse/tags/entity_type/cannot_consume_one_ups.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "_comment": "Blacklist to prevent entities from consuming 1-Ups", - "replace": false, - "values": [ - { "id": "#marioverse:power_ups", "required": false } - ] -} \ No newline at end of file