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

@@ -1,45 +1,38 @@
package tconstruct.modifiers.tools;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
public class ModWindup extends ModRedstone {
public ModWindup(int effect, ItemStack[] items, int[] values) {
super(effect, items, values);
}
public boolean validType (ToolCore tool)
{
public boolean validType(ToolCore tool) {
List list = Arrays.asList(tool.getTraits());
return list.contains("windup");
}
@Override
protected boolean canModify(ItemStack tool, ItemStack[] input) {
if(!super.canModify(tool, input))
return false;
if (!super.canModify(tool, input)) return false;
float drawSSpeed = tool.getTagCompound().getCompoundTag("InfiTool").getFloat("DrawSpeed");
return drawSSpeed > 0.25f * 20f; // can't get below 1/4s
}
@Override
public void modify (ItemStack[] input, ItemStack tool)
{
public void modify(ItemStack[] input, ItemStack tool) {
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
int[] keyPair;
int increase = matchingAmount(input);
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);
@@ -47,23 +40,19 @@ public class ModWindup extends ModRedstone {
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
}
else
{
} else {
keyPair[0] += increase;
tags.setIntArray(key, keyPair);
}
current = keyPair[0];
updateModTag(tool, keyPair);
}
else
{
} else {
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
int tooltipIndex = addToolTip(tool, tooltipName, modName);
keyPair = new int[] { increase, max, tooltipIndex };
keyPair = new int[] {increase, max, tooltipIndex};
current = keyPair[0];
tags.setIntArray(key, keyPair);
}
@@ -72,11 +61,10 @@ public class ModWindup extends ModRedstone {
float boost = 0.10f * current;
// with added bonus for multiple modifiers of redstone
// so every 50 redstone you get a bonus speed
for(int i = 0; i < current/50; i++)
boost += 2.0f;
for (int i = 0; i < current / 50; i++) boost += 2.0f;
int baseDrawSpeed = tags.getInteger("BaseDrawSpeed");
int drawSpeed = baseDrawSpeed - (int)boost;
int drawSpeed = baseDrawSpeed - (int) boost;
drawSpeed = Math.max(5, drawSpeed); // 0.25f is the minimum
tags.setInteger("DrawSpeed", drawSpeed);
}