From e7d6c22fb460081a52a6b55252faa84327ef51d3 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 15 Dec 2022 11:01:00 +0000 Subject: [PATCH] Disable a number of amulet effects when in creative mode --- .../minelittlepony/unicopia/item/AlicornAmuletItem.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java b/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java index 9384111a..daaf2314 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/AlicornAmuletItem.java @@ -89,7 +89,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab public void interactWithPlayer(IItemEntity item, PlayerEntity player) { ItemEntity entity = (ItemEntity)item; - if (!player.world.isClient && !entity.isRemoved()) { + if (!player.world.isClient && !entity.isRemoved() && !player.isCreative()) { if (player.getPos().distanceTo(entity.getPos()) < 0.5) { if (entity.world.random.nextInt(150) == 0) { entity.setPickupDelay(0); @@ -115,6 +115,11 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab @Override public void onUnequipped(Living wearer, long timeWorn) { + + if (wearer.getMaster() instanceof PlayerEntity player && player.isCreative()) { + return; + } + float attachedTime = timeWorn / 100F; LocalDifficulty difficulty = wearer.getReferenceWorld().getLocalDifficulty(wearer.getOrigin()); @@ -188,7 +193,7 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab reserves.getExertion().add(2); } - if (fullSecond && world.random.nextInt(12) == 0) { + if (fullSecond && world.random.nextInt(12) == 0 && !pony.getMaster().isCreative()) { reserves.getEnergy().add(reserves.getEnergy().getMax() / 10F); pony.getCorruption().add((int)MathHelper.clamp(attachedTicks / ItemTracker.HOURS, 1, pony.getCorruption().getMax())); }