mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +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
@@ -6,7 +6,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.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.ToolForgeLogic;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
@@ -78,16 +80,24 @@ public class ToolForgeContainer extends ToolStationContainer
|
||||
@Override
|
||||
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 || logic.getStackInSlot(4) != null);
|
||||
for (int i = 2; i <= 4; 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.playAuxSFX(1021, (int) player.posX, (int) player.posY, (int) player.posZ, 0);
|
||||
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.logic, player, stack));
|
||||
}
|
||||
else //Simply naming items
|
||||
{
|
||||
int amount = logic.getStackInSlot(1).stackSize;
|
||||
logic.decrStackSize(1, amount);
|
||||
if (!logic.getWorldObj().isRemote)
|
||||
logic.getWorldObj().playAuxSFX(1021, (int) logic.xCoord, (int) logic.yCoord, (int) logic.zCoord, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user