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

@@ -6,26 +6,34 @@ import net.minecraft.item.ItemStack;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.AbilityHelper;
public class SlotCraftingStation extends SlotCrafting
{
public class SlotCraftingStation extends SlotCrafting {
private final IInventory matrix;
private EntityPlayer player;
public SlotCraftingStation(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3iInventory, int par4, int par5, int par6)
{
public SlotCraftingStation(
EntityPlayer par1EntityPlayer,
IInventory par2IInventory,
IInventory par3iInventory,
int par4,
int par5,
int par6) {
super(par1EntityPlayer, par2IInventory, par3iInventory, par4, par5, par6);
this.matrix = par2IInventory;
this.player = par1EntityPlayer;
}
@Override
public void onPickupFromSlot (EntityPlayer player, ItemStack stack)
{
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
ItemStack tool = this.matrix.getStackInSlot(4);
if (stack.getItem() instanceof IModifyable && tool != null && tool.getItem() instanceof IModifyable)
{
if (stack.getItem() instanceof IModifyable && tool != null && tool.getItem() instanceof IModifyable) {
matrix.setInventorySlotContents(4, null);
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:little_saw", 1.0F, (AbilityHelper.random.nextFloat() - AbilityHelper.random.nextFloat()) * 0.2F + 1.0F);
player.worldObj.playSoundEffect(
player.posX,
player.posY,
player.posZ,
"tinker:little_saw",
1.0F,
(AbilityHelper.random.nextFloat() - AbilityHelper.random.nextFloat()) * 0.2F + 1.0F);
}
super.onPickupFromSlot(player, stack);
}