mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +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
@@ -29,6 +29,8 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.armor.gui.ArmorExtendedGui;
|
||||
import tconstruct.armor.gui.KnapsackGui;
|
||||
import tconstruct.armor.model.BeltModel;
|
||||
import tconstruct.armor.model.BootBump;
|
||||
import tconstruct.armor.model.HiddenPlayerModel;
|
||||
@@ -36,8 +38,6 @@ import tconstruct.armor.model.WingModel;
|
||||
import tconstruct.client.TControls;
|
||||
import tconstruct.client.TKeyHandler;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.client.gui.ArmorExtendedGui;
|
||||
import tconstruct.client.gui.KnapsackGui;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
import tconstruct.client.tabs.InventoryTabVanilla;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.armor.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.armor.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
@@ -57,6 +57,8 @@ import org.w3c.dom.Document;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.gui.ArmorExtendedGui;
|
||||
import tconstruct.armor.gui.KnapsackGui;
|
||||
import tconstruct.armor.modelblock.DryingRackRender;
|
||||
import tconstruct.armor.modelblock.DryingRackSpecialRender;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
@@ -64,19 +66,6 @@ import tconstruct.client.entity.item.ExplosiveRender;
|
||||
import tconstruct.client.entity.projectile.ArrowRenderCustom;
|
||||
import tconstruct.client.entity.projectile.DaggerRenderCustom;
|
||||
import tconstruct.client.entity.projectile.LaunchedItemRender;
|
||||
import tconstruct.client.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.client.gui.ArmorExtendedGui;
|
||||
import tconstruct.client.gui.CraftingStationGui;
|
||||
import tconstruct.client.gui.FrypanGui;
|
||||
import tconstruct.client.gui.FurnaceGui;
|
||||
import tconstruct.client.gui.GuiLandmine;
|
||||
import tconstruct.client.gui.KnapsackGui;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.client.gui.PatternChestGui;
|
||||
import tconstruct.client.gui.SmelteryGui;
|
||||
import tconstruct.client.gui.StencilTableGui;
|
||||
import tconstruct.client.gui.ToolForgeGui;
|
||||
import tconstruct.client.gui.ToolStationGui;
|
||||
import tconstruct.client.pages.BlockCastPage;
|
||||
import tconstruct.client.pages.MaterialPage;
|
||||
import tconstruct.client.pages.ModifierPage;
|
||||
@@ -94,11 +83,14 @@ import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.mechworks.MechworksProxyCommon;
|
||||
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
|
||||
import tconstruct.mechworks.entity.item.ExplosivePrimed;
|
||||
import tconstruct.mechworks.gui.GuiLandmine;
|
||||
import tconstruct.mechworks.inventory.ContainerLandmine;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.mechworks.model.CartRender;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.smeltery.logic.CastingBasinLogic;
|
||||
import tconstruct.smeltery.logic.CastingTableLogic;
|
||||
@@ -118,6 +110,14 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
import tconstruct.tools.entity.DaggerEntity;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.gui.FrypanGui;
|
||||
import tconstruct.tools.gui.FurnaceGui;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
import tconstruct.tools.gui.PatternChestGui;
|
||||
import tconstruct.tools.gui.StencilTableGui;
|
||||
import tconstruct.tools.gui.ToolForgeGui;
|
||||
import tconstruct.tools.gui.ToolStationGui;
|
||||
import tconstruct.tools.items.ManualInfo;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
|
||||
@@ -11,10 +11,10 @@ import org.lwjgl.opengl.GL12;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
|
||||
public class MaterialPage extends BookPage
|
||||
{
|
||||
|
||||
@@ -8,31 +8,31 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.gui.ArmorExtendedGui;
|
||||
import tconstruct.armor.gui.KnapsackGui;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.client.entity.item.ExplosiveRender;
|
||||
import tconstruct.client.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.client.gui.ArmorExtendedGui;
|
||||
import tconstruct.client.gui.CraftingStationGui;
|
||||
import tconstruct.client.gui.FrypanGui;
|
||||
import tconstruct.client.gui.FurnaceGui;
|
||||
import tconstruct.client.gui.GuiLandmine;
|
||||
import tconstruct.client.gui.KnapsackGui;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.client.gui.PatternChestGui;
|
||||
import tconstruct.client.gui.SmelteryGui;
|
||||
import tconstruct.client.gui.StencilTableGui;
|
||||
import tconstruct.client.gui.ToolForgeGui;
|
||||
import tconstruct.client.gui.ToolStationGui;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
|
||||
import tconstruct.mechworks.entity.item.ExplosivePrimed;
|
||||
import tconstruct.mechworks.gui.GuiLandmine;
|
||||
import tconstruct.mechworks.inventory.ContainerLandmine;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.tools.ToolProxyCommon;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.gui.FrypanGui;
|
||||
import tconstruct.tools.gui.FurnaceGui;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
import tconstruct.tools.gui.PatternChestGui;
|
||||
import tconstruct.tools.gui.StencilTableGui;
|
||||
import tconstruct.tools.gui.ToolForgeGui;
|
||||
import tconstruct.tools.gui.ToolStationGui;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
import tconstruct.tools.logic.FurnaceLogic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.mechworks.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,10 +19,10 @@ import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.modelblock.DryingRackRender;
|
||||
import tconstruct.armor.modelblock.DryingRackSpecialRender;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.client.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.client.gui.SmelteryGui;
|
||||
import tconstruct.client.pages.BlockCastPage;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.smeltery.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.smeltery.logic.CastingBasinLogic;
|
||||
import tconstruct.smeltery.logic.CastingTableLogic;
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.smeltery.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -24,6 +24,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.client.gui.NewContainerGui;
|
||||
import tconstruct.library.component.MultiFluidTank;
|
||||
import tconstruct.smeltery.component.SmelteryComponent;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.smeltery.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -22,6 +22,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.client.gui.NewContainerGui;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
@@ -16,14 +16,6 @@ import tconstruct.client.ToolCoreRenderer;
|
||||
import tconstruct.client.entity.projectile.ArrowRenderCustom;
|
||||
import tconstruct.client.entity.projectile.DaggerRenderCustom;
|
||||
import tconstruct.client.entity.projectile.LaunchedItemRender;
|
||||
import tconstruct.client.gui.CraftingStationGui;
|
||||
import tconstruct.client.gui.FrypanGui;
|
||||
import tconstruct.client.gui.FurnaceGui;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.client.gui.PatternChestGui;
|
||||
import tconstruct.client.gui.StencilTableGui;
|
||||
import tconstruct.client.gui.ToolForgeGui;
|
||||
import tconstruct.client.gui.ToolStationGui;
|
||||
import tconstruct.client.pages.MaterialPage;
|
||||
import tconstruct.client.pages.ModifierPage;
|
||||
import tconstruct.client.pages.ToolPage;
|
||||
@@ -38,6 +30,14 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
import tconstruct.tools.entity.DaggerEntity;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.gui.FrypanGui;
|
||||
import tconstruct.tools.gui.FurnaceGui;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
import tconstruct.tools.gui.PatternChestGui;
|
||||
import tconstruct.tools.gui.StencilTableGui;
|
||||
import tconstruct.tools.gui.ToolForgeGui;
|
||||
import tconstruct.tools.gui.ToolStationGui;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
import tconstruct.tools.logic.FurnaceLogic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.client.gui.NewContainerGui;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
+1
-15
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -20,20 +20,6 @@ public class ToolForgeGui extends ToolStationGui
|
||||
super(inventoryplayer, stationlogic, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
int gLeft = this.guiLeft + 68;
|
||||
int gTop = this.guiTop + 6;
|
||||
int gwidth = 102;
|
||||
int gheight = 12;
|
||||
active = mouseX > gLeft && mouseX < gLeft + gwidth && mouseY > gTop && mouseY < gTop + gheight;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
package tconstruct.client.gui;
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -64,7 +64,7 @@ public class ToolStationGui extends GuiContainer
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
int gLeft = this.guiLeft + 68;
|
||||
int gLeft = this.guiLeft + 68 + 110;
|
||||
int gTop = this.guiTop + 6;
|
||||
int gwidth = 102;
|
||||
int gheight = 12;
|
||||
@@ -315,8 +315,7 @@ public class ToolStationGui extends GuiContainer
|
||||
offset++;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation13"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), 294, base + offset * 10,
|
||||
0xffffff);
|
||||
fontRendererObj.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package tconstruct.tools.inventory;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.event.ToolCraftedEvent;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class SlotTool extends Slot
|
||||
@@ -24,57 +24,53 @@ public class SlotTool extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
// return stack.getItem() instanceof ToolCore;
|
||||
//return stack.getItem() instanceof ToolCore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot (EntityPlayer par1EntityPlayer, ItemStack stack)
|
||||
{
|
||||
this.onCrafting(stack);
|
||||
// stack.setUnlocalizedName("\u00A7f" + toolName);
|
||||
//stack.setUnlocalizedName("\u00A7f" + toolName);
|
||||
super.onPickupFromSlot(par1EntityPlayer, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* the itemStack passed in is the output - ie, iron ingots, and pickaxes,
|
||||
* not ore and wood. Typically increases an internal count then calls
|
||||
* onCrafting(item).
|
||||
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
|
||||
* internal count then calls onCrafting(item).
|
||||
*/
|
||||
@Override
|
||||
protected void onCrafting (ItemStack stack, int par2)
|
||||
{
|
||||
// this.field_75228_b += par2;
|
||||
//this.field_75228_b += par2;
|
||||
this.onCrafting(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* the itemStack passed in is the output - ie, iron ingots, and pickaxes,
|
||||
* not ore and wood.
|
||||
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
|
||||
*/
|
||||
@Override
|
||||
protected void onCrafting (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 = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null);
|
||||
for (int i = 2; i <= 3; i++)
|
||||
inventory.decrStackSize(i, 1);
|
||||
int amount = inventory.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1;
|
||||
ItemStack compare = inventory.getStackInSlot(1);
|
||||
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
|
||||
inventory.decrStackSize(1, amount);
|
||||
if (!player.worldObj.isRemote && full)
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
// player.worldObj.playAuxSFX(1021, (int)player.posX,
|
||||
// (int)player.posY, (int)player.posZ, 0);
|
||||
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.inventory, player, stack));
|
||||
}
|
||||
else //Simply naming items
|
||||
{
|
||||
int amount = inventory.getStackInSlot(1).stackSize;
|
||||
inventory.decrStackSize(1, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.library.event.ToolCraftedEvent;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
public class SlotToolForge extends SlotTool
|
||||
{
|
||||
@@ -20,21 +20,25 @@ public class SlotToolForge extends SlotTool
|
||||
super(entityplayer, builder, par3, par4, par5);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCrafting (ItemStack stack)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
||||
if (stack.getItem() instanceof IModifyable)
|
||||
{
|
||||
tags.getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
Boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null);
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
|
||||
Boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null || inventory.getStackInSlot(4) != null);
|
||||
for (int i = 2; i <= 4; i++)
|
||||
inventory.decrStackSize(i, 1);
|
||||
int amount = inventory.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1;
|
||||
ItemStack compare = inventory.getStackInSlot(1);
|
||||
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
|
||||
inventory.decrStackSize(1, amount);
|
||||
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.inventory, player, stack));
|
||||
}
|
||||
else //Simply naming items
|
||||
{
|
||||
int amount = inventory.getStackInSlot(1).stackSize;
|
||||
inventory.decrStackSize(1, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
|
||||
/* Simple class for storing items in the block
|
||||
@@ -69,18 +71,63 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
|
||||
|
||||
public void buildTool (String name)
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], name);
|
||||
if (inventory[0] == null)
|
||||
inventory[0] = tool;
|
||||
else
|
||||
ItemStack output = null;
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
NBTTagCompound tags = inventory[0].getTagCompound();
|
||||
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
||||
if (inventory[1].getItem() instanceof IModifyable) //Modify item
|
||||
{
|
||||
inventory[0] = tool;
|
||||
if (inventory[2] == null && inventory[3] == null)
|
||||
output = inventory[1].copy();
|
||||
else
|
||||
{
|
||||
output = ModifyBuilder.instance.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3] });
|
||||
}
|
||||
}
|
||||
else
|
||||
//Build new item
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], name);
|
||||
if (inventory[0] == null)
|
||||
output = tool;
|
||||
else if (tool != null)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound();
|
||||
if (!tags.getCompoundTag(((IModifyable) tool.getItem()).getBaseTagName()).hasKey("Built"))
|
||||
{
|
||||
output = tool;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!name.equals("")) //Name item
|
||||
{
|
||||
ItemStack temp = inventory[1].copy();
|
||||
if (output != null)
|
||||
temp = output;
|
||||
|
||||
if (temp != null)
|
||||
{
|
||||
NBTTagCompound tags = temp.getTagCompound();
|
||||
if (tags == null)
|
||||
{
|
||||
tags = new NBTTagCompound();
|
||||
temp.setTagCompound(tags);
|
||||
}
|
||||
|
||||
if (!(tags.hasKey("display")))
|
||||
{
|
||||
NBTTagCompound display = new NBTTagCompound();
|
||||
String dName = temp.getItem() instanceof IModifyable ? "\u00A7f" + name : name;
|
||||
display.setString("Name", dName);
|
||||
tags.setTag("display", display);
|
||||
temp.setRepairCost(2);
|
||||
output = temp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
inventory[0] = output;
|
||||
}
|
||||
|
||||
public void setToolname (String name)
|
||||
|
||||
Reference in new issue
Block a user