From 9129d73a9f979697b02f69251c6f0cbfcb25c9b9 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 5 Jun 2014 06:03:11 +1000 Subject: [PATCH] Fixed up potions and removed BOPPotionHelper. Closes #268 --- .../biomesoplenty/api/BOPPotionHelper.java | 20 ------------------- .../biomesoplenty/common/core/BOPPotions.java | 1 - .../common/entities/EntityPhantom.java | 4 ++-- .../entities/projectiles/EntityDart.java | 4 ++-- .../potions/PotionParalysisEventHandler.java | 10 +++++----- .../potions/PotionPossessionEventHandler.java | 8 ++++---- 6 files changed, 13 insertions(+), 34 deletions(-) delete mode 100644 src/main/java/biomesoplenty/api/BOPPotionHelper.java diff --git a/src/main/java/biomesoplenty/api/BOPPotionHelper.java b/src/main/java/biomesoplenty/api/BOPPotionHelper.java deleted file mode 100644 index 96984177c..000000000 --- a/src/main/java/biomesoplenty/api/BOPPotionHelper.java +++ /dev/null @@ -1,20 +0,0 @@ -package biomesoplenty.api; - -import java.util.HashMap; - -import net.minecraft.potion.Potion; - -public class BOPPotionHelper -{ - public static HashMap potionList = new HashMap(); - - public static void registerPotion(Potion potion, String name) - { - potionList.put(name, potion); - } - - public static Potion get(String name) - { - return potionList.get(name); - } -} diff --git a/src/main/java/biomesoplenty/common/core/BOPPotions.java b/src/main/java/biomesoplenty/common/core/BOPPotions.java index f4c5c8f13..96cdc7b07 100644 --- a/src/main/java/biomesoplenty/common/core/BOPPotions.java +++ b/src/main/java/biomesoplenty/common/core/BOPPotions.java @@ -9,7 +9,6 @@ import net.minecraft.potion.Potion; import org.apache.logging.log4j.Level; -import biomesoplenty.api.BOPPotionHelper; import biomesoplenty.common.helpers.BOPReflectionHelper; import biomesoplenty.common.potions.PotionParalysis; import biomesoplenty.common.potions.PotionPossession; diff --git a/src/main/java/biomesoplenty/common/entities/EntityPhantom.java b/src/main/java/biomesoplenty/common/entities/EntityPhantom.java index efc045b42..9085eec05 100644 --- a/src/main/java/biomesoplenty/common/entities/EntityPhantom.java +++ b/src/main/java/biomesoplenty/common/entities/EntityPhantom.java @@ -9,8 +9,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -import biomesoplenty.api.BOPPotionHelper; import biomesoplenty.api.content.BOPCItems; +import biomesoplenty.api.content.BOPCPotions; public class EntityPhantom extends EntityMob { @@ -64,7 +64,7 @@ public class EntityPhantom extends EntityMob { if (worldObj.difficultySetting != EnumDifficulty.PEACEFUL && worldObj.difficultySetting != EnumDifficulty.EASY) { - ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(BOPPotionHelper.get("possession").id, 30, 0)); + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(BOPCPotions.possession.id, 30, 0)); } } diff --git a/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java b/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java index 74d050634..0fc4ef091 100644 --- a/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java +++ b/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java @@ -19,7 +19,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import biomesoplenty.BiomesOPlenty; import biomesoplenty.ClientProxy; -import biomesoplenty.api.BOPPotionHelper; +import biomesoplenty.api.content.BOPCPotions; public class EntityDart extends EntityArrow { @@ -164,7 +164,7 @@ public class EntityDart extends EntityArrow if (movingobjectposition.entityHit instanceof EntityLivingBase) { - ((EntityLivingBase)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(BOPPotionHelper.get("paralysis").id, 100)); + ((EntityLivingBase)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(BOPCPotions.paralysis.id, 100)); } } diff --git a/src/main/java/biomesoplenty/common/eventhandler/potions/PotionParalysisEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/potions/PotionParalysisEventHandler.java index f0c6789cd..5048bc5fa 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/potions/PotionParalysisEventHandler.java +++ b/src/main/java/biomesoplenty/common/eventhandler/potions/PotionParalysisEventHandler.java @@ -4,7 +4,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityCreeper; import net.minecraftforge.event.entity.living.EnderTeleportEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import biomesoplenty.api.BOPPotionHelper; +import biomesoplenty.api.content.BOPCPotions; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PotionParalysisEventHandler @@ -12,7 +12,7 @@ public class PotionParalysisEventHandler @SubscribeEvent public void onEntityUpdate(LivingUpdateEvent event) { - if (event.entityLiving.isPotionActive(BOPPotionHelper.get("paralysis"))) + if (event.entityLiving.isPotionActive(BOPCPotions.paralysis)) { EntityLivingBase entity = event.entityLiving; @@ -30,9 +30,9 @@ public class PotionParalysisEventHandler ((EntityCreeper)entity).setCreeperState(-1); } - if (entity.getActivePotionEffect(BOPPotionHelper.get("paralysis")).getDuration() == 0) + if (entity.getActivePotionEffect(BOPCPotions.paralysis).getDuration() == 0) { - entity.removePotionEffect(BOPPotionHelper.get("paralysis").id); + entity.removePotionEffect(BOPCPotions.paralysis.id); return; } } @@ -41,7 +41,7 @@ public class PotionParalysisEventHandler @SubscribeEvent public void onEndermanTP(EnderTeleportEvent event) { - if (event.entityLiving.isPotionActive(BOPPotionHelper.get("paralysis"))) + if (event.entityLiving.isPotionActive(BOPCPotions.paralysis)) { event.setCanceled(true); } diff --git a/src/main/java/biomesoplenty/common/eventhandler/potions/PotionPossessionEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/potions/PotionPossessionEventHandler.java index 06b271ae3..d7790d639 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/potions/PotionPossessionEventHandler.java +++ b/src/main/java/biomesoplenty/common/eventhandler/potions/PotionPossessionEventHandler.java @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import biomesoplenty.api.BOPPotionHelper; +import biomesoplenty.api.content.BOPCPotions; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PotionPossessionEventHandler @@ -12,7 +12,7 @@ public class PotionPossessionEventHandler @SubscribeEvent public void onEntityUpdate(LivingUpdateEvent event) { - if (event.entityLiving.isPotionActive(BOPPotionHelper.get("possession"))) + if (event.entityLiving.isPotionActive(BOPCPotions.possession)) { EntityLivingBase entity = event.entityLiving; @@ -36,9 +36,9 @@ public class PotionPossessionEventHandler entity.setPosition(posX + randX, posY + randY, posZ + randZ); } - if (entity.getActivePotionEffect(BOPPotionHelper.get("possession")).getDuration() == 0) + if (entity.getActivePotionEffect(BOPCPotions.possession).getDuration() == 0) { - entity.removePotionEffect(BOPPotionHelper.get("possession").id); + entity.removePotionEffect(BOPCPotions.possession.id); return; } }