mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Fix armor rendering, start armor abilities
This commit is contained in:
1 parent
541a91432c
commit
c13c8f8050
13 files changed
+803
-75
No files matched your search
@@ -3,23 +3,22 @@ package tconstruct.armor;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.ItemHelper;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
{
|
||||
@@ -56,4 +55,87 @@ public class TinkerArmorEvents
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
//Abilities
|
||||
boolean morphed;
|
||||
boolean morphLoaded = Loader.isModLoaded("Morph");
|
||||
|
||||
@EventHandler
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
System.out.println("Server Tick!");
|
||||
EntityPlayer player = event.player;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (stats.climbWalls)
|
||||
{
|
||||
double motionX = player.posX - player.lastTickPosX;
|
||||
double motionZ = player.posZ - player.lastTickPosZ;
|
||||
double motionY = player.posY - player.lastTickPosY - 0.762;
|
||||
if (motionY > 0.0D && (motionX == 0D || motionZ == 0D))
|
||||
{
|
||||
player.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
//TODO: Proper minimap support
|
||||
/*ItemStack stack = player.inventory.getStackInSlot(8);
|
||||
if (stack != null && stack.getItem() instanceof ItemMap)
|
||||
{
|
||||
stack.getItem().onUpdate(stack, player.worldObj, player, 8, true);
|
||||
}*/
|
||||
if (!player.isPlayerSleeping())
|
||||
{
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable))
|
||||
{
|
||||
if (!morphLoaded || !morphed)
|
||||
PlayerAbilityHelper.setEntitySize(player, 0.6F, 1.8F);
|
||||
}
|
||||
else
|
||||
{
|
||||
NBTTagCompound tag = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
|
||||
int dodge = tag.getInteger("Perfect Dodge");
|
||||
if (dodge > 0)
|
||||
{
|
||||
if (!morphLoaded || !morphed)
|
||||
PlayerAbilityHelper.setEntitySize(player, Math.max(0.15F, 0.6F - (dodge * 0.09f)), 1.8F - (dodge * 0.04f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Abilities */
|
||||
@EventHandler
|
||||
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;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void jumpHeight (LivingJumpEvent event)
|
||||
{
|
||||
ItemStack stack = event.entityLiving.getEquipmentInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof TravelWings)
|
||||
{
|
||||
event.entityLiving.motionY += 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void slimefall (LivingFallEvent event)
|
||||
{
|
||||
ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
|
||||
if (boots != null && boots.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
event.distance /= (1 + sole);
|
||||
event.entityLiving.fallDistance /= (1 + sole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user