mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Finish updating slot logic for Tool Stations, fix dupe bugs
This commit is contained in:
1 parent
c16c376868
commit
2629e241cd
26 files changed
+202
-154
No files matched your search
@@ -8,7 +8,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.library.event.ToolCraftedEvent;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
@@ -135,16 +137,25 @@ public class ToolStationContainer extends ActiveContainer
|
||||
|
||||
protected void craftTool (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
||||
if (stack.getItem() instanceof IModifyable)
|
||||
{
|
||||
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
|
||||
Boolean full = (logic.getStackInSlot(2) != null || logic.getStackInSlot(3) != null);
|
||||
for (int i = 2; i <= 3; i++)
|
||||
logic.decrStackSize(i, 1);
|
||||
int amount = logic.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1;
|
||||
ItemStack compare = logic.getStackInSlot(1);
|
||||
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
|
||||
logic.decrStackSize(1, amount);
|
||||
EntityPlayer player = invPlayer.player;
|
||||
if (!player.worldObj.isRemote && full)
|
||||
player.worldObj.playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.logic, player, stack));
|
||||
}
|
||||
else
|
||||
//Simply naming items
|
||||
{
|
||||
int amount = logic.getStackInSlot(1).stackSize;
|
||||
logic.decrStackSize(1, amount);
|
||||
|
||||
logic.getWorldObj().playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,28 +172,6 @@ public class ToolStationContainer extends ActiveContainer
|
||||
Slot otherInventorySlot;
|
||||
ItemStack copyStack = null;
|
||||
|
||||
/*
|
||||
* if (stack.isStackable()) { while (stack.stackSize > 0 &&
|
||||
* (!playerInventory && slotIndex < slotsTotal || playerInventory &&
|
||||
* slotIndex >= slotsStart)) { otherInventorySlot =
|
||||
* (Slot)this.inventorySlots.get(slotIndex); copyStack =
|
||||
* otherInventorySlot.getStack();
|
||||
*
|
||||
* if (copyStack != null && copyStack.itemID == stack.itemID &&
|
||||
* (!stack.getHasSubtypes() || stack.getItemDamage() ==
|
||||
* copyStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack,
|
||||
* copyStack)) { int totalSize = copyStack.stackSize + stack.stackSize;
|
||||
*
|
||||
* if (totalSize <= stack.getMaxStackSize()) { stack.stackSize = 0;
|
||||
* copyStack.stackSize = totalSize; otherInventorySlot.onSlotChanged();
|
||||
* failedToMerge = true; } else if (copyStack.stackSize <
|
||||
* stack.getMaxStackSize()) { stack.stackSize -= stack.getMaxStackSize()
|
||||
* - copyStack.stackSize; copyStack.stackSize = stack.getMaxStackSize();
|
||||
* otherInventorySlot.onSlotChanged(); failedToMerge = true; } }
|
||||
*
|
||||
* if (playerInventory) { --slotIndex; } else { ++slotIndex; } } }
|
||||
*/
|
||||
|
||||
if (stack.stackSize > 0)
|
||||
{
|
||||
if (playerInventory)
|
||||
@@ -220,14 +209,6 @@ public class ToolStationContainer extends ActiveContainer
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* boolean emptySlots = ( ((Slot) inventorySlots.get(2)).getStack() ==
|
||||
* null && ((Slot) inventorySlots.get(3)).getStack() == null );
|
||||
* TConstruct.logger.info("Empty slots"); if (!failedToMerge &&
|
||||
* emptySlots) player.worldObj.playAuxSFX(1021, (int)player.posX,
|
||||
* (int)player.posY, (int)player.posZ, 0);
|
||||
*/
|
||||
|
||||
return failedToMerge;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user