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

@@ -4,36 +4,30 @@ import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.mechworks.landmine.behavior.Behavior;
public class SlotBehavedOnly extends Slot
{
public class SlotBehavedOnly extends Slot {
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4)
{
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4) {
super(par1iInventory, par2, par3, par4);
}
@Override
public boolean isItemValid (ItemStack par1ItemStack)
{
public boolean isItemValid(ItemStack par1ItemStack) {
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
if (b == null)
{
if (b == null) {
return false;
}
int stackL = b.getStackLimit(par1ItemStack);
if (b != null && this.inventory.getStackInSlot(this.slotNumber) != null && !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack))
{
if (b != null
&& this.inventory.getStackInSlot(this.slotNumber) != null
&& !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack)) {
ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
if (is.stackSize + par1ItemStack.stackSize <= stackL)
{
if (is.stackSize + par1ItemStack.stackSize <= stackL) {
return true;
}
}
else
{
} else {
return par1ItemStack.stackSize <= stackL;
}
@@ -41,8 +35,9 @@ public class SlotBehavedOnly extends Slot
// return b != null;
}
public int getSlotStackLimit (ItemStack par1ItemStack)
{
return Behavior.getBehaviorFromStack(par1ItemStack) != null ? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack) : 1;
public int getSlotStackLimit(ItemStack par1ItemStack) {
return Behavior.getBehaviorFromStack(par1ItemStack) != null
? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack)
: 1;
}
}