From 1654acc2c9c69786e6997858ea89fb14f4ff172e Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 28 Sep 2023 21:39:59 +0100 Subject: [PATCH] Change interaction events and don't send vibrations when the player is being sneaky --- .../unicopia/entity/mob/AirBalloonEntity.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/mob/AirBalloonEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/mob/AirBalloonEntity.java index 247de5bd..4f1be0e9 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/mob/AirBalloonEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/mob/AirBalloonEntity.java @@ -228,6 +228,7 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp if (isAscending() && age % 15 + rng.nextInt(5) == 0) { playSound(USounds.ENTITY_HOT_AIR_BALLOON_BURNER_FIRE, 0.2F, 1); + getWorld().emitGameEvent(null, GameEvent.FLAP, getBlockPos()); } if (isLeashed()) { @@ -340,7 +341,9 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp } stack.damage(1, player, p -> p.sendToolBreakStatus(hand)); playSound(USounds.Vanilla.ITEM_FLINTANDSTEEL_USE, 1, 1); - getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + if (!player.isSneaky()) { + getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + } return ActionResult.SUCCESS; } @@ -352,7 +355,9 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp } } else if (stack.isEmpty() && isAscending()) { setBoostTicks(50); - getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + if (!player.isSneaky()) { + getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + } } } } @@ -369,7 +374,9 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp stack.decrement(1); } playSound(USounds.ENTITY_HOT_AIR_BALLOON_EQUIP_CANOPY, 1, 1); - getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + if (!player.isSneaky()) { + getWorld().emitGameEvent(player, GameEvent.EQUIP, getBlockPos()); + } setDesign(HotAirBalloonItem.getDesign(getWorld(), stack)); return ActionResult.SUCCESS; } @@ -381,7 +388,9 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp setDesign(BalloonDesign.NONE); dropItem(UItems.GIANT_BALLOON); playSound(USounds.ENTITY_HOT_AIR_BALLOON_EQUIP_CANOPY, 1, 1); - getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + if (!player.isSneaky()) { + getWorld().emitGameEvent(player, GameEvent.EQUIP, getBlockPos()); + } return ActionResult.SUCCESS; } @@ -391,7 +400,9 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp stack.decrement(1); } playSound(USounds.ENTITY_HOT_AIR_BALLOON_EQUIP_BURNER, 0.2F, 1); - getWorld().emitGameEvent(player, GameEvent.ENTITY_INTERACT, getBlockPos()); + if (!player.isSneaky()) { + getWorld().emitGameEvent(player, GameEvent.EQUIP, getBlockPos()); + } return ActionResult.SUCCESS; }