mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -1,61 +1,49 @@
|
||||
package tconstruct.modifiers.accessory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.modifiers.tools.ItemModTypeFilter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GloveSpeed extends ItemModTypeFilter
|
||||
{
|
||||
public class GloveSpeed extends ItemModTypeFilter {
|
||||
String tooltipName;
|
||||
int max = 100;
|
||||
|
||||
public GloveSpeed(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
public GloveSpeed(int effect, ItemStack[] items, int[] values) {
|
||||
super(effect, "Redstone", items, values);
|
||||
tooltipName = ("\u00a74" + StatCollector.translateToLocal("modifier.tooltip.Haste"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack input, ItemStack[] modifiers)
|
||||
{
|
||||
if (input.getItem() instanceof AccessoryCore)
|
||||
{
|
||||
protected boolean canModify(ItemStack input, ItemStack[] modifiers) {
|
||||
if (input.getItem() instanceof AccessoryCore) {
|
||||
// is glove?
|
||||
if(!Arrays.asList(((AccessoryCore) input.getItem()).getTraits()).contains("glove"))
|
||||
return false;
|
||||
if (!Arrays.asList(((AccessoryCore) input.getItem()).getTraits()).contains("glove")) return false;
|
||||
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max;//This line fails?
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max; // This line fails?
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(modifiers) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
if (keyPair[0] + matchingAmount(modifiers) <= keyPair[1]) return true;
|
||||
else if (keyPair[0] == keyPair[1]) return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] modifiers, ItemStack input)
|
||||
{
|
||||
public void modify(ItemStack[] modifiers, ItemStack input) {
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
int[] keyPair;
|
||||
int increase = matchingAmount(modifiers);
|
||||
int current = 0;
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
if (tags.hasKey(key)) {
|
||||
keyPair = tags.getIntArray(key);
|
||||
if (keyPair[0] % max == 0)
|
||||
{
|
||||
if (keyPair[0] % max == 0) {
|
||||
keyPair[0] += increase;
|
||||
keyPair[1] += max;
|
||||
tags.setIntArray(key, keyPair);
|
||||
@@ -63,23 +51,19 @@ public class GloveSpeed extends ItemModTypeFilter
|
||||
int mods = tags.getInteger("Modifiers");
|
||||
mods -= 1;
|
||||
tags.setInteger("Modifiers", mods);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
current = keyPair[0];
|
||||
updateModTag(input, keyPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int mods = tags.getInteger("Modifiers");
|
||||
mods -= 1;
|
||||
tags.setInteger("Modifiers", mods);
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(input, tooltipName, modName);
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
keyPair = new int[] {increase, max, tooltipIndex};
|
||||
current = keyPair[0];
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
@@ -91,8 +75,7 @@ public class GloveSpeed extends ItemModTypeFilter
|
||||
tags.setInteger("MiningSpeed", miningSpeed);
|
||||
}
|
||||
|
||||
void updateModTag (ItemStack input, int[] keys)
|
||||
{
|
||||
void updateModTag(ItemStack input, int[] keys) {
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a74Redstone (" + keys[0] + "/" + keys[1] + ")";
|
||||
@@ -100,8 +83,7 @@ public class GloveSpeed extends ItemModTypeFilter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
public boolean validType(IModifyable type) {
|
||||
return type.getModifyType().equals("Accessory");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user