Skip to content

Commit

Permalink
Make glove haste actually work.
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 10, 2014
1 parent e3c3fa3 commit 3bb7301
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/main/java/tconstruct/armor/TinkerArmor.java
Expand Up @@ -47,11 +47,13 @@ public class TinkerArmor
// public static Item netherPattern;
public static Block dryingRack;
// Wearables
/*
public static Item heavyHelmet;
public static Item heavyChestplate;
public static Item heavyPants;
public static Item heavyBoots;
public static Item glove;
*/
public static Item knapsack;
public static Item heartCanister;
// Armor - basic
Expand Down
20 changes: 16 additions & 4 deletions src/main/java/tconstruct/armor/TinkerArmorEvents.java
Expand Up @@ -58,10 +58,22 @@ public void onLivingDrop (LivingDropsEvent event)
@SubscribeEvent
public void armorMineSpeed (net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event)
{
TPlayerStats stats = TPlayerStats.get(event.entityPlayer);
float modifier = 1f + stats.mineSpeed / 1000f;
float base = stats.mineSpeed / 250f;
event.newSpeed = (event.newSpeed + base) * modifier;
if(event.entityPlayer == null)
return;

ItemStack glove = TPlayerStats.get(event.entityPlayer).armor.getStackInSlot(1);
if(event.entityPlayer.worldObj.isRemote) // todo: sync extended inventory with clients so this stuff and rendering is done properly...
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
if(glove == null || !glove.hasTagCompound())
return;

// ok, we got a glove. bonus mining speeeeed
NBTTagCompound tags = glove.getTagCompound().getCompoundTag(TinkerArmor.travelGlove.getBaseTagName());
float mineSpeed = tags.getInteger("MiningSpeed");

float modifier = 1f + mineSpeed / 1000f;
float base = mineSpeed / 250f;
event.newSpeed = (event.originalSpeed + base) * modifier;
}

@SubscribeEvent
Expand Down
1 change: 0 additions & 1 deletion src/main/java/tconstruct/armor/player/TPlayerStats.java
Expand Up @@ -20,7 +20,6 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
public int damage;
public int hunger;
public int previousDimension;
public int mineSpeed;

public boolean climbWalls;
public boolean activeGoggles = true;
Expand Down

0 comments on commit 3bb7301

Please sign in to comment.