本文整理汇总了Java中com.enderio.core.client.gui.widget.GhostSlot.getStack方法的典型用法代码示例。如果您正苦于以下问题:Java GhostSlot.getStack方法的具体用法?Java GhostSlot.getStack怎么用?Java GhostSlot.getStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.enderio.core.client.gui.widget.GhostSlot
的用法示例。
在下文中一共展示了GhostSlot.getStack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void drawGhostSlots(GuiContainerBase gui, int mouseX, int mouseY) {
int sx = gui.getGuiLeft();
int sy = gui.getGuiTop();
gui.drawFakeItemsStart();
try {
gui.hoverGhostSlot = hoverGhostSlot = null;
for (GhostSlot slot : ghostSlots) {
ItemStack stack = slot.getStack();
if (slot.isVisible()) {
if (stack != null) {
gui.drawFakeItemStack(slot.x + sx, slot.y + sy, stack);
if (slot.shouldDisplayStdOverlay()) {
gui.drawFakeItemStackStdOverlay(slot.x + sx, slot.y + sy, stack);
}
if (slot.shouldGrayOut()) {
gui.ghostSlotHandler.drawGhostSlotGrayout(gui, slot);
}
}
if (slot.isMouseOver(mouseX - sx, mouseY - sy)) {
gui.hoverGhostSlot = hoverGhostSlot = slot;
}
}
}
if (hoverGhostSlot != null) {
// draw hover last to prevent it from affecting rendering of other slots ...
gui.drawFakeItemHover(hoverGhostSlot.x + sx, hoverGhostSlot.y + sy);
}
} finally {
gui.drawFakeItemsEnd();
}
}
示例2: getIngredientUnderMouse
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
@Override
@Nullable
public Object getIngredientUnderMouse(int mouseX, int mouseY) {
if (RECTANGLE_FUEL_TANK.contains(mouseX, mouseY)) {
return getTileEntity().fuelTank.getFluid();
}
GhostSlot slot = getGhostSlot(mouseX + getGuiLeft(), mouseY + getGuiTop());
if (slot instanceof InvSlot || slot instanceof RecipeSlot) {
return slot.getStack();
}
return super.getIngredientUnderMouse(mouseX, mouseY);
}
示例3: 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);
}
示例4: drawGhostSlotTooltip
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
protected void drawGhostSlotTooltip(GuiContainerBase guiContainerBase, GhostSlot slot, int mouseX, int mouseY) {
ItemStack stack = slot.getStack();
if (stack != null) {
guiContainerBase.renderToolTip(stack, mouseX, mouseY);
}
}
示例5: ghostSlotClicked
import com.enderio.core.client.gui.widget.GhostSlot; //导入方法依赖的package包/类
/**
* Called when a ghost slot is clicked or mouse wheeled.
*
* @param gui
* The GUI the GhostSlot is in
* @param slot
* The GhostSlot
* @param x
* Mouse position x
* @param y
* Mouse position y
* @param button
* The button used (0=left, 1=right). The mouse wheel is mapped to
* -1=down and -2=up.
*/
protected void ghostSlotClicked(GuiContainerBase gui, GhostSlot slot, int x, int y, int button) {
ItemStack handStack = Minecraft.getMinecraft().thePlayer.inventory.getItemStack();
ItemStack existingStack = slot.getStack();
if (button == 0) { // left
ghostSlotClickedPrimaryMouseButton(slot, handStack, existingStack);
} else if (button == 1) { // right
ghostSlotClickedSecondaryMouseButton(slot, handStack, existingStack);
} else if (button == -2) { // wheel up
ghostSlotClickedMouseWheelUp(slot, handStack, existingStack);
} else if (button == -1) { // wheel down
ghostSlotClickedMouseWheelDown(slot, handStack, existingStack);
}
}