Skip to content

Instantly share code, notes, and snippets.

@TheXFactor117
Created September 10, 2015 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheXFactor117/ff2f23833e49fce16590 to your computer and use it in GitHub Desktop.
Save TheXFactor117/ff2f23833e49fce16590 to your computer and use it in GitHub Desktop.
//used to cool down the mummy spawning
public int coolDown = 100;
public int count = 0;
/**
* Updates every tick the Pharoah is alive. Once the cool
* down has finished, the Pharoah will spawn a mummy at
* its coordinates. The cool down then resets, and will
* tick down again and repeat.
*/
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
if (coolDown > 0)
{
this.coolDown = coolDown - 1;
}
if (count > 1)
{
this.count = count - 1;
}
if ((coolDown < 2) && (!this.worldObj.isRemote))
{
this.count = 60;
this.coolDown = 200;
}
if ((count == 1) && (!this.worldObj.isRemote))
{
EntityMummy mummy = new EntityMummy(this.worldObj);
//spawns the Mummy at the Pharaoh's coordinates
mummy.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rand.nextFloat() * 360, 0.0F);
this.worldObj.spawnEntityInWorld(mummy);
LogHelper.info("The Pharaoh has summoned a mummy!");
this.count = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment