Skip to content

Commit

Permalink
Fix 1-Up tag
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Jan 5, 2025
1 parent 5d8779d commit fb972b1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/wenxin2/marioverse/init/TagRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ public class TagRegistry {
public static final TagKey<Item> QUESTION_BLOCK_ITEM_BLACKLIST = itemTags("question_block_blacklist");
public static final TagKey<Item> WARP_PIPE_ITEMS = itemTags("warp_pipes");

public static final TagKey<EntityType<?>> CANNOT_CONSUME_ONE_UPS = entityTypeTags("cannot_consume_one_ups");
public static final TagKey<EntityType<?>> CANNOT_CONSUME_POWER_UPS = entityTypeTags("cannot_consume_power_ups");
public static final TagKey<EntityType<?>> CANNOT_DROP_COINS = entityTypeTags("cannot_drop_coins");
public static final TagKey<EntityType<?>> CANNOT_LOSE_POWER_UP = entityTypeTags("cannot_lose_power_up");
public static final TagKey<EntityType<?>> CANNOT_QUICK_TRAVEL = entityTypeTags("cannot_quick_travel");
public static final TagKey<EntityType<?>> CANNOT_WARP = entityTypeTags("cannot_warp");
public static final TagKey<EntityType<?>> CAN_BE_INSTAKILL_STOMPED = entityTypeTags("can_be_instakill_stomped");
public static final TagKey<EntityType<?>> CAN_BE_STOMPED = entityTypeTags("can_be_stomped");
public static final TagKey<EntityType<?>> CAN_BONK_BLOCKS = entityTypeTags("can_bonk_blocks");
public static final TagKey<EntityType<?>> CAN_CONSUME_FIRE_FLOWERS = entityTypeTags("can_consume_fire_flowers");
public static final TagKey<EntityType<?>> CAN_CONSUME_ONE_UPS = entityTypeTags("can_consume_one_ups");
public static final TagKey<EntityType<?>> CAN_CONSUME_SUPER_STARS = entityTypeTags("can_consume_super_stars");
public static final TagKey<EntityType<?>> CAN_BONK_BLOCKS = entityTypeTags("can_bonk_blocks");
public static final TagKey<EntityType<?>> CAN_HIT_QUESTION_BLOCKS = entityTypeTags("can_hit_question_blocks");
public static final TagKey<EntityType<?>> CAN_LOWER_FLAGS = entityTypeTags("can_lower_flags");
public static final TagKey<EntityType<?>> CAN_SMASH_BLOCKS = entityTypeTags("can_smash_blocks");
Expand All @@ -66,6 +66,7 @@ public class TagRegistry {
public static final TagKey<EntityType<?>> HEFTY_GOOMBA_CAN_ATTACK = entityTypeTags("hefty_goomba_can_attack");
public static final TagKey<EntityType<?>> MEGA_GOOMBA_CAN_ATTACK = entityTypeTags("mega_goomba_can_attack");
public static final TagKey<EntityType<?>> MINI_GOOMBA_CAN_ATTACH = entityTypeTags("mini_goomba_can_attach");
public static final TagKey<EntityType<?>> PIRANHA_PLANT_CAN_ATTACK = entityTypeTags("piranha_plant_can_attack");
public static final TagKey<EntityType<?>> POWER_UP_ENTITIES = entityTypeTags("power_ups");
public static final TagKey<EntityType<?>> QUESTION_BLOCK_CANNOT_SPAWN = entityTypeTags("question_block_cannot_spawn");
public static final TagKey<EntityType<?>> DECORATED_POT_CANNOT_SPAWN = entityTypeTags("decorated_pot_cannot_spawn");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"_comment": "Tag for entities that can use a 1-Up",
"replace": false,
"values": [
"minecraft:player",
"minecraft:villager"
]
}

This file was deleted.

0 comments on commit fb972b1

Please sign in to comment.