I'm trying to make a block that spawns an ender dragon when you jump on it and then destorys itself. In its current state, it spawns 2 ender dragons before destroying itself.
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) {
// TODO Auto-generated method stub
if(entityIn instanceof EntityLivingBase) {
EntityDragon test = new EntityDragon(worldIn);
test.setPosition(pos.getX() + 5, pos.getY() + 5, pos.getZ());
worldIn.spawnEntityInWorld(test);
worldIn.setBlockToAir(pos);
}
}