E
- The entity typepublic final class EntityEntryBuilder<E extends Entity>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
EntityEntryBuilder.BuiltEntityEntry |
(package private) static class |
EntityEntryBuilder.ConstructorFactory<E extends Entity> |
class |
EntityEntryBuilder.Spawn |
Modifier and Type | Field and Description |
---|---|
private boolean |
eggProvided |
private java.lang.Class<? extends E> |
entity |
private StatBase |
entityKilledByStatistic |
private java.util.function.Function<World,E> |
factory |
private ResourceLocation |
id |
private StatBase |
killEntityStatistic |
private ModContainer |
mod |
private java.lang.String |
name |
private int |
network |
private int |
primaryEggColor |
private int |
secondaryEggColor |
private java.util.Collection<EntityEntryBuilder.Spawn> |
spawns |
private boolean |
statisticsRegistered |
private int |
trackingRange |
private int |
trackingUpdateFrequency |
private boolean |
trackingVelocityUpdates |
Modifier | Constructor and Description |
---|---|
private |
EntityEntryBuilder() |
Modifier and Type | Method and Description |
---|---|
EntityEntry |
build()
Create an entity entry based on the data in this builder.
|
static <E extends Entity> |
create()
Creates a new entity entry builder.
|
EntityEntryBuilder<E> |
egg(int primaryColor,
int secondaryColor)
Sets the egg of the entity.
|
EntityEntryBuilder<E> |
entity(java.lang.Class<? extends E> entity)
Sets the class of the entity.
|
EntityEntryBuilder<E> |
factory(java.util.function.Function<World,E> factory)
Sets the factory of the entity.
|
EntityEntryBuilder<E> |
id(ResourceLocation id,
int network)
Sets the id of the entity.
|
EntityEntryBuilder<E> |
id(java.lang.String id,
int network)
Sets the id of the entity.
|
EntityEntryBuilder<E> |
name(java.lang.String name)
Sets the name of the entity.
|
private void |
registerStatistics() |
EntityEntryBuilder<E> |
spawn(EnumCreatureType type,
int weight,
int min,
int max,
Biome... biomes)
Adds a spawn entry.
|
EntityEntryBuilder<E> |
spawn(EnumCreatureType type,
int weight,
int min,
int max,
java.lang.Iterable<Biome> biomes)
Adds a spawn entry.
|
EntityEntryBuilder<E> |
tracker(int range,
int updateFrequency,
boolean sendVelocityUpdates)
Sets entity tracking information.
|
private final ModContainer mod
@Nullable private ResourceLocation id
private int network
@Nullable private java.lang.String name
private int trackingRange
private int trackingUpdateFrequency
private boolean trackingVelocityUpdates
private boolean eggProvided
private int primaryEggColor
private int secondaryEggColor
private boolean statisticsRegistered
@Nullable private StatBase killEntityStatistic
@Nullable private StatBase entityKilledByStatistic
@Nullable private java.util.Collection<EntityEntryBuilder.Spawn> spawns
@Nonnull public static <E extends Entity> EntityEntryBuilder<E> create()
E
- The entity type@Nonnull public final EntityEntryBuilder<E> entity(@Nonnull java.lang.Class<? extends E> entity)
Entities will be constructed using a constructor accepting World
. If you wish
to use your own factory, use factory(Function)
.
entity
- The entity classjava.lang.NullPointerException
- If entity
is null
@Nonnull public final EntityEntryBuilder<E> factory(@Nonnull java.util.function.Function<World,E> factory)
factory
- The entity factoryjava.lang.NullPointerException
- If entity
is null
@Nonnull public final EntityEntryBuilder<E> id(@Nonnull ResourceLocation id, int network)
id
- The entity idnetwork
- The network idjava.lang.NullPointerException
- If id
is null
@Nonnull public final EntityEntryBuilder<E> id(@Nonnull java.lang.String id, int network)
id
- The entity idnetwork
- The network idjava.lang.NullPointerException
- If id
is null
@Nonnull public final EntityEntryBuilder<E> name(@Nonnull java.lang.String name)
name
- The entity namejava.lang.NullPointerException
- If name
is null
@Nonnull public final EntityEntryBuilder<E> tracker(int range, int updateFrequency, boolean sendVelocityUpdates)
range
- The tracking rangeupdateFrequency
- The tracking update frequencysendVelocityUpdates
- If the entity should send velocity updates@Nonnull public final EntityEntryBuilder<E> spawn(@Nonnull EnumCreatureType type, int weight, int min, int max, @Nonnull Biome... biomes)
type
- The creature typeweight
- The spawn entry weightmin
- The minimum spawn countmax
- The maximum spawn countbiomes
- The biomes to add an entry injava.lang.IllegalArgumentException
- If the entity is not a EntityLiving
java.lang.NullPointerException
- If type
is null
java.lang.NullPointerException
- If biomes
is null
@Nonnull public final EntityEntryBuilder<E> spawn(@Nonnull EnumCreatureType type, int weight, int min, int max, @Nonnull java.lang.Iterable<Biome> biomes)
type
- The creature typeweight
- The spawn entry weightmin
- The minimum spawn countmax
- The maximum spawn countbiomes
- The biomes to add an entry injava.lang.IllegalArgumentException
- If the entity is not a EntityLiving
java.lang.NullPointerException
- If type
is null
java.lang.NullPointerException
- If biomes
is null
@Nonnull public final EntityEntryBuilder<E> egg(int primaryColor, int secondaryColor)
primaryColor
- the primary egg colorsecondaryColor
- the secondary egg color@Nonnull public EntityEntry build()
java.lang.IllegalStateException
- If the entity class has not been providedjava.lang.IllegalStateException
- If the entity id has not been providedjava.lang.IllegalStateException
- If the entity name has not been providedjava.lang.IllegalStateException
- If spawns have been provided for a non EntityLiving
ReflectionHelper.UnknownConstructorException
- If a factory
has not been provided
and entity
does not have a constructor accepting World
private void registerStatistics()