2013-10-16 05:33:43 +00:00
|
|
|
package biomesoplenty.eventhandlers;
|
2013-09-14 03:01:18 +00:00
|
|
|
|
|
|
|
import net.minecraft.entity.EntityLiving;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
|
|
|
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
|
|
|
import biomesoplenty.api.Items;
|
|
|
|
|
|
|
|
public class FlipperMovementEventHandler
|
|
|
|
{
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void onLivingUpdate(LivingUpdateEvent event)
|
|
|
|
{
|
|
|
|
if (event.entity instanceof EntityLiving)
|
|
|
|
{
|
|
|
|
EntityLiving entity = (EntityLiving)event.entity;
|
|
|
|
|
|
|
|
ItemStack itemstack = entity.getCurrentItemOrArmor(1);
|
|
|
|
|
|
|
|
if (entity.isInWater())
|
|
|
|
{
|
|
|
|
if (itemstack != null && itemstack.itemID == Items.flippers.get().itemID)
|
|
|
|
{
|
2013-09-14 03:22:25 +00:00
|
|
|
entity.motionX *= 1.125D;
|
|
|
|
entity.motionY *= 1.1D;
|
|
|
|
entity.motionZ *= 1.125D;
|
2013-09-14 03:01:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event.entity instanceof EntityPlayer)
|
|
|
|
{
|
|
|
|
EntityPlayer player = (EntityPlayer)event.entity;
|
|
|
|
|
|
|
|
InventoryPlayer inventory = player.inventory;
|
|
|
|
|
2013-09-15 01:24:30 +00:00
|
|
|
if (player.isInWater() && !player.capabilities.isFlying)
|
2013-09-14 03:01:18 +00:00
|
|
|
{
|
|
|
|
if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.flippers.get().itemID)
|
|
|
|
{
|
2013-09-14 03:22:25 +00:00
|
|
|
player.motionX *= 1.125D;
|
|
|
|
player.motionY *= 1.1D;
|
|
|
|
player.motionZ *= 1.125D;
|
2013-09-14 03:01:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|