Skip to content

Commit

Permalink
Traveler's Boots Fix (for #802)
Browse files Browse the repository at this point in the history
Added tracking of players wearing Traveler's Boots and constant setting
of boosted stepHeight.  The former prevents cross-player stepHeight
issues in Multiplayer, and the latter compensates for the resetting of
stepHeight on login and when changing dimension.
  • Loading branch information
tgarr0 committed Aug 7, 2014
1 parent 4a85cd6 commit bd4025d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/java/tconstruct/armor/ArmorAbilities.java
@@ -1,5 +1,8 @@
package tconstruct.armor;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand All @@ -16,7 +19,8 @@ public class ArmorAbilities
boolean morphed;
boolean morphLoaded = Loader.isModLoaded("Morph");

ItemStack prevFeet;
public static List<String> stepBoostedPlayers = new ArrayList();
//ItemStack prevFeet;
double prevMotionY;

@SubscribeEvent
Expand Down Expand Up @@ -53,13 +57,26 @@ public void playerTick (TickEvent.PlayerTickEvent event)
}
prevMotionY = player.motionY;
}
/* Former step height boost handling
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;
}*/
boolean stepBoosted = stepBoostedPlayers.contains(player.getGameProfile().getName());
if(stepBoosted)
player.stepHeight = 1.1f;
if(!stepBoosted && feet!=null && feet.getItem() instanceof TravelGear)
{
stepBoostedPlayers.add(player.getGameProfile().getName());
}
else if(stepBoosted && (feet==null || !(feet.getItem() instanceof TravelGear)))
{
stepBoostedPlayers.remove(player.getGameProfile().getName());
player.stepHeight -= 0.6f;
}
//TODO: Proper minimap support
/*ItemStack stack = player.inventory.getStackInSlot(8);
Expand Down

0 comments on commit bd4025d

Please sign in to comment.