From c918a1b6d8008773e9beebb48ba1a770405aee20 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 22 Aug 2019 19:54:41 -0400 Subject: Bulk update back to sanity --- .../java/fyresmodjam/items/ItemMysteryPotion.java | 177 ++++++--------------- 1 file changed, 45 insertions(+), 132 deletions(-) (limited to 'YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java') diff --git a/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java b/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java index 8df424e..febb02a 100755 --- a/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java +++ b/YWD/src/main/java/fyresmodjam/items/ItemMysteryPotion.java @@ -38,12 +38,8 @@ public class ItemMysteryPotion extends Item { icons = new IIcon[26]; for (int i = 0; i < 13; i++) { - icons[i] = par1IconRegister.registerIcon( - "fyresmodjam:mysteryPotion_" - + (i + 1)); - icons[i + 13] = par1IconRegister.registerIcon( - "fyresmodjam:mysteryPotionThrowable_" - + (i + 1)); + icons[i] = par1IconRegister.registerIcon("fyresmodjam:mysteryPotion_" + (i + 1)); + icons[i + 13] = par1IconRegister.registerIcon("fyresmodjam:mysteryPotionThrowable_" + (i + 1)); } itemIcon = icons[0]; @@ -56,8 +52,7 @@ public class ItemMysteryPotion extends Item { } @Override - public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, - List par3List) { + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { for (int i = 0; i < 13; i++) { par3List.add(new ItemStack(par1, 1, i)); } @@ -74,22 +69,14 @@ public class ItemMysteryPotion extends Item { if (damage < 12) { if (Minecraft.getMinecraft().thePlayer != null - && Minecraft.getMinecraft().thePlayer - .getEntityData() - .hasKey("PotionKnowledge")) { - if (Minecraft.getMinecraft().thePlayer - .getEntityData() - .getIntArray("PotionKnowledge")[damage] != -1) { + && Minecraft.getMinecraft().thePlayer.getEntityData().hasKey("PotionKnowledge")) { + if (Minecraft.getMinecraft().thePlayer.getEntityData().getIntArray("PotionKnowledge")[damage] != -1) { Potion potion = Potion.potionTypes[NewPacketHandler.potionValues[damage]]; - name = StatCollector - .translateToLocal( - potion.getName()) - + " Potion"; + name = StatCollector.translateToLocal(potion.getName()) + " Potion"; if (!potion.isInstant()) { int time = NewPacketHandler.potionDurations[damage]; - name += " (" + time - + " seconds)"; + name += " (" + time + " seconds)"; } } } @@ -97,8 +84,7 @@ public class ItemMysteryPotion extends Item { name = "Wildcard Potion"; } - if (FMLCommonHandler.instance().getSide() == Side.CLIENT - && hasBlessing("Alchemist")) { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT && hasBlessing("Alchemist")) { name = "\u00A7k" + name; } @@ -107,49 +93,33 @@ public class ItemMysteryPotion extends Item { @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { - return par1ItemStack.getItemDamage() < 13 - ? EnumAction.drink - : super.getItemUseAction(par1ItemStack); + return par1ItemStack.getItemDamage() < 13 ? EnumAction.drink : super.getItemUseAction(par1ItemStack); } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, - World par2World, EntityPlayer par3EntityPlayer) { + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (par1ItemStack.getItemDamage() < 13) { - par3EntityPlayer.setItemInUse(par1ItemStack, - getMaxItemUseDuration( - par1ItemStack)); + par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); } else { if (!par3EntityPlayer.capabilities.isCreativeMode) { par1ItemStack.stackSize--; } - par2World.playSoundAtEntity(par3EntityPlayer, - "random.bow", 0.5F, - 0.4F / (itemRand.nextFloat() * 0.4F - + 0.8F)); + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, + 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { int value = 0; - if (par1ItemStack.getItemDamage() - % 13 >= 12) { - value = ModjamMod.r.nextInt( - Potion.potionTypes.length); + if (par1ItemStack.getItemDamage() % 13 >= 12) { + value = ModjamMod.r.nextInt(Potion.potionTypes.length); while (Potion.potionTypes[value] == null) { - value = ModjamMod.r - .nextInt(Potion.potionTypes.length); + value = ModjamMod.r.nextInt(Potion.potionTypes.length); } } else { - value = CommonTickHandler.worldData.potionValues[par1ItemStack - .getItemDamage() - % 13]; + value = CommonTickHandler.worldData.potionValues[par1ItemStack.getItemDamage() % 13]; } - par2World.spawnEntityInWorld( - new EntityMysteryPotion( - par2World, - par3EntityPlayer, - par1ItemStack)); + par2World.spawnEntityInWorld(new EntityMysteryPotion(par2World, par3EntityPlayer, par1ItemStack)); } } @@ -158,127 +128,74 @@ public class ItemMysteryPotion extends Item { @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { - return par1ItemStack.getItemDamage() < 13 ? 32 - : super.getMaxItemUseDuration( - par1ItemStack); + return par1ItemStack.getItemDamage() < 13 ? 32 : super.getMaxItemUseDuration(par1ItemStack); } @Override - public ItemStack onEaten(ItemStack par1ItemStack, World par2World, - EntityPlayer par3EntityPlayer) { + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } int damage = par1ItemStack.getItemDamage() % 13; - if (!BlessingUtils.hasBlessing(par3EntityPlayer, - "BlessingAlchemist") && damage < 12) { + if (!BlessingUtils.hasBlessing(par3EntityPlayer, "BlessingAlchemist") && damage < 12) { if (!par2World.isRemote) { int value = CommonTickHandler.worldData.potionValues[damage]; - if (!Potion.potionTypes[value] - .isInstant()) { - par3EntityPlayer.addPotionEffect( - new PotionEffect( - value, - CommonTickHandler.worldData.potionDurations[damage] - * 20, - 1, - false)); + if (!Potion.potionTypes[value].isInstant()) { + par3EntityPlayer.addPotionEffect(new PotionEffect(value, + CommonTickHandler.worldData.potionDurations[damage] * 20, 1, false)); } else { - Potion.potionTypes[value] - .affectEntity(par3EntityPlayer, - par3EntityPlayer, - 1, - 1); + Potion.potionTypes[value].affectEntity(par3EntityPlayer, par3EntityPlayer, 1, 1); } - if (!par3EntityPlayer.getEntityData() - .hasKey("PotionKnowledge")) { - par3EntityPlayer.getEntityData() - .setIntArray("PotionKnowledge", - new int[] { - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1, - -1 - }); + if (!par3EntityPlayer.getEntityData().hasKey("PotionKnowledge")) { + par3EntityPlayer.getEntityData().setIntArray("PotionKnowledge", + new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }); } - if (par3EntityPlayer.getEntityData() - .getIntArray("PotionKnowledge")[damage] == -1) { - par3EntityPlayer.getEntityData() - .getIntArray("PotionKnowledge")[damage] = 1; + if (par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[damage] == -1) { + par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")[damage] = 1; - NewPacketHandler.UPDATE_POTION_KNOWLEDGE - .sendToPlayer(par3EntityPlayer, - par3EntityPlayer.getEntityData() - .getIntArray("PotionKnowledge")); + NewPacketHandler.UPDATE_POTION_KNOWLEDGE.sendToPlayer(par3EntityPlayer, + par3EntityPlayer.getEntityData().getIntArray("PotionKnowledge")); Potion potion = Potion.potionTypes[CommonTickHandler.worldData.potionValues[damage]]; - String name = StatCollector - .translateToLocal( - potion.getName()) - + " Potion"; + String name = StatCollector.translateToLocal(potion.getName()) + " Potion"; if (!potion.isInstant()) { int time = CommonTickHandler.worldData.potionDurations[damage]; - name += " (" + time - + " seconds)"; + name += " (" + time + " seconds)"; } - NewPacketHandler.SEND_MESSAGE - .sendToPlayer(par3EntityPlayer, - "\u00A7oYou learnt Mystery Potion #" - + (damage + 1) - + " was a " - + name - + "!"); + NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer, + "\u00A7oYou learnt Mystery Potion #" + (damage + 1) + " was a " + name + "!"); } } } else if (!par2World.isRemote) { - int value = ModjamMod.r.nextInt( - Potion.potionTypes.length); + int value = ModjamMod.r.nextInt(Potion.potionTypes.length); while (Potion.potionTypes[value] == null) { - value = ModjamMod.r.nextInt( - Potion.potionTypes.length); + value = ModjamMod.r.nextInt(Potion.potionTypes.length); } int time = 5 + ModjamMod.r.nextInt(26); if (!Potion.potionTypes[value].isInstant()) { - par3EntityPlayer.addPotionEffect( - new PotionEffect(value, - time * 20, - 1, false)); + par3EntityPlayer.addPotionEffect(new PotionEffect(value, time * 20, 1, false)); } else { - Potion.potionTypes[value].affectEntity( - par3EntityPlayer, - par3EntityPlayer, 1, 1); + Potion.potionTypes[value].affectEntity(par3EntityPlayer, par3EntityPlayer, 1, 1); } Potion potion = Potion.potionTypes[value]; - String name = StatCollector.translateToLocal( - potion.getName()) + " Potion"; + String name = StatCollector.translateToLocal(potion.getName()) + " Potion"; if (!potion.isInstant()) { name += " (" + time + " seconds)"; } - NewPacketHandler.SEND_MESSAGE.sendToPlayer( - par3EntityPlayer, - "\u00A7oYou drank a " + name - + "."); + NewPacketHandler.SEND_MESSAGE.sendToPlayer(par3EntityPlayer, "\u00A7oYou drank a " + name + "."); } return par1ItemStack; @@ -287,16 +204,12 @@ public class ItemMysteryPotion extends Item { @SideOnly(Side.CLIENT) public boolean hasBlessing(String bless) { return (Minecraft.getMinecraft().thePlayer != null - && BlessingUtils.hasBlessing(Minecraft - .getMinecraft().thePlayer, - bless)); + && BlessingUtils.hasBlessing(Minecraft.getMinecraft().thePlayer, bless)); } @Override - public boolean onItemUse(ItemStack par1ItemStack, - EntityPlayer par2EntityPlayer, World par3World, - int par4, int par5, int par6, int par7, float par8, - float par9, float par10) { + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, + int par5, int par6, int par7, float par8, float par9, float par10) { return false; } -- cgit v1.2.3