Fixed up potions and removed BOPPotionHelper. Closes #268

This commit is contained in:
Adubbz 2014-06-05 06:03:11 +10:00
parent 2a53fb4706
commit 9129d73a9f
6 changed files with 13 additions and 34 deletions

View file

@ -1,20 +0,0 @@
package biomesoplenty.api;
import java.util.HashMap;
import net.minecraft.potion.Potion;
public class BOPPotionHelper
{
public static HashMap<String, Potion> potionList = new HashMap<String, Potion>();
public static void registerPotion(Potion potion, String name)
{
potionList.put(name, potion);
}
public static Potion get(String name)
{
return potionList.get(name);
}
}

View file

@ -9,7 +9,6 @@ import net.minecraft.potion.Potion;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import biomesoplenty.api.BOPPotionHelper;
import biomesoplenty.common.helpers.BOPReflectionHelper; import biomesoplenty.common.helpers.BOPReflectionHelper;
import biomesoplenty.common.potions.PotionParalysis; import biomesoplenty.common.potions.PotionParalysis;
import biomesoplenty.common.potions.PotionPossession; import biomesoplenty.common.potions.PotionPossession;

View file

@ -9,8 +9,8 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World; import net.minecraft.world.World;
import biomesoplenty.api.BOPPotionHelper;
import biomesoplenty.api.content.BOPCItems; import biomesoplenty.api.content.BOPCItems;
import biomesoplenty.api.content.BOPCPotions;
public class EntityPhantom extends EntityMob public class EntityPhantom extends EntityMob
{ {
@ -64,7 +64,7 @@ public class EntityPhantom extends EntityMob
{ {
if (worldObj.difficultySetting != EnumDifficulty.PEACEFUL && worldObj.difficultySetting != EnumDifficulty.EASY) 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));
} }
} }

View file

@ -19,7 +19,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.ClientProxy; import biomesoplenty.ClientProxy;
import biomesoplenty.api.BOPPotionHelper; import biomesoplenty.api.content.BOPCPotions;
public class EntityDart extends EntityArrow public class EntityDart extends EntityArrow
{ {
@ -164,7 +164,7 @@ public class EntityDart extends EntityArrow
if (movingobjectposition.entityHit instanceof EntityLivingBase) 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));
} }
} }

View file

@ -4,7 +4,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraftforge.event.entity.living.EnderTeleportEvent; import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import biomesoplenty.api.BOPPotionHelper; import biomesoplenty.api.content.BOPCPotions;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PotionParalysisEventHandler public class PotionParalysisEventHandler
@ -12,7 +12,7 @@ public class PotionParalysisEventHandler
@SubscribeEvent @SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) public void onEntityUpdate(LivingUpdateEvent event)
{ {
if (event.entityLiving.isPotionActive(BOPPotionHelper.get("paralysis"))) if (event.entityLiving.isPotionActive(BOPCPotions.paralysis))
{ {
EntityLivingBase entity = event.entityLiving; EntityLivingBase entity = event.entityLiving;
@ -30,9 +30,9 @@ public class PotionParalysisEventHandler
((EntityCreeper)entity).setCreeperState(-1); ((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; return;
} }
} }
@ -41,7 +41,7 @@ public class PotionParalysisEventHandler
@SubscribeEvent @SubscribeEvent
public void onEndermanTP(EnderTeleportEvent event) public void onEndermanTP(EnderTeleportEvent event)
{ {
if (event.entityLiving.isPotionActive(BOPPotionHelper.get("paralysis"))) if (event.entityLiving.isPotionActive(BOPCPotions.paralysis))
{ {
event.setCanceled(true); event.setCanceled(true);
} }

View file

@ -4,7 +4,7 @@ import java.util.Random;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import biomesoplenty.api.BOPPotionHelper; import biomesoplenty.api.content.BOPCPotions;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PotionPossessionEventHandler public class PotionPossessionEventHandler
@ -12,7 +12,7 @@ public class PotionPossessionEventHandler
@SubscribeEvent @SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) public void onEntityUpdate(LivingUpdateEvent event)
{ {
if (event.entityLiving.isPotionActive(BOPPotionHelper.get("possession"))) if (event.entityLiving.isPotionActive(BOPCPotions.possession))
{ {
EntityLivingBase entity = event.entityLiving; EntityLivingBase entity = event.entityLiving;
@ -36,9 +36,9 @@ public class PotionPossessionEventHandler
entity.setPosition(posX + randX, posY + randY, posZ + randZ); 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; return;
} }
} }