本文整理匯總了Java中net.minecraft.inventory.ClickType.QUICK_MOVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java ClickType.QUICK_MOVE屬性的具體用法?Java ClickType.QUICK_MOVE怎麽用?Java ClickType.QUICK_MOVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.inventory.ClickType
的用法示例。
在下文中一共展示了ClickType.QUICK_MOVE屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: adjustPhantomSlot
private void adjustPhantomSlot(Slot slot, ClickType clickType, int dragType) {
if (!((IPhantomSlot) slot).canAdjust()) {
return;
}
ItemStack stackSlot = slot.getStack().copy();
if (dragType == 1) {
if (clickType == ClickType.QUICK_MOVE) {
stackSlot.setCount(Math.min(stackSlot.getCount() * 2, slot.getSlotStackLimit())); // shift-r-click: double stack size
} else {
stackSlot.setCount(Math.min(stackSlot.getCount() + 1, slot.getSlotStackLimit())); // r-click: increase stack size
}
} else if (dragType == 0) {
if (clickType == ClickType.QUICK_MOVE) {
stackSlot.setCount(stackSlot.getCount() / 2); // shift-l-click: half stack size
} else {
stackSlot.shrink(1); // l-click: decrease stack size
}
}
slot.putStack(stackSlot);
}
示例2: slotClick
@Override
public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) {
ItemStack held = player.inventory.getItemStack();
if (button == 0 && clickType == ClickType.QUICK_MOVE) {
NEIClientUtils.cheatItem(getStack(), button, -1);
} else if (button == 1) {
putStack(ItemStack.EMPTY);
} else if (!held.isEmpty()) {
if (isItemValid(held)) {
putStack(ItemUtils.copyStack(held, 1));
player.inventory.setItemStack(ItemStack.EMPTY);
}
} else if (getHasStack()) {
player.inventory.setItemStack(getStack());
}
return ItemStack.EMPTY;
}
示例3: slotClickPhantom
@Nonnull
private ItemStack slotClickPhantom(Slot slot, int dragType, ClickType clickType, EntityPlayer player) {
ItemStack stack = ItemStack.EMPTY;
if (clickType == ClickType.CLONE && dragType == 2) {
// middle-click: clear slot
if (((IPhantomSlot) slot).canAdjust()) {
slot.putStack(ItemStack.EMPTY);
}
} else if ((clickType == ClickType.PICKUP || clickType == ClickType.QUICK_MOVE) && (dragType == 0 || dragType == 1)) {
// left or right-click...
InventoryPlayer playerInv = player.inventory;
slot.onSlotChanged();
ItemStack stackSlot = slot.getStack();
ItemStack stackHeld = playerInv.getItemStack();
stack = stackSlot.copy();
if (stackSlot.isEmpty()) {
if (!stackHeld.isEmpty() && slot.isItemValid(stackHeld)) {
fillPhantomSlot(slot, stackHeld, clickType, dragType);
}
} else if (stackHeld.isEmpty()) {
adjustPhantomSlot(slot, clickType, dragType);
slot.onTake(player, playerInv.getItemStack());
} else if (slot.isItemValid(stackHeld)) {
if (canStacksMerge(stackSlot, stackHeld)) {
adjustPhantomSlot(slot, clickType, dragType);
} else {
fillPhantomSlot(slot, stackHeld, clickType, dragType);
}
}
}
return stack;
}
示例4: windowClick
public static void windowClick(int windowID, int id, int next, IClickType type) {
ClickType t = ClickType.THROW;
if (type.equals(IClickType.THROW)) {
t = ClickType.THROW;
} else if (type.equals(IClickType.QUICK_MOVE)) {
t = ClickType.QUICK_MOVE;
} else {
return;
}
Minecraft.getMinecraft().playerController.windowClick(windowID, id, next, t,
Minecraft.getMinecraft().player);
}
示例5: slotClick
@Override
public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) {
ItemStack held = player.inventory.getItemStack();
boolean shift = clickType == ClickType.QUICK_MOVE;
slotClick(held, button, shift);
return null;
}
示例6: slotClick
@Override
public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) {
ItemStack held = player.inventory.getItemStack();
boolean shift = clickType == ClickType.QUICK_MOVE;
slotClick(held, button, shift);
return ItemStack.EMPTY;
}
示例7: slotClick
/** Default slot click handling. Also checks for shift-clicking to sort the inventory appropriately */
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
ItemStack val = null;
if (slotId < this.rowCount() * 9 && slotId >= 0) {
val = null; // use custom handler for clicks on the inventory
} else {
val = super.slotClick(slotId, dragType, clickTypeIn, player);
if (clickTypeIn == ClickType.QUICK_MOVE)
this.tileEntity.sortInventory(); // sort only on insert shift-click
}
return val;
}
示例8: slotClick
@Override
/**
* Handles slot click.
*
* @param mode 0 = basic click, 1 = shift click, 2 = hotbar, 3 = pick block, 4 = drop, 5 = ?, 6 = double click
*/
public ItemStack slotClick(int slotID, int dragType, ClickType clickTypeIn, EntityPlayer p)
{
if (slotID >= 0 && slotID < this.inventorySlots.size())
{
Slot sourceSlot = (Slot) this.inventorySlots.get(slotID);
ItemStack slotStack = sourceSlot.getStack();
//This section is for merging foods with differing expirations.
if(clickTypeIn == ClickType.SWAP && slotStack != null && p.inventory.getItemStack() != null)
{
ItemStack itemstack4 = p.inventory.getItemStack();
if (slotStack.getItem() == itemstack4.getItem() && slotStack.getMetadata() == itemstack4.getMetadata() && ContainerTFC.areCompoundsEqual(slotStack, itemstack4))
{
if(slotStack.getItem() instanceof IFood && itemstack4.getItem() instanceof IFood)
{
long ex1 = Food.getDecayTimer(slotStack);
long ex2 = Food.getDecayTimer(itemstack4);
if(ex2 < ex1)
Food.setDecayTimer(slotStack, ex2);
}
//int l1 = clickedButton == 0 ? itemstack4.getMaxStackSize() : 1;
int l1 = itemstack4.getMaxStackSize();
if (l1 > sourceSlot.getItemStackLimit(itemstack4) - slotStack.getMaxStackSize())
{
l1 = sourceSlot.getItemStackLimit(itemstack4) - slotStack.getMaxStackSize();
}
if (l1 > itemstack4.getMaxStackSize() - slotStack.getMaxStackSize())
{
l1 = itemstack4.getMaxStackSize() - slotStack.getMaxStackSize();
}
itemstack4.splitStack(l1);
if (itemstack4.getMaxStackSize() == 0)
{
p.inventory.setItemStack(ItemStack.EMPTY);
}
slotStack.grow(l1);
return ItemStack.EMPTY;
}
else if (itemstack4.getMaxStackSize() <= sourceSlot.getItemStackLimit(itemstack4))
{
sourceSlot.putStack(itemstack4);
p.inventory.setItemStack(slotStack);
}
}
// Hotbar press to remove from crafting output
if (clickTypeIn == ClickType.QUICK_MOVE && slotID == 0 && slotStack != null)
{
//Removed During Port
//CraftingHandler.preCraft(p, slotStack, craftMatrix);
}
// S and D hotkeys for trimming/combining food
/*else if (mode == 7 && slotID >= 9 && slotID < 45)
{
if (sourceSlot.canTakeStack(p))
{
Slot destSlot = (Slot) this.inventorySlots.get(clickedButton);
destSlot.putStack(slotStack);
sourceSlot.putStack(null);
return null;
}
}*/
}
ItemStack is = super.slotClick(slotID, dragType, clickTypeIn, p);
//saveContents(is);
return is;
}