Merge branch 'master' into weaponry

This commit is contained in:
Bernhard Bonigl committed 2014-10-10 12:45:10 +02:00
commit 852cecae7b
4 files changed
+47 -5

No files matched your search

@@ -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
@@ -58,10 +58,22 @@ public class TinkerArmorEvents
@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
@@ -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;
@@ -30,6 +29,9 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
public boolean smelteryManual;
public boolean battlesignBonus;
// death-penality
public int derpLevel;
public ArmorExtended armor;
public KnapsackInventory knapsack;
@@ -46,6 +48,8 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
this.knapsack = new KnapsackInventory();
this.knapsack.init(entityplayer);
this.derpLevel = 1;
}
@Override
@@ -58,6 +62,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
tTag.setBoolean("materialManual", this.materialManual);
tTag.setBoolean("smelteryManual", this.smelteryManual);
tTag.setBoolean("battlesignBonus", this.battlesignBonus);
tTag.setInteger("derpLevel", this.derpLevel);
compound.setTag(PROP_NAME, tTag);
}
@@ -72,6 +77,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
this.materialManual = properties.getBoolean("materialManual");
this.smelteryManual = properties.getBoolean("smelteryManual");
this.battlesignBonus = properties.getBoolean("battlesignBonus");
this.derpLevel = properties.getInteger("derpLevel");
}
@Override
@@ -91,6 +97,8 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
this.smelteryManual = stats.smelteryManual;
this.battlesignBonus = stats.battlesignBonus;
this.derpLevel = stats.derpLevel;
if (copyCalc)
{
this.bonusHealth = stats.bonusHealth;
@@ -2,6 +2,7 @@ package tconstruct.tools;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.*;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import java.util.List;
import net.minecraft.entity.*;
@@ -402,6 +403,17 @@ public class TinkerToolEvents
if(difficulty == EnumDifficulty.HARD)
punishment = 10; // hard has 10%
// check if we have to reduce it
// did the player live long enough to receive derp-protection?
// (yes, you receive protection every time you log in. we're that nice.)
int derp = 1;
if(event.entityPlayer.ticksExisted < 60*5*20 ) {
derp = TPlayerStats.get(event.entityPlayer).derpLevel;
if(derp <= 0) derp = 1;
punishment *= derp;
}
boolean damaged = false;
for(EntityItem drop : event.drops)
{
// we're only interested in tools
@@ -414,6 +426,14 @@ public class TinkerToolEvents
dur /= punishment;
AbilityHelper.damageTool(drop.getEntityItem(), dur, event.entityPlayer, true);
damaged = true;
}
if(damaged) {
derp++;
}
// increase derplevel by 1. Minimal derp level is 1.
TPlayerStats.get(event.entityPlayer).derpLevel = derp+1;
}
}