本文整理汇总了Java中com.enderio.core.client.gui.widget.GhostSlot.putStack方法的典型用法代码示例。如果您正苦于以下问题:Java GhostSlot.putStack方法的具体用法?Java GhostSlot.putStack怎么用?Java GhostSlot.putStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.enderio.core.client.gui.widget.GhostSlot
的用法示例。
在下文中一共展示了GhostSlot.putStack方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ghostSlotClickedPrimaryMouseButton
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void ghostSlotClickedPrimaryMouseButton(GhostSlot slot, ItemStack handStack, ItemStack existingStack) {
if (handStack == null || handStack.getItem() == null || handStack.stackSize == 0) { // empty hand
slot.putStack(null);
} else { // item in hand
if (existingStack == null || existingStack.getItem() == null || existingStack.stackSize == 0) { // empty slot
replaceSlot(slot, handStack);
} else { // filled slot
if (ItemUtil.areStackMergable(existingStack, handStack)) { // same item
if (existingStack.stackSize < existingStack.getMaxStackSize() && existingStack.stackSize < slot.getStackSizeLimit()) {
increaseSlot(slot, existingStack);
} else {
// NOP
}
} else { // different item
replaceSlot(slot, handStack);
}
}
}
}
示例2: ghostSlotClickedSecondaryMouseButton
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void ghostSlotClickedSecondaryMouseButton(GhostSlot slot, ItemStack handStack, ItemStack existingStack) {
if (handStack == null || handStack.getItem() == null || handStack.stackSize == 0) { // empty hand
slot.putStack(null);
} else { // item in hand
if (existingStack == null || existingStack.getItem() == null || existingStack.stackSize == 0) { // empty slot
replaceSlot1Item(slot, handStack);
} else { // filled slot
if (ItemUtil.areStackMergable(existingStack, handStack)) { // same item
descreaseSlot(slot, existingStack);
} else { // different item
replaceSlot1Item(slot, handStack);
}
}
}
}
示例3: descreaseSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void descreaseSlot(GhostSlot slot, ItemStack existingStack) {
if (existingStack.stackSize > 1) {
existingStack.stackSize--;
slot.putStack(existingStack);
} else {
slot.putStack(null);
}
}
示例4: replaceSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void replaceSlot(GhostSlot slot, ItemStack handStack) {
if (handStack.stackSize <= slot.getStackSizeLimit()) {
slot.putStack(handStack);
} else {
ItemStack tmp = handStack.copy();
tmp.stackSize = slot.getStackSizeLimit();
slot.putStack(tmp);
}
}
示例5: mouseClickMove
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
@Override
protected void mouseClickMove(int mouseX, int mouseY, int button, long par4) {
if (!getGhostSlots().isEmpty()) {
GhostSlot slot = getGhostSlot(mouseX, mouseY);
if (slot != null) {
ItemStack st = Minecraft.getMinecraft().player.inventory.getItemStack();
// don't replace already set slots while dragging an item
if (st == null || slot.getStack() == null) {
slot.putStack(st);
}
}
}
super.mouseClickMove(mouseX, mouseY, button, par4);
}
示例6: increaseSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void increaseSlot(GhostSlot slot, ItemStack existingStack) {
existingStack.stackSize++;
slot.putStack(existingStack);
}
示例7: replaceSlot1Item
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void replaceSlot1Item(GhostSlot slot, ItemStack handStack) {
ItemStack oneItem = handStack.copy();
oneItem.stackSize = 1;
slot.putStack(oneItem);
}