Class EntityCradle

java.lang.Object
com.samsthenerd.inline.utils.EntityCradle
Direct Known Subclasses:
EntTypeCradle, NbtCradle, PlayerCradle

public abstract class EntityCradle extends Object
A fancy entity supplier with serialization.

EntityCradle is generally server safe, although calls to getEntity(World) aren't guaranteed to be.

See Also:
  • Field Details

    • CRADLE_CODEC

      public static final com.mojang.serialization.Codec<EntityCradle> CRADLE_CODEC
  • Constructor Details

    • EntityCradle

      public EntityCradle()
  • Method Details

    • getType

      public abstract EntityCradle.CradleType<?> getType()
    • getEntity

      @Nullable public abstract net.minecraft.entity.Entity getEntity(net.minecraft.world.World world)
      Supplies an entity wrapped by the cradle. This isn't guaranteed to be server-safe.

      Implementations should try to cache their entity if possible.

      Parameters:
      world -
      Returns:
      an entity based on this cradle
    • getId

      public String getId()
      Gets an id representing this entity in some way. This is used for texture caching on glows (and maybe other stuff in the future).
      Returns:
      string that can be used in an identifier/resloc.
    • addCradleType

      public static <T extends EntityCradle.CradleType> T addCradleType(T cradleType)