From e4e3d2a72c09eb8f62e6b4ed34dc25299378587d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 4 Mar 2020 14:32:12 +0100 Subject: [PATCH] Fixed the animal effect crashing dedicated servers Closes #86 --- .../de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java index 4a4862cb..b52be297 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -21,6 +21,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import java.util.Comparator; import java.util.List; @@ -83,8 +84,8 @@ public class AnimalEffect implements IDrainSpotEffect { ItemStack stack = item.getItem(); if (!(stack.getItem() instanceof EggItem)) continue; - // The getAge() method is private for absolutely no reason but I want it so I don't care - int age = item.getAge(); + // The getAge() method is client-side only for absolutely no reason but I want it so I don't care + int age = ObfuscationReflectionHelper.getPrivateValue(ItemEntity.class, item, "field_70292_b"); if (age < item.lifespan / 2) continue;