Add a natural decay to corruption

This commit is contained in:
Sollace 2022-12-15 09:15:26 +00:00
parent f4579d21f5
commit 5fbe0f1fb9
2 changed files with 19 additions and 1 deletions

View file

@ -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;

View file

@ -407,6 +407,25 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, 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();