mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 00:47:32 +00:00
Finish armor porting
This commit is contained in:
1 parent
c13c8f8050
commit
2bb35b18e0
10 files changed
+449
-229
No files matched your search
@@ -0,0 +1,59 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class ArmorAbilities
|
||||
{
|
||||
//Abilities
|
||||
boolean morphed;
|
||||
boolean morphLoaded = Loader.isModLoaded("Morph");
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.client.TControls;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class ArmorAbilitiesClient
|
||||
{
|
||||
Minecraft mc;
|
||||
TControls controlInstance;
|
||||
|
||||
ItemStack prevFeet;
|
||||
double prevMotionY;
|
||||
boolean morphed;
|
||||
float prevMouseSensitivity;
|
||||
boolean sprint;
|
||||
|
||||
public ArmorAbilitiesClient(Minecraft mc, TControls p)
|
||||
{
|
||||
this.mc = mc;
|
||||
this.controlInstance = p;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (mc.thePlayer.onGround)
|
||||
{
|
||||
controlInstance.landOnGround();
|
||||
}
|
||||
if (stats.climbWalls && player.isCollidedHorizontally && !player.isSneaking())
|
||||
{
|
||||
player.motionY = 0.1176D;
|
||||
player.fallDistance = 0.0f;
|
||||
}
|
||||
|
||||
//Feet changes
|
||||
ItemStack feet = player.getCurrentArmor(0);
|
||||
if (feet != null)
|
||||
{
|
||||
if (feet.getItem() instanceof TravelGear && player.stepHeight < 1.0f)
|
||||
{
|
||||
player.stepHeight += 0.6f;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
//Legs or wing changes
|
||||
/*ItemStack legs = player.getCurrentArmor(1);
|
||||
if (legs != null && legs.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = legs.getTagCompound().getCompoundTag(((IModifyable) legs.getItem()).getBaseTagName());
|
||||
if (player.isSprinting())
|
||||
{
|
||||
if (!sprint)
|
||||
{
|
||||
sprint = true;
|
||||
int sprintboost = tag.getInteger("Sprint Assist");
|
||||
if (player.isSprinting() && sprintboost > 0)
|
||||
{
|
||||
prevMouseSensitivity = gs.mouseSensitivity;
|
||||
gs.mouseSensitivity *= 1 - (0.15 * sprintboost);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sprint)
|
||||
{
|
||||
sprint = false;
|
||||
gs.mouseSensitivity = prevMouseSensitivity;
|
||||
}
|
||||
}*/
|
||||
if (!player.isPlayerSleeping() && !morphed)
|
||||
{
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable))
|
||||
{
|
||||
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)
|
||||
{
|
||||
PlayerAbilityHelper.setEntitySize(player, Math.max(0.15F, 0.6F - (dodge * 0.09f)), 1.8F - (dodge * 0.04f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayer getPlayer ()
|
||||
{
|
||||
return mc.thePlayer;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package tconstruct.armor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import mantle.lib.client.MantleClientRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
@@ -14,9 +15,10 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -27,7 +29,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.model.BeltModel;
|
||||
import tconstruct.armor.model.BootBump;
|
||||
import tconstruct.armor.model.HiddenPlayerModel;
|
||||
@@ -43,16 +44,16 @@ import tconstruct.client.tabs.InventoryTabVanilla;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.library.accessory.IAccessoryModel;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
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 ArmorProxyClient extends ArmorProxyCommon
|
||||
{
|
||||
@@ -66,8 +67,45 @@ public class ArmorProxyClient extends ArmorProxyCommon
|
||||
public void initialize ()
|
||||
{
|
||||
registerGuiHandler();
|
||||
registerKeys();
|
||||
registerManualRecipes();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
FMLCommonHandler.instance().bus().register(new ArmorAbilitiesClient(mc, controlInstance));
|
||||
}
|
||||
|
||||
private void registerManualRecipes ()
|
||||
{
|
||||
ItemStack feather = new ItemStack(Items.feather);
|
||||
ItemStack redstone = new ItemStack(Items.redstone);
|
||||
ItemStack goggles = new ItemStack(TinkerArmor.travelGoggles);
|
||||
MantleClientRegistry.registerManualIcon("travelgoggles", goggles);
|
||||
TConstructClientRegistry.registerManualModifier("nightvision", goggles.copy(), new ItemStack(Items.flint_and_steel), new ItemStack(Items.potionitem, 1, 8198));
|
||||
|
||||
ItemStack vest = new ItemStack(TinkerArmor.travelVest);
|
||||
MantleClientRegistry.registerManualIcon("travelvest", vest);
|
||||
MantleClientRegistry.registerManualSmallRecipe("dodge", vest.copy(), new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl), new ItemStack(Items.sugar), null);
|
||||
MantleClientRegistry.registerManualSmallRecipe("stealth", vest.copy(), new ItemStack(Blocks.ice), new ItemStack(Items.ender_eye), new ItemStack(Items.potionitem, 1, 8206), null);
|
||||
|
||||
ItemStack wings = new ItemStack(TinkerArmor.travelWings);
|
||||
MantleClientRegistry.registerManualIcon("travelwings", wings);
|
||||
MantleClientRegistry.registerManualSmallRecipe("doublejump", wings.copy(), new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Blocks.piston), null);
|
||||
MantleClientRegistry.registerManualLargeRecipe("featherfall", wings.copy(), new ItemStack(TinkerWorld.slimeGel, 1, 0), feather, feather, feather, wings.copy(), feather, feather, new ItemStack(
|
||||
Items.ender_pearl), feather);
|
||||
|
||||
ItemStack boots = new ItemStack(TinkerArmor.travelBoots);
|
||||
MantleClientRegistry.registerManualIcon("travelboots", boots);
|
||||
MantleClientRegistry.registerManualSmallRecipe("doublejumpboots", boots.copy(), new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Blocks.piston),
|
||||
null);
|
||||
TConstructClientRegistry.registerManualModifier("waterwalk", boots.copy(), new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily));
|
||||
TConstructClientRegistry.registerManualModifier("leadboots", boots.copy(), new ItemStack(Blocks.iron_block));
|
||||
TConstructClientRegistry.registerManualModifier("slimysoles", boots.copy(), new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0));
|
||||
|
||||
ItemStack gloves = new ItemStack(TinkerArmor.travelGlove);
|
||||
MantleClientRegistry.registerManualIcon("travelgloves", gloves);
|
||||
TConstructClientRegistry.registerManualModifier("glovehaste", gloves.copy(), redstone, new ItemStack(Blocks.redstone_block));
|
||||
MantleClientRegistry.registerManualSmallRecipe("gloveclimb", gloves.copy(), new ItemStack(Items.slime_ball), new ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25), null);
|
||||
TConstructClientRegistry.registerManualModifier("gloveknuckles", gloves.copy(), new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +143,6 @@ public class ArmorProxyClient extends ArmorProxyCommon
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(new ArmorTickHandler());
|
||||
new ArmorTickHandler();
|
||||
}
|
||||
|
||||
/* Keybindings */
|
||||
@@ -431,104 +468,4 @@ public class ArmorProxyClient extends ArmorProxyCommon
|
||||
return (float) par1EntityLivingBase.ticksExisted + par2;
|
||||
}
|
||||
|
||||
/* Abilities */
|
||||
|
||||
ItemStack prevFeet;
|
||||
double prevMotionY;
|
||||
boolean morphed;
|
||||
float prevMouseSensitivity;
|
||||
boolean sprint;
|
||||
|
||||
@EventHandler
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
System.out.println("Client Tick!");
|
||||
EntityPlayer player = event.player;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (mc.thePlayer.onGround)
|
||||
{
|
||||
controlInstance.landOnGround();
|
||||
}
|
||||
if (stats.climbWalls && player.isCollidedHorizontally && !player.isSneaking())
|
||||
{
|
||||
player.motionY = 0.1176D;
|
||||
player.fallDistance = 0.0f;
|
||||
}
|
||||
|
||||
//Feet changes
|
||||
ItemStack feet = player.getCurrentArmor(0);
|
||||
if (feet != null)
|
||||
{
|
||||
if (feet.getItem() instanceof TravelGear && player.stepHeight < 1.0f)
|
||||
{
|
||||
player.stepHeight += 0.6f;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
//Legs or wing changes
|
||||
/*ItemStack legs = player.getCurrentArmor(1);
|
||||
if (legs != null && legs.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = legs.getTagCompound().getCompoundTag(((IModifyable) legs.getItem()).getBaseTagName());
|
||||
if (player.isSprinting())
|
||||
{
|
||||
if (!sprint)
|
||||
{
|
||||
sprint = true;
|
||||
int sprintboost = tag.getInteger("Sprint Assist");
|
||||
if (player.isSprinting() && sprintboost > 0)
|
||||
{
|
||||
prevMouseSensitivity = gs.mouseSensitivity;
|
||||
gs.mouseSensitivity *= 1 - (0.15 * sprintboost);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sprint)
|
||||
{
|
||||
sprint = false;
|
||||
gs.mouseSensitivity = prevMouseSensitivity;
|
||||
}
|
||||
}*/
|
||||
if (!player.isPlayerSleeping() && !morphed)
|
||||
{
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable))
|
||||
{
|
||||
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)
|
||||
{
|
||||
PlayerAbilityHelper.setEntitySize(player, Math.max(0.15F, 0.6F - (dodge * 0.09f)), 1.8F - (dodge * 0.04f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayer getPlayer ()
|
||||
{
|
||||
return mc.thePlayer;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mantle.pulsar.pulse.Handler;
|
||||
import mantle.pulsar.pulse.Pulse;
|
||||
import mantle.pulsar.pulse.PulseProxy;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
@@ -29,6 +32,16 @@ import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.modifiers.accessory.GloveClimb;
|
||||
import tconstruct.modifiers.accessory.GloveSpeed;
|
||||
import tconstruct.modifiers.armor.AModBoolean;
|
||||
import tconstruct.modifiers.armor.AModInteger;
|
||||
import tconstruct.modifiers.armor.AModLeadBoots;
|
||||
import tconstruct.modifiers.armor.ActiveTinkerArmor;
|
||||
import tconstruct.modifiers.armor.TravelModDoubleJump;
|
||||
import tconstruct.modifiers.armor.TravelModRepair;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.items.GoldenHead;
|
||||
@@ -75,12 +88,13 @@ public class TinkerArmor
|
||||
public static AccessoryCore travelGlove;
|
||||
public static AccessoryCore travelBelt;
|
||||
|
||||
public static ModAttack modAttackGlove;
|
||||
|
||||
@Handler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
TinkerArmorEvents events = new TinkerArmorEvents();
|
||||
MinecraftForge.EVENT_BUS.register(events);
|
||||
FMLCommonHandler.instance().bus().register(events);
|
||||
MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
|
||||
FMLCommonHandler.instance().bus().register(new ArmorAbilities());
|
||||
|
||||
TinkerArmor.dryingRack = new DryingRack().setBlockName("Armor.DryingRack");
|
||||
GameRegistry.registerBlock(TinkerArmor.dryingRack, "Armor.DryingRack");
|
||||
@@ -209,4 +223,49 @@ public class TinkerArmor
|
||||
// DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5),
|
||||
// 20 * 60 * 10, Item.leather);
|
||||
}
|
||||
|
||||
private void registerModifiers()
|
||||
{
|
||||
ItemStack redstoneItem = new ItemStack(Items.redstone);
|
||||
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
|
||||
//Travel gear modifiers
|
||||
//MultiType
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0),
|
||||
new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 1),
|
||||
new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new TravelModRepair());
|
||||
TConstructRegistry.registerActiveArmorMod(new ActiveTinkerArmor());
|
||||
|
||||
//Head
|
||||
ModifyBuilder.registerModifier(new AModBoolean(0, "Night Vision", EnumSet.of(ArmorPart.Head), new ItemStack[] { new ItemStack(Items.flint_and_steel), new ItemStack(Items.potionitem, 1, 8198) },
|
||||
"\u00a78", "Night Vision"));
|
||||
|
||||
//Chest
|
||||
ModifyBuilder.registerModifier(new AModInteger(0, "Perfect Dodge", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl),
|
||||
new ItemStack(Items.sugar) }, 1, "\u00a7d", "Perfect Dodge"));
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "Stealth", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Blocks.ice), new ItemStack(Items.ender_eye),
|
||||
new ItemStack(Items.potionitem, 1, 8206) }, "\u00a78", "Stealth"));
|
||||
|
||||
//Wings
|
||||
ItemStack feather = new ItemStack(Items.feather);
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Items.ender_pearl), feather,
|
||||
feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Items.ender_pearl), feather,
|
||||
feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
|
||||
//Feet
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "WaterWalk", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily) }, "\u00a79",
|
||||
"Water-Walking"));
|
||||
ModifyBuilder.registerModifier(new AModLeadBoots(new ItemStack[] { new ItemStack(Blocks.iron_block) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(3, "Slimy Soles", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0) }, 1,
|
||||
"\u00a7a", "Slimy Soles"));
|
||||
|
||||
//Glove
|
||||
ModifyBuilder.registerModifier(new GloveSpeed(1, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
|
||||
ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
this.modAttackGlove = new ModAttack("Quartz", 2, new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1, 4 }, 50, 50,
|
||||
"Accessory");
|
||||
ModifyBuilder.registerModifier(this.modAttackGlove);
|
||||
}
|
||||
}
|
||||
@@ -56,55 +56,8 @@ public class TinkerArmorEvents
|
||||
}
|
||||
}
|
||||
|
||||
//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
|
||||
@SubscribeEvent
|
||||
public void armorMineSpeed (net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
TPlayerStats stats = TPlayerStats.get(event.entityPlayer);
|
||||
@@ -113,7 +66,7 @@ public class TinkerArmorEvents
|
||||
event.newSpeed = (event.newSpeed + base) * modifier;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@SubscribeEvent
|
||||
public void jumpHeight (LivingJumpEvent event)
|
||||
{
|
||||
ItemStack stack = event.entityLiving.getEquipmentInSlot(2);
|
||||
@@ -123,7 +76,7 @@ public class TinkerArmorEvents
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@SubscribeEvent
|
||||
public void slimefall (LivingFallEvent event)
|
||||
{
|
||||
ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class AModInteger extends ArmorMod
|
||||
{
|
||||
public final int modifyCount;
|
||||
public final int amount;
|
||||
public final String color;
|
||||
public final String tooltipName;
|
||||
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int count, int increase, String c, String tip)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
this.modifyCount = count;
|
||||
this.amount = increase;
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
Item i = armor.getItem();
|
||||
if (!(i instanceof ArmorCore))
|
||||
return false;
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName(armor));
|
||||
return tags.getInteger("Modifiers") > modifyCount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName(tool));
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int increase = tags.getInteger(key);
|
||||
increase += this.amount;
|
||||
tags.setInteger(key, increase);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags.setInteger(key, amount);
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= modifyCount;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.tools.inventory.ToolForgeContainer;
|
||||
|
||||
/* Simple class for storing items in the block
|
||||
@@ -37,6 +39,66 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
|
||||
|
||||
@Override
|
||||
public void buildTool (String name)
|
||||
{
|
||||
ItemStack output = null;
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
if (inventory[1].getItem() instanceof IModifyable) //Modify item
|
||||
{
|
||||
if (inventory[2] == null && inventory[3] == null && inventory[4] == null)
|
||||
output = inventory[1].copy();
|
||||
else
|
||||
{
|
||||
output = ModifyBuilder.instance.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3], inventory[4] });
|
||||
}
|
||||
}
|
||||
else
|
||||
//Build new item
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
|
||||
if (inventory[0] == null)
|
||||
output = tool;
|
||||
else if (tool != null)
|
||||
{
|
||||
//NBTTagCompound tags = tool.getTagCompound();
|
||||
//if (!tags.getCompoundTag(((IModifyable) tool.getItem()).getBaseTagName()).hasKey("Built"))
|
||||
//{
|
||||
output = tool;
|
||||
//}
|
||||
}
|
||||
}
|
||||
if (!name.equals("")) //Name item
|
||||
{
|
||||
ItemStack temp = inventory[1].copy();
|
||||
if (output != null)
|
||||
temp = output;
|
||||
|
||||
if (temp != null)
|
||||
{
|
||||
NBTTagCompound tags = temp.getTagCompound();
|
||||
if (tags == null)
|
||||
{
|
||||
tags = new NBTTagCompound();
|
||||
temp.setTagCompound(tags);
|
||||
}
|
||||
|
||||
if (!(tags.hasKey("display")))
|
||||
{
|
||||
NBTTagCompound display = new NBTTagCompound();
|
||||
String dName = temp.getItem() instanceof IModifyable ? "\u00A7f" + name : name;
|
||||
display.setString("Name", dName);
|
||||
tags.setTag("display", display);
|
||||
temp.setRepairCost(2);
|
||||
output = temp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
inventory[0] = output;
|
||||
}
|
||||
/*public void buildTool (String name)
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
|
||||
@@ -50,5 +112,5 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
|
||||
inventory[0] = tool;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class SlimePad extends MantleBlock
|
||||
public SlimePad(Material par2Material)
|
||||
{
|
||||
super(par2Material);
|
||||
setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.625F, 0.875F);
|
||||
setBlockBounds(0.125F, 0.0625F, 0.125F, 0.875F, 0.625F, 0.875F);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
|
||||
if (modelID == model)
|
||||
{
|
||||
ItemHelper.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, metadata);
|
||||
renderer.setRenderBounds(0f, 0.0625f, 0f, 1f, 0.5f, 1f);
|
||||
ItemHelper.renderStandardInvBlock(renderer, TinkerWorld.slimeGel, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +31,7 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
|
||||
if (modelID == model)
|
||||
{
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
|
||||
renderer.setRenderBounds(0f, 0, 0f, 1f, 0.5f, 1f);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(((SlimePad) block).getFluidIcon(metadata), ((SlimePad) block).getFluidIcon(metadata), x, y, z, renderer, world);
|
||||
|
||||
|
||||
Reference in new issue
Block a user