From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../jewelrycraft/effects/EffectEnderEye.java | 200 +++++++++++++-------- 1 file changed, 122 insertions(+), 78 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java') diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java index 6fcfac6..4f24e8f 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java @@ -37,8 +37,7 @@ public class EffectEnderEye extends ModifierEffects { if (jewelry instanceof ItemRing) { int viewDistance; - if (Minecraft - .getMinecraft().gameSettings.renderDistanceChunks <= 2) { + if (Minecraft.getMinecraft().gameSettings.renderDistanceChunks <= 2) { viewDistance = 10; } else { viewDistance = Minecraft @@ -52,127 +51,167 @@ public class EffectEnderEye extends ModifierEffects { @Override public void onJewelryUnequipped(ItemStack item, Item jewelry) { if (jewelry instanceof ItemRing) - Minecraft.getMinecraft().gameSettings.setOptionFloatValue( - Options.RENDER_DISTANCE, getViewDistance(item)); + Minecraft.getMinecraft().gameSettings + .setOptionFloatValue( + Options.RENDER_DISTANCE, + getViewDistance(item)); } @SuppressWarnings("cast") @Override - public void action(ItemStack item, EntityPlayer player, Item jewelry) { - if (jewelry instanceof ItemEarrings && !player.worldObj.isRemote) { - for (Object e : player.worldObj.getEntitiesWithinAABB( - EntityEnderman.class, - player.boundingBox.expand(100D, 0D, 100D))) { + public void action(ItemStack item, EntityPlayer player, + Item jewelry) { + if (jewelry instanceof ItemEarrings + && !player.worldObj.isRemote) { + for (Object e : player.worldObj + .getEntitiesWithinAABB( + EntityEnderman.class, + player.boundingBox + .expand(100D, 0D, + 100D))) { EntityEnderman enderman = (EntityEnderman) e; - ReflectionHelper.setPrivateValue(EntityEnderman.class, - enderman, -1, "stareTimer", "field_70826_g"); + ReflectionHelper.setPrivateValue( + EntityEnderman.class, + enderman, -1, "stareTimer", + "field_70826_g"); - Vec3 vec3 = player.getLook(1.0F).normalize(); + Vec3 vec3 = player.getLook(1.0F) + .normalize(); Vec3 vec31 = Vec3.createVectorHelper( enderman.posX - player.posX, enderman.boundingBox.minY - + (double) (enderman.height / 2.0F) - - (player.posY - + (double) player.getEyeHeight()), + + (double) (enderman.height + / 2.0F) + - (player.posY + (double) player + .getEyeHeight()), enderman.posZ - player.posZ); double d0 = vec31.lengthVector(); vec31 = vec31.normalize(); double d1 = vec3.dotProduct(vec31); if (d1 > 1.0D - 0.025D / d0 - && player.canEntityBeSeen(enderman)) { + && player.canEntityBeSeen( + enderman)) { // Positive earrings - if (rand.nextInt( - JewelryNBT.numberOfModifiers(item)) == 0) + if (rand.nextInt(JewelryNBT + .numberOfModifiers( + item)) == 0) enderman.setTarget(null); // Negative earrings - if (!player.isPotionActive(Potion.confusion) || player - .getActivePotionEffect(Potion.confusion) - .getDuration() <= 80) - player.addPotionEffect(new PotionEffect( - Potion.confusion.id, 300, - 2 + JewelryNBT.numberOfModifiers(item) - / 4)); + if (!player.isPotionActive( + Potion.confusion) + || player.getActivePotionEffect( + Potion.confusion) + .getDuration() <= 80) + player.addPotionEffect( + new PotionEffect( + Potion.confusion.id, + 300, + 2 + JewelryNBT.numberOfModifiers( + item) + / 4)); } } } // Positive necklace - if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) { + if (jewelry instanceof ItemNecklace + && !player.worldObj.isRemote) { ChunkPosition chunkposition = player.worldObj - .findClosestStructure("Stronghold", (int) player.posX, - (int) player.posY, (int) player.posZ); + .findClosestStructure("Stronghold", + (int) player.posX, + (int) player.posY, + (int) player.posZ); if (chunkposition != null) { Minecraft.getMinecraft().thePlayer.motionX += 0.01D * Math.signum((double) chunkposition.chunkPosX - player.posX) - * (rand.nextInt( - JewelryNBT.numberOfModifiers(item)) == 0 - ? 1 : -1); + * (rand.nextInt(JewelryNBT + .numberOfModifiers( + item)) == 0 ? 1 + : -1); Minecraft.getMinecraft().thePlayer.motionZ += 0.01D * Math.signum((double) chunkposition.chunkPosZ - player.posZ) - * (rand.nextInt( - JewelryNBT.numberOfModifiers(item)) == 0 - ? 1 : -1); + * (rand.nextInt(JewelryNBT + .numberOfModifiers( + item)) == 0 ? 1 + : -1); } } // Positive bracelet - if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote - && player.worldObj.getBiomeGenForCoords((int) player.posX, + if (jewelry instanceof ItemBracelet + && !player.worldObj.isRemote + && player.worldObj.getBiomeGenForCoords( + (int) player.posX, (int) player.posZ) == BiomeGenBase.sky - && (!player.isPotionActive(Potion.moveSpeed) - || player.getActivePotionEffect(Potion.moveSpeed) + && (!player.isPotionActive( + Potion.moveSpeed) + || player.getActivePotionEffect( + Potion.moveSpeed) .getDuration() < 30)) - player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, - 150 - JewelryNBT.numberOfModifiers(item) * 10, - 2 - JewelryNBT.numberOfModifiers(item) / 5)); + player.addPotionEffect(new PotionEffect( + Potion.moveSpeed.id, + 150 - JewelryNBT.numberOfModifiers( + item) * 10, + 2 - JewelryNBT.numberOfModifiers( + item) / 5)); // Negative bracelet - if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote - && rand.nextInt(520 - - JewelryNBT.numberOfModifiers(item) * 20) == 15) - player.setPositionAndUpdate( - player.posX + rand.nextInt(30) - * (rand.nextBoolean() ? -1 : 1), - player.posY, player.posZ + rand.nextInt(30) - * (rand.nextBoolean() ? -1 : 1)); + if (jewelry instanceof ItemBracelet + && !player.worldObj.isRemote + && rand.nextInt(520 - JewelryNBT + .numberOfModifiers(item) + * 20) == 15) + player.setPositionAndUpdate(player.posX + rand + .nextInt(30) + * (rand.nextBoolean() ? -1 : 1), + player.posY, + player.posZ + rand.nextInt(30) + * (rand.nextBoolean() + ? -1 + : 1)); // Negative ring if (jewelry instanceof ItemRing && Minecraft .getMinecraft().gameSettings.renderDistanceChunks != 2.2F - - JewelryNBT.numberOfModifiers(item) * 0.1F) - Minecraft.getMinecraft().gameSettings.setOptionFloatValue( - Options.RENDER_DISTANCE, - 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F); + - JewelryNBT.numberOfModifiers( + item) + * 0.1F) + Minecraft.getMinecraft().gameSettings + .setOptionFloatValue( + Options.RENDER_DISTANCE, + 2.2F - JewelryNBT + .numberOfModifiers( + item) + * 0.1F); // Positive ring if (jewelry instanceof ItemRing && rand.nextInt( - 180 + JewelryNBT.numberOfModifiers(item) * 20) == 12) { - for (int i = (int) player.posX - 2; i <= (int) player.posX + 2; - i++) - for (int j = (int) player.posY - 2; - j <= (int) player.posY + 2; j++) - for (int k = (int) player.posZ - 2; - k <= (int) player.posZ + 2; k++) - if (player.worldObj.getBlock(i, j, - k) instanceof BlockOre) + 180 + JewelryNBT.numberOfModifiers(item) + * 20) == 12) { + for (int i = (int) player.posX + - 2; i <= (int) player.posX + + 2; i++) + for (int j = (int) player.posY + - 2; j <= (int) player.posY + + 2; j++) + for (int k = (int) player.posZ + - 2; k <= (int) player.posZ + + 2; k++) + if (player.worldObj + .getBlock(i, j, k) instanceof BlockOre) player.addChatComponentMessage( new ChatComponentText( EnumChatFormatting.GRAY - + StatCollector - .translateToLocal( - "chatmessage." - + Variables.MODID - + ".effect.endereye.1") + + StatCollector.translateToLocal( + "chatmessage." + Variables.MODID + + ".effect.endereye.1") + " " + player.worldObj - .getBlock(i, j, - k) + .getBlock(i, j, k) .getLocalizedName() + " " - + StatCollector - .translateToLocal( - "chatmessage." - + Variables.MODID - + ".effect.endereye.2"))); + + StatCollector.translateToLocal( + "chatmessage." + Variables.MODID + + ".effect.endereye.2"))); } } @@ -180,12 +219,17 @@ public class EffectEnderEye extends ModifierEffects { public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) { // Negative necklace - if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) - player.addPotionEffect(new PotionEffect(Potion.blindness.id, - 100 + JewelryNBT.numberOfModifiers(item) * 30, 1)); + if (jewelry instanceof ItemNecklace + && !player.worldObj.isRemote) + player.addPotionEffect(new PotionEffect( + Potion.blindness.id, + 100 + JewelryNBT.numberOfModifiers( + item) * 30, + 1)); } - public static void setViewDistance(ItemStack item, int viewDistance) { + public static void setViewDistance(ItemStack item, + int viewDistance) { NBTTagCompound itemStackData; if (item.hasTagCompound()) itemStackData = item.getTagCompound(); -- cgit v1.2.3