mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Double Jumps
This commit is contained in:
1 parent
79e46cb381
commit
c8bf021b1d
16 files changed
+227
-53
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<TickType> 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
//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 AModProtection extends ArmorModTypeFilter
|
||||
|
||||
Reference in new issue
Block a user