From 5fbe0f1fb9925da260bbd183093a465e870696e8 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 15 Dec 2022 09:15:26 +0000 Subject: [PATCH] Add a natural decay to corruption --- .../unicopia/entity/player/PlayerPhysics.java | 1 - .../unicopia/entity/player/Pony.java | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index 8faf14e1..c42fb0db 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -24,7 +24,6 @@ import net.minecraft.entity.EntityPose; import net.minecraft.entity.EntityType; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LightningEntity; -import net.minecraft.entity.attribute.EntityAttributeInstance; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java index 1a075486..0f01ccda 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java @@ -407,6 +407,25 @@ public class Pony extends Living implements Copyable, Update this.hasShades = hasShades; } + if (!isClient() && !UItems.ALICORN_AMULET.isApplicable(entity)) { + if (entity.age % (10 * ItemTracker.SECONDS) == 0) { + if (entity.world.random.nextInt(100) == 0) { + corruption.add(-1); + setDirty(); + } + + if (entity.getHealth() >= entity.getMaxHealth() - 1 && !entity.getHungerManager().isNotFull()) { + corruption.add(-entity.world.random.nextInt(4)); + setDirty(); + } + } + + if (entity.hurtTime == 1) { + corruption.add(1); + setDirty(); + } + } + tickers.forEach(Tickable::tick); super.tick();