diff --git a/src/tconstruct/blocks/MeatBlock.java b/src/tconstruct/blocks/MeatBlock.java index 5865d2bc..40112c4f 100644 --- a/src/tconstruct/blocks/MeatBlock.java +++ b/src/tconstruct/blocks/MeatBlock.java @@ -21,7 +21,7 @@ public class MeatBlock extends Block public MeatBlock(int id) { - super(id, Material.wood); + super(id, Material.sponge); this.setHardness(1.0F); this.setStepSound(Block.soundWoodFootstep); //setBurnProperties(this.blockID, 5, 20); diff --git a/src/tconstruct/client/TClientEvents.java b/src/tconstruct/client/TClientEvents.java index 0cb105b0..67aa121d 100644 --- a/src/tconstruct/client/TClientEvents.java +++ b/src/tconstruct/client/TClientEvents.java @@ -1,31 +1,35 @@ package tconstruct.client; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.relauncher.*; import java.util.Random; -import net.minecraft.block.Block; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.SoundManager; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.*; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeInstance; -import net.minecraft.item.Item; -import net.minecraft.potion.*; -import net.minecraft.util.*; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.Icon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.*; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.fluids.*; import tconstruct.TConstruct; import tconstruct.client.armor.WingModel; import tconstruct.common.TContent; import tconstruct.util.player.TPlayerStats; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class TClientEvents @@ -91,11 +95,13 @@ public class TClientEvents Random rand = new Random(); int updateCounter = 0; + boolean tukmc = Loader.isModLoaded("tukmc_Vz"); + GameSettings gs = Minecraft.getMinecraft().gameSettings; /* HUD */ @ForgeSubscribe public void renderHealthbar (RenderGameOverlayEvent.Pre event) { - if (!Loader.isModLoaded("tukmc_Vz"))// Loader check to avoid conflicting with a GUI mod (thanks Vazkii!) + if (!tukmc)// Loader check to avoid conflicting with a GUI mod (thanks Vazkii!) { if (event.type == ElementType.HEALTH) { @@ -215,9 +221,14 @@ public class TClientEvents GuiIngameForge.left_height += 10; if (absorb > 0) GuiIngameForge.left_height += 10; - + event.setCanceled(true); } + + if (event.type == ElementType.CROSSHAIRS && gs.thirdPersonView != 0) + { + event.setCanceled(true); + } } } diff --git a/src/tconstruct/client/TClientTickHandler.java b/src/tconstruct/client/TClientTickHandler.java index 5bbaed5e..90e28a89 100644 --- a/src/tconstruct/client/TClientTickHandler.java +++ b/src/tconstruct/client/TClientTickHandler.java @@ -4,8 +4,6 @@ import java.util.EnumSet; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.ResourceLocation; import tconstruct.TConstruct; import tconstruct.common.TContent; import cpw.mods.fml.common.ITickHandler; @@ -14,7 +12,7 @@ import cpw.mods.fml.common.TickType; public class TClientTickHandler implements ITickHandler { Minecraft mc = Minecraft.getMinecraft(); - //TControls controlInstance = ((TProxyClient)TConstruct.proxy).controlInstance; + TControls controlInstance = ((TProxyClient)TConstruct.proxy).controlInstance; @Override public void tickEnd (EnumSet type, Object... tickData) @@ -22,8 +20,10 @@ public class TClientTickHandler implements ITickHandler TContent.oreBerry.setGraphicsLevel(Block.leaves.graphicsLevel); TContent.oreBerrySecond.setGraphicsLevel(Block.leaves.graphicsLevel); TContent.slimeLeaves.setGraphicsLevel(Block.leaves.graphicsLevel); - /*if (mc.thePlayer != null && !mc.thePlayer.isAirBorne) - controlInstance.landOnGround();*/ + if (mc.thePlayer != null && mc.thePlayer.onGround) + { + controlInstance.landOnGround(); + } } @Override diff --git a/src/tconstruct/client/TControls.java b/src/tconstruct/client/TControls.java index c3694a42..034f77a0 100644 --- a/src/tconstruct/client/TControls.java +++ b/src/tconstruct/client/TControls.java @@ -8,6 +8,8 @@ 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.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.potion.Potion; import tconstruct.client.event.EventCloakRender; @@ -26,7 +28,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; @@ -72,17 +74,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; @@ -91,31 +89,22 @@ public class TControls extends TKeyHandler mc.thePlayer.motionY += (double) ((float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); } - doubleJump = true; + midairJumps--; resetFallDamage(mc.thePlayer.username); } if (!jumping) + { jumping = mc.thePlayer.isAirBorne; - }*/ + ItemStack shoes = mc.thePlayer.getCurrentArmor(0); + if (shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor")) + { + NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor"); + midairJumps = shoeTag.getInteger("Double-Jump"); + } + } + } } - /*else if (kb == stiltsKey) //Stilts - { - float size = 1.8F; - if (!onStilts) - size = 0.8F; - TConstruct.playerTracker.updateSize(mc.thePlayer.username, size); - onStilts = !onStilts; - //updateServer(mc.thePlayer.username, (byte) 11); - if (onStilts) - { - onStilts = false; - } - else - { - onStilts = true; - } - }*/ } @Override @@ -132,13 +121,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; diff --git a/src/tconstruct/client/gui/CraftingStationGui.java b/src/tconstruct/client/gui/CraftingStationGui.java index bd667fe3..1cc6983f 100644 --- a/src/tconstruct/client/gui/CraftingStationGui.java +++ b/src/tconstruct/client/gui/CraftingStationGui.java @@ -88,6 +88,21 @@ public class CraftingStationGui extends GuiContainer fontRenderer.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); + fontRenderer.drawString("- " + tipName, xSize + 8, base + (offset + tipNum) * 10, 0xffffff); + } + else + displayToolTips = false; + } } void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags) diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index 38694459..fbdba0ca 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -1255,7 +1255,7 @@ public class TContent implements IFuelHandler GameRegistry.addRecipe(new ShapedOreRecipe(chestplateWood, chest, 'w', "logWood")); GameRegistry.addRecipe(new ShapedOreRecipe(leggingsWood, pants, 'w', "logWood")); GameRegistry.addRecipe(new ShapedOreRecipe(bootsWood, shoes, 'w', "logWood")); - + ItemStack exoGoggleStack = new ItemStack(exoGoggles); ItemStack exoChestStack = new ItemStack(exoChest); ItemStack exoPantsStack = new ItemStack(exoPants); @@ -1622,7 +1622,9 @@ public class TContent implements IFuelHandler tb.registerArmorMod(new AModHealthBoost(2, allArmors, new ItemStack[] { new ItemStack(heartCanister, 1, 2) }, new int[] { 2 }, true)); tb.registerArmorMod(new AModDamageBoost(3, allArmors, new ItemStack[] { new ItemStack(Item.diamond), new ItemStack(Block.blockDiamond) }, new int[] { 1, 9 }, false, 3, 0.05)); tb.registerArmorMod(new AModDamageBoost(4, chest, new ItemStack[] { new ItemStack(Block.blockNetherQuartz, 1, Short.MAX_VALUE) }, new int[] { 1 }, true, 5, 1)); - tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(largePlate, 1, 2) }, new int[] { 2 } )); + tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(largePlate, 1, 2) }, new int[] { 2 })); + + tb.registerArmorMod(new AModDoubleJump(new ItemStack[] { new ItemStack(Item.ghastTear), new ItemStack(slimeGel, 1, 0), new ItemStack(slimeGel, 1, 1) })); TConstructRegistry.registerActiveToolMod(new TActiveOmniMod()); } diff --git a/src/tconstruct/items/armor/ExoArmor.java b/src/tconstruct/items/armor/ExoArmor.java index a9af7f50..6f192759 100644 --- a/src/tconstruct/items/armor/ExoArmor.java +++ b/src/tconstruct/items/armor/ExoArmor.java @@ -72,9 +72,25 @@ 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; + } } } diff --git a/src/tconstruct/library/armor/AModInteger.java b/src/tconstruct/library/armor/AModInteger.java new file mode 100644 index 00000000..bbe495fb --- /dev/null +++ b/src/tconstruct/library/armor/AModInteger.java @@ -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 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); + } + +} diff --git a/src/tconstruct/modifiers/armor/ArmorModTypeFilter.java b/src/tconstruct/library/armor/ArmorModTypeFilter.java similarity index 96% rename from src/tconstruct/modifiers/armor/ArmorModTypeFilter.java rename to src/tconstruct/library/armor/ArmorModTypeFilter.java index c7ddc83f..6cf1474b 100644 --- a/src/tconstruct/modifiers/armor/ArmorModTypeFilter.java +++ b/src/tconstruct/library/armor/ArmorModTypeFilter.java @@ -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 { diff --git a/src/tconstruct/modifiers/armor/AModDamageBoost.java b/src/tconstruct/modifiers/armor/AModDamageBoost.java index 92fb1337..3f35574d 100644 --- a/src/tconstruct/modifiers/armor/AModDamageBoost.java +++ b/src/tconstruct/modifiers/armor/AModDamageBoost.java @@ -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 diff --git a/src/tconstruct/modifiers/armor/AModDoubleJump.java b/src/tconstruct/modifiers/armor/AModDoubleJump.java new file mode 100644 index 00000000..ae303951 --- /dev/null +++ b/src/tconstruct/modifiers/armor/AModDoubleJump.java @@ -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"; + } +} diff --git a/src/tconstruct/modifiers/armor/AModHealthBoost.java b/src/tconstruct/modifiers/armor/AModHealthBoost.java index ac49608b..f8ff0bbd 100644 --- a/src/tconstruct/modifiers/armor/AModHealthBoost.java +++ b/src/tconstruct/modifiers/armor/AModHealthBoost.java @@ -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 diff --git a/src/tconstruct/modifiers/armor/AModJumpBoost.java b/src/tconstruct/modifiers/armor/AModJumpBoost.java new file mode 100644 index 00000000..1c5a9172 --- /dev/null +++ b/src/tconstruct/modifiers/armor/AModJumpBoost.java @@ -0,0 +1,6 @@ +package tconstruct.modifiers.armor; + +public class AModJumpBoost +{ + +} diff --git a/src/tconstruct/modifiers/armor/AModKnockbackResistance.java b/src/tconstruct/modifiers/armor/AModKnockbackResistance.java index 6a53a9fc..3fb09056 100644 --- a/src/tconstruct/modifiers/armor/AModKnockbackResistance.java +++ b/src/tconstruct/modifiers/armor/AModKnockbackResistance.java @@ -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 diff --git a/src/tconstruct/modifiers/armor/AModMoveSpeed.java b/src/tconstruct/modifiers/armor/AModMoveSpeed.java index 3b9be565..9c3b8908 100644 --- a/src/tconstruct/modifiers/armor/AModMoveSpeed.java +++ b/src/tconstruct/modifiers/armor/AModMoveSpeed.java @@ -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 diff --git a/src/tconstruct/modifiers/armor/AModProtection.java b/src/tconstruct/modifiers/armor/AModProtection.java index 7dc32eec..2a9853aa 100644 --- a/src/tconstruct/modifiers/armor/AModProtection.java +++ b/src/tconstruct/modifiers/armor/AModProtection.java @@ -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 AModProtection extends ArmorModTypeFilter