Started with
Moving on from there
Going to create some entities!
-new Package goat with class Entity_Goat
-new Startup Classes StartupDedicatedServer, StartupClientOnly, StartupCommon
-each with their respective
public static void preInit<classname>() { }
public static void init<classname>() { }
public static void postInit<classname>() { }
Going to base a most of this code on EntitySheep
-Entity_Goat is going to extend EntityAnimal
-create constructor with World input parameter and setSize of Entity_Goat
public Entity_Goat(World worldIn)
{
super(worldIn);
this.setSize(1.2F, 1.7F);
}
-give Entity_Goat ability to createChild which we can use to pass variable from parent to child later on
@Override
public Entity_Goat createChild(EntityAgeable ageable)
{
Entity_Goat entitygoat1 = new Entity_Goat(this.world);
return entitygoat1;
}
-give Entity_Goat attributes, an initialization function and an on first spawn function
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(14.0D);
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D);
}
protected void entityInit()
{
super.entityInit();
}
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
return livingdata;
}
-set up register functions for entity in main mod class
public static int startEntityID;
public static int i;
public static void registerModEntity(Class<? extends Entity> entityClass, String name) {
EntityRegistry.registerModEntity(new ResourceLocation("class:resources"), entityClass, name, ++startEntityID, Ascension.instance, 80, 3, false);
//Unsure about new ResourceLocation("class:resources") -Gotlyfe
logger.info("Registering mod entity " + name + " with ID = " + startEntityID);
}
public static void registerModEntityEgg(Class<? extends Entity> entityClass, String name, int primary, int secondary) {
registerModEntity(entityClass, name);
if (i == 0) {
registerSpawnEgg(name, primary, secondary);
++i;
}
}
public static void registerSpawnEgg(String name, int primary, int secondary) {
}
public static int getUniqueEntityId() {
do {
startEntityID++;
} while (EntityList.getClassFromID(startEntityID) != null);
//EntityList.getStringFromID() No longer exists but .getClassFromID() functions similarly in this case - Gotlyfe
return startEntityID;
}