/** Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.provider.isSurfaceWorld() && par5Random.nextInt(2000) < par1World.difficultySetting) { int l; for (l = par3; !par1World.doesBlockHaveSolidTopSurface(par2, l, par4) && l > 0; --l) {; } if (l > 0 && !par1World.isBlockNormalCube(par2, l + 1, par4)) { Entity entity = ItemMonsterPlacer.spawnCreature( par1World, 57, (double) par2 + 0.5D, (double) l + 1.1D, (double) par4 + 0.5D); if (entity != null) { entity.timeUntilPortal = entity.getPortalCooldown(); } } } }
@Override public void executeLogic( World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved) { EnumFacing enumfacing = getFacing(par1World, par2, par3, par4); double d0 = par2 + Math.random() + (double) enumfacing.getFrontOffsetX(); double d1 = (double) ((float) par3 + 0.2F); double d2 = par4 + Math.random() + (double) enumfacing.getFrontOffsetZ(); Entity entity = ItemMonsterPlacer.spawnCreature(par1World, par5ItemStack.getItemDamage(), d0, d1, d2); if (entity instanceof EntityLivingBase && par5ItemStack.hasDisplayName()) { ((EntityLiving) entity).setCustomNameTag(par5ItemStack.getDisplayName()); } }