Class EntityHelper

java.lang.Object
vazkii.botania.common.helper.EntityHelper

public class EntityHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.
    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
    static void
    syncItem(net.minecraft.world.entity.item.ItemEntity entity)
    Forces an item entity to resync its item to the client.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.