Added Paralysis Potion Effect - currently applied when using poison
darts.
This commit is contained in:
parent
211adb08fe
commit
7da5a98dc5
5 changed files with 61 additions and 1 deletions
|
@ -7,4 +7,5 @@ import com.google.common.base.Optional;
|
||||||
public class Potions
|
public class Potions
|
||||||
{
|
{
|
||||||
public static Optional<? extends Potion> nourishment = Optional.absent();
|
public static Optional<? extends Potion> nourishment = Optional.absent();
|
||||||
|
public static Optional<? extends Potion> paralysis = Optional.absent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import biomesoplenty.api.Potions;
|
import biomesoplenty.api.Potions;
|
||||||
import biomesoplenty.potions.PotionEventHandler;
|
import biomesoplenty.potions.PotionEventHandler;
|
||||||
import biomesoplenty.potions.PotionNourishment;
|
import biomesoplenty.potions.PotionNourishment;
|
||||||
|
import biomesoplenty.potions.PotionParalysis;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
@ -30,11 +31,13 @@ public class BOPPotions
|
||||||
private static void intializePotions()
|
private static void intializePotions()
|
||||||
{
|
{
|
||||||
Potions.nourishment = Optional.of((new PotionNourishment(potionOffset + 0, false, 0)).setPotionName("potion.nourishment"));
|
Potions.nourishment = Optional.of((new PotionNourishment(potionOffset + 0, false, 0)).setPotionName("potion.nourishment"));
|
||||||
|
Potions.paralysis = Optional.of((new PotionParalysis(potionOffset + 1, true, 1052800)).setPotionName("potion.paralysis"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerPotionNames()
|
private static void registerPotionNames()
|
||||||
{
|
{
|
||||||
LanguageRegistry.instance().addStringLocalization("potion.nourishment", "en_US", "Nourishment");
|
LanguageRegistry.instance().addStringLocalization("potion.nourishment", "en_US", "Nourishment");
|
||||||
|
LanguageRegistry.instance().addStringLocalization("potion.paralysis", "en_US", "Paralysis");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void extendPotionsArray()
|
private static void extendPotionsArray()
|
||||||
|
|
|
@ -19,6 +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.Potions;
|
||||||
|
|
||||||
public class EntityDart extends EntityArrow
|
public class EntityDart extends EntityArrow
|
||||||
{
|
{
|
||||||
|
@ -155,7 +156,8 @@ public class EntityDart extends EntityArrow
|
||||||
{
|
{
|
||||||
this.damage = 1;
|
this.damage = 1;
|
||||||
if (movingobjectposition.entityHit instanceof EntityLiving)
|
if (movingobjectposition.entityHit instanceof EntityLiving)
|
||||||
((EntityLiving)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
|
// ((EntityLiving)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
|
||||||
|
((EntityLiving)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potions.paralysis.get().id, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, this.damage))
|
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, this.damage))
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package biomesoplenty.potions;
|
package biomesoplenty.potions;
|
||||||
|
|
||||||
|
import net.minecraft.entity.monster.EntityCreeper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
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.Potions;
|
import biomesoplenty.api.Potions;
|
||||||
|
|
||||||
|
@ -25,5 +27,29 @@ public class PotionEventHandler
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.entityLiving.isPotionActive(Potions.paralysis.get()))
|
||||||
|
{
|
||||||
|
event.entityLiving.motionX = 0.0;
|
||||||
|
if (!event.entityLiving.isAirBorne)
|
||||||
|
event.entityLiving.motionY = 0.0;
|
||||||
|
event.entityLiving.motionZ = 0.0;
|
||||||
|
|
||||||
|
if (event.entityLiving instanceof EntityCreeper)
|
||||||
|
((EntityCreeper)event.entityLiving).setCreeperState(-1);
|
||||||
|
|
||||||
|
if (event.entityLiving.getActivePotionEffect(Potions.paralysis.get()).getDuration() == 0)
|
||||||
|
{
|
||||||
|
event.entityLiving.removePotionEffect(Potions.paralysis.get().id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ForgeSubscribe
|
||||||
|
public void onEndermanTP(EnderTeleportEvent event)
|
||||||
|
{
|
||||||
|
if (event.entityLiving.isPotionActive(Potions.paralysis.get()))
|
||||||
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
28
src/minecraft/biomesoplenty/potions/PotionParalysis.java
Normal file
28
src/minecraft/biomesoplenty/potions/PotionParalysis.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package biomesoplenty.potions;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class PotionParalysis extends Potion
|
||||||
|
{
|
||||||
|
public PotionParalysis(int par1, boolean par2, int par3)
|
||||||
|
{
|
||||||
|
super(par1, par2, par3);
|
||||||
|
this.setIconIndex(1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getStatusIconIndex()
|
||||||
|
{
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture("/mods/BiomesOPlenty/textures/potions/BOPPotionFX.png");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReady(int par1, int par2)
|
||||||
|
{
|
||||||
|
return par1 >= 1;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue