add single item crafting
This commit is contained in:
parent
5c68feedbb
commit
f6b036b517
9 changed files with 106 additions and 158 deletions
|
@ -30,6 +30,7 @@ import common.inventory.InventoryPlayer;
|
|||
import common.inventory.Slot;
|
||||
import common.item.CheatTab;
|
||||
import common.item.ItemStack;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketCheat;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
@ -299,11 +300,13 @@ public abstract class GuiContainer extends Gui
|
|||
ItemRenderer.disableStandardItemLighting();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
InventoryPlayer inventoryplayer = this.gm.player.inventory;
|
||||
ItemStack itemstack = inventoryplayer.getItemStack();
|
||||
ItemStack stack = inventoryplayer.getItemStack();
|
||||
if(this.gm.itemCheat)
|
||||
itemstack = itemstack == null ? this.cheatStack : itemstack;
|
||||
stack = stack == null ? this.cheatStack : stack;
|
||||
if(Bind.CRAFT.isDown())
|
||||
stack = stack == null && this.theSlot != null && this.theSlot.canCheatItem() && this.theSlot.getHasStack() ? this.gm.player.inventoryContainer.getSingleRecipe(this.theSlot.getStack()) : stack;
|
||||
|
||||
if (itemstack != null)
|
||||
if (stack != null)
|
||||
{
|
||||
int j2 = 8;
|
||||
int k2 = 8;
|
||||
|
@ -311,22 +314,26 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.size = this.dragSplittingRemnant;
|
||||
stack = stack.copy();
|
||||
stack.size = this.dragSplittingRemnant;
|
||||
|
||||
if (itemstack.size == 0)
|
||||
if (stack.size == 0)
|
||||
{
|
||||
s = "" + TextColor.YELLOW + "0";
|
||||
}
|
||||
}
|
||||
else if(itemstack == this.cheatStack) {
|
||||
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(itemstack.size);
|
||||
else if(stack == this.cheatStack) {
|
||||
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(stack.size);
|
||||
}
|
||||
|
||||
this.drawItemStack(itemstack, mouseX - j2, mouseY - k2, s);
|
||||
this.drawItemStack(stack, mouseX - j2, mouseY - k2, s);
|
||||
}
|
||||
|
||||
if (inventoryplayer.getItemStack() == null && this.cheatStack == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
if (inventoryplayer.getItemStack() == null && this.cheatStack == null && stack != null)
|
||||
{
|
||||
this.renderToolTip(stack, mouseX, mouseY);
|
||||
}
|
||||
else if (inventoryplayer.getItemStack() == null && this.cheatStack == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = this.theSlot.getStack();
|
||||
this.renderToolTip(itemstack1, mouseX, mouseY);
|
||||
|
@ -520,6 +527,11 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
}
|
||||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
if(slot != null && Bind.CRAFT.isDown() && slot.canCheatItem() && slot.getHasStack() && this.gm.player.inventoryContainer.getSingleRecipe(slot.getStack()) != null) {
|
||||
this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CRAFT_ITEM, slot.slotNumber));
|
||||
this.ignoreMouseUp = true;
|
||||
return;
|
||||
}
|
||||
long i = System.currentTimeMillis();
|
||||
this.doubleClick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouseButton;
|
||||
this.ignoreMouseUp = false;
|
||||
|
|
|
@ -31,6 +31,7 @@ public enum Bind implements Identifyable, CVar {
|
|||
SELECT7("select7", "Auswahl #7", Keysym.N7),
|
||||
SELECT8("select8", "Auswahl #8", Keysym.N8),
|
||||
SELECT9("select9", "Auswahl #9", Keysym.N9),
|
||||
CRAFT("craft", "Herstellen", Keysym.M),
|
||||
RENAME("rename", "Umbenennen", Keysym.N),
|
||||
CONSOLE("console", "Konsole", Keysym.F1),
|
||||
COMMAND("command", "Befehl / Chat", Keysym.C),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue