Package vazkii.botania.common.helper
Class EntityHelper
java.lang.Object
vazkii.botania.common.helper.EntityHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddStaticEffect(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int amplifier) Adds an infinite-duration effect to a mob or player.static voidconvertStaticEffectToFinite(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int expectedAmplifier, int duration) Replaces an infinite-duration effect on a mob or player with a finite-duration version of itself.static voidremoveStaticEffect(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int expectedAmplifier) Removes an infinite-duration effect from a mob or player.static voidshrinkItem(net.minecraft.world.entity.item.ItemEntity entity) Shrinks the itemstack in an entity and ensures that the new size is sent to clientsstatic voidsyncItem(net.minecraft.world.entity.item.ItemEntity entity) Forces an item entity to resync its item to the client.
-
Constructor Details
-
EntityHelper
public EntityHelper()
-
-
Method Details
-
shrinkItem
public static void shrinkItem(net.minecraft.world.entity.item.ItemEntity entity) Shrinks the itemstack in an entity and ensures that the new size is sent to clients -
syncItem
public static void syncItem(net.minecraft.world.entity.item.ItemEntity entity) Forces an item entity to resync its item to the client. Entity data only resyncs when the old/new values are not Object.equals(). Since stacks do not implement equals, and we're not changing the actual stack object, the old/new values are == and thus the game doesn't resync. We have to set a dummy value then set it back to tell the game to resync. -
addStaticEffect
public static void addStaticEffect(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int amplifier) Adds an infinite-duration effect to a mob or player. The effect is not applied if the target already has the same effect at a higher level with any duration, or at the same level with infinite duration. -
convertStaticEffectToFinite
public static void convertStaticEffectToFinite(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int expectedAmplifier, int duration) Replaces an infinite-duration effect on a mob or player with a finite-duration version of itself. The effect is only replaced if it has the expected level and infinite duration. -
removeStaticEffect
public static void removeStaticEffect(net.minecraft.world.entity.LivingEntity living, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> mobEffect, int expectedAmplifier) Removes an infinite-duration effect from a mob or player. The effect is only removed if it has the expected level and infinite duration.
-