Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
Fixed entity types not being completely random on spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Forstride committed Dec 6, 2018
1 parent 07c1dc0 commit 452a9b7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 61 deletions.
14 changes: 2 additions & 12 deletions src/main/java/familiarfauna/entities/EntityButterfly.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,9 @@ public void readEntityFromNBT(NBTTagCompound tagCompund)
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(5);
boolean flag = false;

if (livingdata instanceof EntityButterfly.ButterflyTypeData)
{
i = ((EntityButterfly.ButterflyTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityButterfly.ButterflyTypeData(i);
}
int i = this.world.rand.nextInt(5);

livingdata = new EntityButterfly.ButterflyTypeData(i);
this.setButterflyType(i);

return livingdata;
Expand Down
16 changes: 3 additions & 13 deletions src/main/java/familiarfauna/entities/EntityDeer.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,10 @@ public void onUpdate()
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(2);
int ii = this.rand.nextInt(5);
boolean flag = false;

if (livingdata instanceof EntityDeer.DeerTypeData)
{
i = ((EntityDeer.DeerTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityDeer.DeerTypeData(i);
}
int i = this.world.rand.nextInt(2);
int ii = this.world.rand.nextInt(5);

livingdata = new EntityDeer.DeerTypeData(i);
this.setDeerType(i);

if (ii == 0)
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/familiarfauna/entities/EntityDragonfly.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,9 @@ public void readEntityFromNBT(NBTTagCompound tagCompund)
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(4);
boolean flag = false;

if (livingdata instanceof EntityDragonfly.DragonflyTypeData)
{
i = ((EntityDragonfly.DragonflyTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityDragonfly.DragonflyTypeData(i);
}
int i = this.world.rand.nextInt(4);

livingdata = new EntityDragonfly.DragonflyTypeData(i);
this.setDragonflyType(i);

return livingdata;
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/familiarfauna/entities/EntityPixie.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,9 @@ public void readEntityFromNBT(NBTTagCompound tagCompund)
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(3);
boolean flag = false;

if (livingdata instanceof EntityPixie.PixieTypeData)
{
i = ((EntityPixie.PixieTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityPixie.PixieTypeData(i);
}
int i = this.world.rand.nextInt(3);

livingdata = new EntityPixie.PixieTypeData(i);
this.setPixieType(i);

return livingdata;
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/familiarfauna/entities/EntityTurkey.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,9 @@ public void onUpdate()
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
int i = this.rand.nextInt(2);
boolean flag = false;

if (livingdata instanceof EntityTurkey.TurkeyTypeData)
{
i = ((EntityTurkey.TurkeyTypeData)livingdata).typeData;
flag = true;
}
else
{
livingdata = new EntityTurkey.TurkeyTypeData(i);
}
int i = this.world.rand.nextInt(2);

livingdata = new EntityTurkey.TurkeyTypeData(i);
this.setTurkeyType(i);

return livingdata;
Expand Down

0 comments on commit 452a9b7

Please sign in to comment.