Skip to content

Commit

Permalink
Moved steping to server side, and fixed high step effect after removi…
Browse files Browse the repository at this point in the history
…ng the boots
  • Loading branch information
Glassmaker committed Jul 26, 2014
1 parent b4c649c commit 498e0d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
31 changes: 31 additions & 0 deletions src/main/java/tconstruct/armor/ArmorAbilities.java
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.armor.items.TravelGear;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.library.modifier.IModifyable;
import cpw.mods.fml.common.Loader;
Expand All @@ -15,11 +16,16 @@ public class ArmorAbilities
boolean morphed;
boolean morphLoaded = Loader.isModLoaded("Morph");

ItemStack prevFeet;
double prevMotionY;

@SubscribeEvent
public void playerTick (TickEvent.PlayerTickEvent event)
{
EntityPlayer player = event.player;
TPlayerStats stats = TPlayerStats.get(player);

// Wall climb
if (stats.climbWalls)
{
double motionX = player.posX - player.lastTickPosX;
Expand All @@ -30,6 +36,31 @@ public void playerTick (TickEvent.PlayerTickEvent event)
player.fallDistance = 0.0F;
}
}

//Feet changes
ItemStack feet = player.getCurrentArmor(0);
if (feet != null)
{
if (feet.getItem() instanceof IModifyable && !player.isSneaking())
{
NBTTagCompound tag = feet.getTagCompound().getCompoundTag(((IModifyable) feet.getItem()).getBaseTagName());
int sole = tag.getInteger("Slimy Soles");
if (sole > 0)
{
if (!player.isSneaking() && player.onGround && prevMotionY < -0.4)
player.motionY = -prevMotionY * (Math.min(0.99, sole * 0.2));
}
}
prevMotionY = player.motionY;
}
if (feet != prevFeet)
{
if (prevFeet != null && prevFeet.getItem() instanceof TravelGear)
player.stepHeight -= 0.6f;
if (feet != null && feet.getItem() instanceof TravelGear)
player.stepHeight += 0.6f;
prevFeet = feet;
}
//TODO: Proper minimap support
/*ItemStack stack = player.inventory.getStackInSlot(8);
if (stack != null && stack.getItem() instanceof ItemMap)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/tconstruct/armor/ArmorAbilitiesClient.java
Expand Up @@ -43,8 +43,8 @@ public void playerTick (TickEvent.PlayerTickEvent event)
player.fallDistance = 0.0f;
}

//Feet changes
ItemStack feet = player.getCurrentArmor(0);
//Feet changes - moved to server side
/*ItemStack feet = player.getCurrentArmor(0);
if (feet != null)
{
if (feet.getItem() instanceof TravelGear && player.stepHeight < 1.0f)
Expand All @@ -70,7 +70,7 @@ public void playerTick (TickEvent.PlayerTickEvent event)
if (feet != null && feet.getItem() instanceof TravelGear)
player.stepHeight += 0.6f;
prevFeet = feet;
}
}*/

//Legs or wing changes
/*ItemStack legs = player.getCurrentArmor(1);
Expand Down

0 comments on commit 498e0d8

Please sign in to comment.