mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
pull in some armor stuff from 1.6
This commit is contained in:
1 parent
8fdef45de4
commit
86f8a2003f
15 files changed
+198
-20
No files matched your search
@@ -7,6 +7,7 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
@@ -95,6 +96,8 @@ public class TClientEvents
|
||||
//public static int right_height = 39;
|
||||
Random rand = new Random();
|
||||
int updateCounter = 0;
|
||||
|
||||
GameSettings gs = Minecraft.getMinecraft().gameSettings;
|
||||
|
||||
/* HUD */
|
||||
@SubscribeEvent
|
||||
@@ -222,6 +225,10 @@ public class TClientEvents
|
||||
GuiIngameForge.left_height += 10;
|
||||
|
||||
event.setCanceled(true);
|
||||
if (event.type == ElementType.CROSSHAIRS && gs.thirdPersonView != 0)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package tconstruct.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TRepo;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
@@ -12,7 +13,7 @@ public class TClientTickHandler
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
//TControls controlInstance = ((TProxyClient)TConstruct.proxy).controlInstance;
|
||||
TControls controlInstance = ((TProxyClient)TConstruct.proxy).controlInstance;
|
||||
public TClientTickHandler()
|
||||
{
|
||||
}
|
||||
@@ -26,8 +27,8 @@ public class TClientTickHandler
|
||||
TRepo.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TRepo.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
/*if (mc.thePlayer != null && !mc.thePlayer.isAirBorne)
|
||||
controlInstance.landOnGround();*/
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround)
|
||||
controlInstance.landOnGround();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.potion.Potion;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.client.event.EventCloakRender;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
@@ -24,7 +25,7 @@ public class TControls extends TKeyHandler
|
||||
static Minecraft mc;
|
||||
|
||||
boolean jumping;
|
||||
boolean doubleJump = true;
|
||||
int midairJumps = 0;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
boolean onStilts = false;
|
||||
@@ -64,17 +65,13 @@ public class TControls extends TKeyHandler
|
||||
{
|
||||
EventCloakRender.instance.refreshCapes();
|
||||
}
|
||||
/*if (kb == jumpKey) //Double jump
|
||||
if (kb == jumpKey) //Double jump
|
||||
{
|
||||
if (mc.thePlayer.capabilities.isCreativeMode)
|
||||
return;
|
||||
|
||||
if (jumping && !doubleJump)
|
||||
if (jumping && midairJumps >0)
|
||||
{
|
||||
System.out.println("Jump!");
|
||||
//if (player == null)
|
||||
//player = mc.thePlayer;
|
||||
|
||||
mc.thePlayer.motionY = 0.42D;
|
||||
mc.thePlayer.fallDistance = 0;
|
||||
|
||||
@@ -83,13 +80,13 @@ public class TControls extends TKeyHandler
|
||||
mc.thePlayer.motionY += (double) ((float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);
|
||||
}
|
||||
|
||||
doubleJump = true;
|
||||
resetFallDamage(mc.thePlayer.username);
|
||||
midairJumps --;
|
||||
resetFallDamage(mc.thePlayer.getDisplayName());
|
||||
}
|
||||
|
||||
if (!jumping)
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
/*else if (kb == stiltsKey) //Stilts
|
||||
{
|
||||
@@ -118,13 +115,13 @@ public class TControls extends TKeyHandler
|
||||
|
||||
public void landOnGround ()
|
||||
{
|
||||
doubleJump = false;
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
}
|
||||
|
||||
public void resetControls ()
|
||||
{
|
||||
doubleJump = false;
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
climbing = false;
|
||||
onGround = false;
|
||||
|
||||
@@ -88,6 +88,20 @@ public class CraftingStationGui extends GuiContainer
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation18") + tags.getInteger("Modifiers"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "ModifierTip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
fontRendererObj.drawString("- " + tipName, xSize + 8, base + (offset + tipNum) * 10, 0xffffff);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
|
||||
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
|
||||
|
||||
@@ -88,6 +88,7 @@ import tconstruct.library.crafting.Smeltery;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import tconstruct.modifiers.armor.AModDamageBoost;
|
||||
import tconstruct.modifiers.armor.AModDoubleJump;
|
||||
import tconstruct.modifiers.armor.AModHealthBoost;
|
||||
import tconstruct.modifiers.armor.AModKnockbackResistance;
|
||||
import tconstruct.modifiers.armor.AModMoveSpeed;
|
||||
@@ -399,6 +400,8 @@ public class TRecipes
|
||||
tb.registerArmorMod(new AModDamageBoost(4, chest, new ItemStack[] { new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1 }, true, 5, 1));
|
||||
tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(TRepo.largePlate, 1, 2) }, new int[] { 2 }));
|
||||
|
||||
tb.registerArmorMod(new AModDoubleJump(new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TRepo.slimeGel, 1, 0), new ItemStack(TRepo.slimeGel, 1, 1) }));
|
||||
|
||||
TConstructRegistry.registerActiveToolMod(new TActiveOmniMod());
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,24 @@ public class ExoArmor extends ArmorCore
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double protection = tag.getDouble("protection");
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double protection = tags.getDouble("protection");
|
||||
if (protection > 0)
|
||||
list.add("\u00a7aProtection: " + protection + "%");
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
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<EnumArmorPart> 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)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
return tags.getInteger("Modifiers") >= modifyCount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-3
@@ -1,12 +1,10 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public abstract class ArmorModTypeFilter extends ArmorMod
|
||||
{
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.AModInteger;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModDoubleJump extends AModInteger
|
||||
{
|
||||
public AModDoubleJump(ItemStack[] items)
|
||||
{
|
||||
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", "Double-Jump");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
return tags.getInteger("Modifiers") >= modifyCount && tags.getInteger("Double-Jump") < 3;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
tipNum++;
|
||||
String tip = "Tooltip" + tipNum;
|
||||
if (!tags.hasKey(tip))
|
||||
{
|
||||
tags.setString(tip, tooltip);
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tags.setString(modTip, modifierTip);
|
||||
return tipNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
String tag = tags.getString(tip);
|
||||
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump"))
|
||||
{
|
||||
tags.setString(tip, getProperName(tooltip, tag));
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
return tipNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProperName (String tooltip, String tag)
|
||||
{
|
||||
if (tag.contains("Double-Jump"))
|
||||
return color+"Triple-Jump";
|
||||
|
||||
if (tag.contains("Triple-Jump"))
|
||||
return color+"Quadruple-Jump";
|
||||
|
||||
return color+"Double-Jump";
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
public class AModJumpBoost
|
||||
{
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModMoveSpeed extends ArmorModTypeFilter
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModProtection extends ArmorModTypeFilter
|
||||
|
||||
Reference in new issue
Block a user