mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +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
@@ -10,77 +10,60 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.PatternChestLogic;
|
||||
|
||||
@ChestContainer
|
||||
public class PatternChestContainer extends Container
|
||||
{
|
||||
public class PatternChestContainer extends Container {
|
||||
public PatternChestLogic logic;
|
||||
public int progress = 0;
|
||||
public int fuel = 0;
|
||||
public int fuelGague = 0;
|
||||
|
||||
public PatternChestContainer(InventoryPlayer inventoryplayer, PatternChestLogic chest)
|
||||
{
|
||||
public PatternChestContainer(InventoryPlayer inventoryplayer, PatternChestLogic chest) {
|
||||
logic = chest;
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 10; row++)
|
||||
{
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 10; row++) {
|
||||
this.addSlotToContainer(new SlotPattern(chest, row + column * 10, 8 + row * 18, 18 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 17 + row * 18, 86 + column * 18));
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, row + column * 9 + 9, 17 + row * 18, 86 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 17 + column * 18, 144));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
if (block != TinkerTools.toolStationWood && block != TinkerTools.craftingSlabWood)
|
||||
return false;
|
||||
if (block != TinkerTools.toolStationWood && block != TinkerTools.craftingSlabWood) return false;
|
||||
return logic.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
if (slotID < logic.getSizeInventory()) {
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
if (slotStack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
@@ -89,11 +72,9 @@ public class PatternChestContainer extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack stack, int inventorySize, int slotSize, boolean par4)
|
||||
{
|
||||
if (!(stack.getItem() instanceof IPattern))
|
||||
return false;
|
||||
protected boolean mergeItemStack(ItemStack stack, int inventorySize, int slotSize, boolean par4) {
|
||||
if (!(stack.getItem() instanceof IPattern)) return false;
|
||||
|
||||
return super.mergeItemStack(stack, inventorySize, slotSize, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user