public void flash() { if (EnumPokeballs.getFromIndex(dataWatcher.getWatchableObjectInt(10)) == EnumPokeballs.PremierBall) { worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.2, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX, this.posY + 0.2, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle("reddust", this.posX, this.posY + 0.2, this.posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.2, this.posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.2, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.4, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX, this.posY + 0.4, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle("reddust", this.posX, this.posY + 0.4, this.posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.4, this.posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnParticle( "reddust", this.posX + 0.1, this.posY + 0.4, this.posZ + 0.1, 0.0D, 0.0D, 0.0D); } }
public EnumPokeballs getType() { return EnumPokeballs.getFromIndex(dataWatcher.getWatchableObjectInt(10)); }
@Override protected void onImpact(MovingObjectPosition movingobjectposition) { if (getIsWaiting()) { return; } if (dropItem && breakChance == 1 && EnumPokeballs.getFromIndex(dataWatcher.getWatchableObjectInt(10)) != EnumPokeballs.MasterBall) { worldObj.playSoundAtEntity( this, "random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F); entityDropItem(new ItemStack(Block.stoneButton), 0.0F); entityDropItem(new ItemStack(PixelmonItemsPokeballs.ironBase), 0.0F); entityDropItem(new ItemStack(breakBall()), 0.0F); setDead(); return; } if (isBattleThrown && !worldObj.isRemote) { p = pixelmon; p.hitByPokeball = true; doCaptureCalc(p); setIsWaiting(true); motionX = motionZ = 0; motionY = 0; // } } else if (mode == Mode.full) { if (movingobjectposition != null && !worldObj.isRemote) { if (pixelmon != null) { if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) { if (movingobjectposition.sideHit == 0) // Bottom pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5, movingobjectposition.blockY - 1, movingobjectposition.blockZ + 0.5, rotationYaw, 0.0F); if (movingobjectposition.sideHit == 1) // Top pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5, movingobjectposition.blockY + 1, movingobjectposition.blockZ + 0.5, rotationYaw, 0.0F); if (movingobjectposition.sideHit == 2) // East pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5, movingobjectposition.blockY, movingobjectposition.blockZ + 0.5 - 1, rotationYaw, 0.0F); if (movingobjectposition.sideHit == 3) // West pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5, movingobjectposition.blockY, movingobjectposition.blockZ + 0.5 + 1, rotationYaw, 0.0F); if (movingobjectposition.sideHit == 4) // North pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5 - 1, movingobjectposition.blockY, movingobjectposition.blockZ + 0.5, rotationYaw, 0.0F); if (movingobjectposition.sideHit == 5) // South pixelmon.setLocationAndAngles( movingobjectposition.blockX + 0.5 + 1, movingobjectposition.blockY, movingobjectposition.blockZ + 0.5, rotationYaw, 0.0F); } else { pixelmon.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); } pixelmon.motionX = pixelmon.motionY = pixelmon.motionZ = 0; pixelmon.releaseFromPokeball(); if (movingobjectposition.entityHit != null && (movingobjectposition.entityHit instanceof EntityPixelmon) && !PixelmonStorage.PokeballManager.getPlayerStorage(((EntityPlayerMP) thrower)) .isIn((EntityPixelmon) movingobjectposition.entityHit)) { if (((EntityPixelmon) movingobjectposition.entityHit).battleController != null) { setDead(); return; } BattleParticipant part; if (((EntityPixelmon) movingobjectposition.entityHit).getOwner() != null) part = new PlayerParticipant( (EntityPlayerMP) ((EntityPixelmon) movingobjectposition.entityHit).getOwner(), (EntityPixelmon) movingobjectposition.entityHit); else part = new WildPixelmonParticipant((EntityPixelmon) movingobjectposition.entityHit); pixelmon.StartBattle(new PlayerParticipant((EntityPlayerMP) thrower, pixelmon), part); } else if (movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityTrainer) { if (((EntityTrainer) movingobjectposition.entityHit).releasedPokemon != null && ((EntityTrainer) movingobjectposition.entityHit).releasedPokemon.battleController != null) { setDead(); return; } TrainerParticipant trainer = new TrainerParticipant( (EntityTrainer) movingobjectposition.entityHit, (EntityPlayer) thrower); pixelmon.StartBattle( new PlayerParticipant((EntityPlayerMP) thrower, pixelmon), trainer); } else pixelmon.clearAttackTarget(); if (thrower instanceof EntityPlayer) {} // spawnCaptureParticles(); } setDead(); } } else { if (movingobjectposition != null) { if (movingobjectposition.entityHit != null && (movingobjectposition.entityHit instanceof EntityPixelmon)) { EntityPixelmon entitypixelmon = (EntityPixelmon) movingobjectposition.entityHit; p = entitypixelmon; if (p.battleController != null) { ChatHandler.sendChat( (EntityPlayer) thrower, "You can't catch pokemon who are battling in another battle!"); if (dropItem) { entityDropItem(new ItemStack(getType().getItem()), 0.0F); } setDead(); return; } if (p.getOwner() != null || p.getTrainer() != null) { if (p.getOwner() == thrower) ChatHandler.sendChat( (EntityPlayer) thrower, "You can't catch Pokemon you already own!"); else ChatHandler.sendChat( (EntityPlayer) thrower, "You can't catch other people's Pokemon!"); if (dropItem) { entityDropItem(new ItemStack(getType().getItem()), 0.0F); } setDead(); return; } if (p.hitByPokeball) { if (dropItem) { entityDropItem(new ItemStack(getType().getItem()), 0.0F); } setDead(); return; } p.hitByPokeball = true; doCaptureCalc(p); setIsWaiting(true); motionX = motionZ = 0; motionY = -0.1; } else { Material mat = worldObj.getBlockMaterial( movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); if (!getIsWaiting() && mat != null && mat.isSolid()) { if (dropItem) { entityDropItem(new ItemStack(getType().getItem()), 0.0F); } setDead(); } } } } }