Interface IForgeEntity

All Superinterfaces:
ICapabilityProvider, ICapabilitySerializable<CompoundTag>, INBTSerializable<CompoundTag>
All Known Implementing Classes:
AbstractArrow, AbstractChestedHorse, AbstractClientPlayer, AbstractFish, AbstractGolem, AbstractHorse, AbstractHurtingProjectile, AbstractIllager, AbstractMinecart, AbstractMinecartContainer, AbstractPiglin, AbstractSchoolingFish, AbstractSkeleton, AbstractVillager, AgeableMob, AmbientCreature, Animal, AreaEffectCloud, ArmorStand, Arrow, Axolotl, Bat, Bee, Blaze, Boat, Cat, CaveSpider, Chicken, Cod, Cow, Creeper, Dolphin, Donkey, DragonFireball, Drowned, ElderGuardian, EndCrystal, EnderDragon, EnderDragonPart, EnderMan, Endermite, Entity, EntityRendererEventsTest.MyEntity, Evoker, EvokerFangs, ExperienceOrb, EyeOfEnder, FakePlayer, FallingBlockEntity, Fireball, FireworkRocketEntity, FishingHook, FlyingMob, Fox, Ghast, Giant, GlowItemFrame, GlowSquid, Goat, Guardian, HangingEntity, Hoglin, Horse, Husk, Illusioner, IronGolem, ItemEntity, ItemFrame, LargeFireball, LeashFenceKnotEntity, LightningBolt, LivingEntity, Llama, LlamaSpit, LocalPlayer, MagmaCube, Marker, Minecart, MinecartChest, MinecartCommandBlock, MinecartFurnace, MinecartHopper, MinecartSpawner, MinecartTNT, Mob, Monster, Mule, MushroomCow, Ocelot, Painting, Panda, Parrot, PartEntity, PartEntityTest.TestEntity, PartEntityTest.TestEntityPart, PathfinderMob, PatrollingMonster, Phantom, Pig, Piglin, PiglinBrute, Pillager, Player, PolarBear, PrimedTnt, Projectile, Pufferfish, Rabbit, Raider, Ravager, RemotePlayer, Salmon, ServerPlayer, Sheep, ShoulderRidingEntity, Shulker, ShulkerBullet, Silverfish, Skeleton, SkeletonHorse, Slime, SmallFireball, Snowball, SnowGolem, SpectralArrow, SpellcasterIllager, Spider, Squid, Stray, Strider, TamableAnimal, ThrowableItemProjectile, ThrowableProjectile, ThrownEgg, ThrownEnderpearl, ThrownExperienceBottle, ThrownPotion, ThrownTrident, TraderLlama, TropicalFish, Turtle, Vex, Villager, Vindicator, WanderingTrader, WaterAnimal, Witch, WitherBoss, WitherSkeleton, WitherSkull, Wolf, Zoglin, Zombie, ZombieHorse, ZombieVillager, ZombifiedPiglin

public interface IForgeEntity extends ICapabilitySerializable<CompoundTag>
  • Method Details

    • self

      private Entity self()
    • deserializeNBT

      default void deserializeNBT(CompoundTag nbt)
      Specified by:
      deserializeNBT in interface INBTSerializable<CompoundTag>
    • serializeNBT

      default CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface INBTSerializable<CompoundTag>
    • canUpdate

      boolean canUpdate()
    • canUpdate

      void canUpdate(boolean value)
    • captureDrops

      @Nullable Collection<ItemEntity> captureDrops()
    • captureDrops

      Collection<ItemEntity> captureDrops(@Nullable Collection<ItemEntity> captureDrops)
    • getPersistentData

      CompoundTag getPersistentData()
      Returns a NBTTagCompound that can be used to store custom data for this entity. It will be written, and read from disc, so it persists over world saves.
      Returns:
      A NBTTagCompound
    • shouldRiderSit

      default boolean shouldRiderSit()
      Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
      Returns:
      false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
    • getPickedResult

      default ItemStack getPickedResult(HitResult target)
      Called when a user uses the creative pick block button on this entity.
      Parameters:
      target - The full target the player is looking at
      Returns:
      A ItemStack to add to the player's inventory, empty ItemStack if nothing should be added.
    • canRiderInteract

      default boolean canRiderInteract()
      If a rider of this entity can interact with this entity. Should return true on the ridden entity if so.
      Returns:
      if the entity can be interacted with from a rider
    • canBeRiddenInWater

      default boolean canBeRiddenInWater(Entity rider)
      Checks if this entity can continue to be ridden while it is underwater.
      Parameters:
      rider - The entity that is riding this entity
      Returns:
      true if the entity can continue to ride underwater. false otherwise.
    • canTrample

      boolean canTrample(BlockState state, BlockPos pos, float fallDistance)
      Checks if this Entity can trample a Block.
      Parameters:
      pos - The block pos
      fallDistance - The fall distance
      Returns:
      true if this entity can trample, false otherwise
    • getClassification

      default MobCategory getClassification(boolean forSpawnCount)
      Returns The classification of this entity
      Parameters:
      forSpawnCount - If this is being invoked to check spawn count caps.
      Returns:
      If the creature is of the type provided
    • isAddedToWorld

      boolean isAddedToWorld()
      Gets whether this entity has been added to a world (for tracking). Specifically between the times when an entity is added to a world and the entity being removed from the world's tracked lists.
      Returns:
      True if this entity is being tracked by a world
    • onAddedToWorld

      void onAddedToWorld()
      Called after the entity has been added to the world's ticking list. Can be overriden, but needs to call super to prevent MC-136995.
    • onRemovedFromWorld

      void onRemovedFromWorld()
      Called after the entity has been removed to the world's ticking list. Can be overriden, but needs to call super to prevent MC-136995.
    • revive

      void revive()
      Revives an entity that has been removed from a world. Used as replacement for entity.removed = true. Having it as a function allows the entity to react to being revived.
    • isMultipartEntity

      default boolean isMultipartEntity()
      This is used to specify that your entity has multiple individual parts, such as the Vanilla Ender Dragon. See EnderDragon for an example implementation.
      Returns:
      true if this is a multipart entity.
    • getParts

      @Nullable default PartEntity<?>[] getParts()
      Gets the individual sub parts that make up this entity. The entities returned by this method are NOT saved to the world in nay way, they exist as an extension of their host entity. The child entity does not track its server-side(or client-side) counterpart, and the host entity is responsible for moving and managing these children. Only used if isMultipartEntity() returns true. See EnderDragon for an example implementation.
      Returns:
      The child parts of this entity. The value to be returned here should be cached.
    • getStepHeight

      default float getStepHeight()
      Returns:
      Return the height in blocks the Entity can step up without needing to jump This is the sum of vanilla's Entity.maxUpStep field and the current value of the ForgeMod.STEP_HEIGHT_ADDITION attribute (if this Entity is a LivingEntity and has the attribute), clamped at 0.