mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 22:44:23 +00:00
Initial crashless build
This commit is contained in:
1 parent
2f5d798753
commit
1bb3c4cf7b
1162 files changed
+2913
-3311
No files matched your search
@@ -0,0 +1,91 @@
|
||||
package mods.tinker.tconstruct.modifiers;
|
||||
|
||||
import mods.tinker.common.ToolMod;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ModBlaze extends ToolMod
|
||||
{
|
||||
String tooltipName;
|
||||
int increase;
|
||||
int max;
|
||||
|
||||
public ModBlaze(ItemStack[] items, int effect, int inc)
|
||||
{
|
||||
super(items, effect, "Blaze");
|
||||
tooltipName = "\u00a76Fiery";
|
||||
increase = inc;
|
||||
max = 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + increase <= keyPair[1])
|
||||
return true;
|
||||
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
//System.out.println("Moood");
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int[] keyPair = tags.getIntArray(key);
|
||||
if (keyPair[0] == max)
|
||||
{
|
||||
keyPair[0] += increase;
|
||||
keyPair[1] += max;
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
updateModTag(tool, keyPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a76Blaze ("+increase+"/"+max+")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
int fiery = tags.getInteger("Fiery");
|
||||
fiery += (increase);
|
||||
System.out.println("Fiery "+fiery);
|
||||
tags.setInteger("Fiery", fiery);
|
||||
|
||||
}
|
||||
|
||||
void updateModTag(ItemStack tool, int[] keys)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip"+keys[2];
|
||||
String modName = "\u00a76Blaze ("+keys[0]+"/"+keys[1]+")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user