package totemic_commons.pokefenn.handler;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import totemic_commons.pokefenn.potion.ModPotions;

public class EntityUpdate
{

    @SubscribeEvent
    public void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
    {

        if(event.getEntityLiving() instanceof EntityPlayer)
        {
            EntityPlayer player = (EntityPlayer) event.getEntityLiving();

            if(player.isPotionActive(ModPotions.batPotion) && !player.capabilities.isCreativeMode
                    && player.isSneaking() && !player.onGround)
            {
                player.moveRelative(0.0F, 0.5F, 0.1F);
            }

            if(player.isPotionActive(ModPotions.spiderPotion))
            {
                climb(player);
            }
        }
    }

    /**
     * @author joshiejack
     */
    private void climb(EntityPlayer player)
    {
        //Code from joshiejack :)
        if(player.isCollidedHorizontally && !player.isOnLadder())
        {
            final float factor = 0.15F;

            if(player.isSneaking())
            {
                player.motionY = 0;
            }
            else
            {
                player.motionX = MathHelper.clamp_double(player.motionX, -factor, factor);
                player.motionY = 0.2;
                player.motionZ = MathHelper.clamp_double(player.motionZ, -factor, factor);

                player.fallDistance = 0.0F;
            }
        }
    }

}

@@ -81,24 +81,66 @@
 tityPlayer;%0A
+import net.minecraft.potion.PotionEffect;%0A
 import net.m
@@ -931,32 +931,440 @@
 )%0A            %7B%0A
+                PotionEffect pot = player.getActivePotionEffect(ModPotions.spiderPotion);%0A                if(pot.getDuration() %3E 10)%0A                %7B%0A                    if(player.isSneaking())%0A                        player.stepHeight = 0.60001F;%0A                    else%0A                        player.stepHeight = 1F;%0A                %7D%0A                else%0A                    player.stepHeight = 0.6F;%0A%0A
                 

Revert "Step height change is obsolete due to autojump"