Functioning flippers

This commit is contained in:
Adubbz 2013-09-14 13:01:18 +10:00
parent 7c40cc2f5a
commit d5d309a676
2 changed files with 50 additions and 0 deletions

View file

@ -16,6 +16,7 @@ import biomesoplenty.handlers.BOPCraftHandler;
import biomesoplenty.handlers.BonemealHandler;
import biomesoplenty.handlers.BreakSpeedHandler;
import biomesoplenty.handlers.EntityEventHandler;
import biomesoplenty.handlers.FlipperMovementEventHandler;
import biomesoplenty.handlers.FluidEventHandler;
import biomesoplenty.handlers.MovementHandler;
import biomesoplenty.handlers.SoundHandler;
@ -104,6 +105,7 @@ public class BiomesOPlenty
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
MinecraftForge.EVENT_BUS.register(new BreakSpeedHandler());
MinecraftForge.EVENT_BUS.register(new MovementHandler());
MinecraftForge.EVENT_BUS.register(new FlipperMovementEventHandler());
//MinecraftForge.EVENT_BUS.register(new AxeChopHandler());
proxy.registerRenderers();

View file

@ -0,0 +1,48 @@
package biomesoplenty.handlers;
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)
{
entity.motionX *= 1.1D;
entity.motionZ *= 1.1D;
}
}
}
if (event.entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)event.entity;
InventoryPlayer inventory = player.inventory;
if (player.isInWater())
{
if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.flippers.get().itemID)
{
player.motionX *= 1.1D;
player.motionZ *= 1.1D;
}
}
}
}
}