mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-23 13:40:04 +00:00
Lapis Change
This commit is contained in:
1 parent
d54db4d18a
commit
4fb70de8a8
10 files changed
+210
-119
No files matched your search
@@ -15,14 +15,13 @@ public class ModLapis extends ToolMod
|
||||
{
|
||||
String tooltipName;
|
||||
int increase;
|
||||
int max;
|
||||
int max = 450;
|
||||
|
||||
public ModLapis(ItemStack[] items, int effect, int inc)
|
||||
{
|
||||
super(items, effect, "Lapis");
|
||||
tooltipName = "\u00a79Luck";
|
||||
increase = inc;
|
||||
max = 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,7 +32,7 @@ public class ModLapis extends ToolMod
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + increase <= 100)
|
||||
if (keyPair[0] + increase <= max)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -46,43 +45,104 @@ public class ModLapis extends ToolMod
|
||||
if (!tags.hasKey(key))
|
||||
{
|
||||
tags.setBoolean(key, true);
|
||||
|
||||
String modName = "\u00a79Lapis (0/100)";
|
||||
|
||||
String modName = "\u00a79Lapis (0/450)";
|
||||
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
|
||||
int[] keyPair = new int[] { 0, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
if (tool.getItem() instanceof Weapon)
|
||||
{
|
||||
if (keyPair[0] >= 100)
|
||||
if (keyPair[0] >= 450)
|
||||
addEnchantment(tool, Enchantment.looting, 3);
|
||||
else if (keyPair[0] >= 50)
|
||||
else if (keyPair[0] >= 300)
|
||||
addEnchantment(tool, Enchantment.looting, 2);
|
||||
else if (keyPair[0] >= 20)
|
||||
else if (keyPair[0] >= 100)
|
||||
addEnchantment(tool, Enchantment.looting, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyPair[0] >= 100)
|
||||
if (keyPair[0] >= 450)
|
||||
addEnchantment(tool, Enchantment.fortune, 3);
|
||||
else if (keyPair[0] >= 50)
|
||||
else if (keyPair[0] >= 300)
|
||||
addEnchantment(tool, Enchantment.fortune, 2);
|
||||
else if (keyPair[0] >= 20)
|
||||
else if (keyPair[0] >= 100)
|
||||
addEnchantment(tool, Enchantment.fortune, 1);
|
||||
}
|
||||
|
||||
|
||||
updateModTag(tool, keyPair);
|
||||
}
|
||||
|
||||
public void addEnchantment(ItemStack tool, Enchantment enchant, int level)
|
||||
|
||||
public void midStreamModify (ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] == max)
|
||||
return;
|
||||
|
||||
if (random.nextInt(50) == 0)
|
||||
{
|
||||
keyPair[0] += 1;
|
||||
tags.setIntArray(key, keyPair);
|
||||
updateModTag(tool, keyPair);
|
||||
}
|
||||
|
||||
if (tool.getItem() instanceof Weapon)
|
||||
{
|
||||
if (keyPair[0] >= 350)
|
||||
{
|
||||
int chance = keyPair[0] - 300;
|
||||
if (random.nextInt(1000 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.looting, 3);
|
||||
}
|
||||
else if (keyPair[0] >= 125)
|
||||
{
|
||||
int chance = keyPair[0] - 175;
|
||||
if (random.nextInt(600 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.looting, 2);
|
||||
}
|
||||
else if (keyPair[0] >= 10)
|
||||
{
|
||||
int chance = keyPair[0] - 25;
|
||||
if (random.nextInt(250 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.looting, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyPair[0] >= 350)
|
||||
{
|
||||
int chance = keyPair[0] - 300;
|
||||
if (random.nextInt(1000 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.fortune, 3);
|
||||
}
|
||||
else if (keyPair[0] >= 125)
|
||||
{
|
||||
int chance = keyPair[0] - 175;
|
||||
if (random.nextInt(600 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.fortune, 2);
|
||||
}
|
||||
else if (keyPair[0] >= 10)
|
||||
{
|
||||
int chance = keyPair[0] - 25;
|
||||
if (random.nextInt(250 - chance) == 0)
|
||||
addEnchantment(tool, Enchantment.fortune, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addEnchantment (ItemStack tool, Enchantment enchant, int level)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList("ench");
|
||||
Map enchantMap = EnchantmentHelper.getEnchantments(tool);
|
||||
@@ -93,37 +153,37 @@ public class ModLapis extends ToolMod
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
NBTTagCompound enchantTag = new NBTTagCompound();
|
||||
index = ((Integer)iterator.next()).intValue();
|
||||
index = ((Integer) iterator.next()).intValue();
|
||||
lvl = (Integer) enchantMap.get(index);
|
||||
if (index == enchant.effectId)
|
||||
{
|
||||
hasEnchant = true;
|
||||
enchantTag.setShort("id", (short)index);
|
||||
enchantTag.setShort("lvl", (short)((byte)level));
|
||||
enchantTag.setShort("id", (short) index);
|
||||
enchantTag.setShort("lvl", (short) ((byte) level));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
enchantTag.setShort("id", (short)index);
|
||||
enchantTag.setShort("lvl", (short)((byte)lvl));
|
||||
enchantTag.setShort("id", (short) index);
|
||||
enchantTag.setShort("lvl", (short) ((byte) lvl));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
}
|
||||
if (!hasEnchant)
|
||||
{
|
||||
NBTTagCompound enchantTag = new NBTTagCompound();
|
||||
enchantTag.setShort("id", (short)enchant.effectId);
|
||||
enchantTag.setShort("lvl", (short)((byte)level));
|
||||
enchantTag.setShort("id", (short) enchant.effectId);
|
||||
enchantTag.setShort("lvl", (short) ((byte) level));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
tool.stackTagCompound.setTag("ench", tags);
|
||||
}
|
||||
|
||||
|
||||
void updateModTag (ItemStack tool, int[] keys)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip"+keys[1];
|
||||
String modName = "\u00a79Lapis ("+keys[0]+"/100)";
|
||||
String tip = "ModifierTip" + keys[1];
|
||||
String modName = "\u00a79Lapis (" + keys[0] + "/" + max + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user