From 0abf81fa38b6eab66a3a3ba4775d94aa48db3d69 Mon Sep 17 00:00:00 2001 From: DavigJ <72636500+davidjjung@users.noreply.github.com> Date: Sat, 20 Jul 2024 10:47:43 +0400 Subject: [PATCH] Update Ant.java - Reordered the code a tiny bit such that stacks shrink *after* the ant spawns item particles while nibbling a food item. This makes it such that feeding an ant from a stack of 1 doesn't spawn the missing resourcelocation magenta/black particles because the itemstack`.shrink()`-ed to Items.AIR --- src/main/java/com/ninni/spawn/entity/Ant.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ninni/spawn/entity/Ant.java b/src/main/java/com/ninni/spawn/entity/Ant.java index 4905141..a4b5071 100644 --- a/src/main/java/com/ninni/spawn/entity/Ant.java +++ b/src/main/java/com/ninni/spawn/entity/Ant.java @@ -209,9 +209,6 @@ public InteractionResult mobInteract(Player player, InteractionHand interactionH if(itemStack.is(Items.HONEY_BOTTLE)) this.spawnAtLocation(Items.GLASS_BOTTLE); if(itemStack.is(Items.MUSHROOM_STEW)) this.spawnAtLocation(Items.BOWL); - if (!player.getAbilities().instabuild) { - itemStack.shrink(1); - } if (this.getHealth() < this.getMaxHealth()) { this.heal(6); } @@ -221,6 +218,9 @@ public InteractionResult mobInteract(Player player, InteractionHand interactionH if (this.level() instanceof ServerLevel serverLevel) { serverLevel.sendParticles(new ItemParticleOption(ParticleTypes.ITEM, itemStack), this.getX(), this.getY(0.6666666666666666), this.getZ(), 10, this.getBbWidth() / 4.0f, this.getBbHeight() / 4.0f, this.getBbWidth() / 4.0f, 0.05); } + if (!player.getAbilities().instabuild) { + itemStack.shrink(1); + } this.playSound(SpawnSoundEvents.ANT_EAT.get()); this.heal(6); return InteractionResult.SUCCESS;