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:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

@@ -3,51 +3,38 @@ package tconstruct.modifiers.tools;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ModAntiSpider extends ItemModTypeFilter
{
public class ModAntiSpider extends ItemModTypeFilter {
String tooltipName;
int max = 4;
String guiType;
public ModAntiSpider(String type, int effect, ItemStack[] items, int[] values)
{
public ModAntiSpider(String type, int effect, ItemStack[] items, int[] values) {
super(effect, "ModAntiSpider", items, values);
tooltipName = "\u00a72Bane of Arthropods";
guiType = type;
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
protected boolean canModify(ItemStack tool, ItemStack[] input) {
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
if (!tags.hasKey(key))
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
if (!tags.hasKey(key)) return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
if (matchingAmount(input) > max)
return false;
if (matchingAmount(input) > max) return false;
int keyPair[] = tags.getIntArray(key);
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
return true;
else if (keyPair[0] == keyPair[1])
return tags.getInteger("Modifiers") > 0;
else
return false;
if (keyPair[0] + matchingAmount(input) <= 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)
{
public void modify(ItemStack[] input, ItemStack tool) {
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
int increase = matchingAmount(input);
if (tags.hasKey(key))
{
if (tags.hasKey(key)) {
int[] keyPair = tags.getIntArray(key);
if (keyPair[0] % max == 0)
{
if (keyPair[0] % max == 0) {
keyPair[0] += increase;
keyPair[1] += max;
tags.setIntArray(key, keyPair);
@@ -55,29 +42,24 @@ public class ModAntiSpider extends ItemModTypeFilter
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
}
else
{
} else {
keyPair[0] += increase;
tags.setIntArray(key, keyPair);
}
updateModTag(tool, keyPair);
}
else
{
} else {
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
String modName = "\u00a72" + guiType + " (" + increase + "/" + max + ")";
int tooltipIndex = addToolTip(tool, tooltipName, modName);
int[] keyPair = new int[] { increase, max, tooltipIndex };
int[] keyPair = new int[] {increase, max, tooltipIndex};
tags.setIntArray(key, keyPair);
}
}
void updateModTag (ItemStack tool, int[] keys)
{
void updateModTag(ItemStack tool, int[] keys) {
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
String tip = "ModifierTip" + keys[2];
String modName = "\u00a72" + guiType + " (" + keys[0] + "/" + keys[1] + ")";