当前位置: 首页>>代码示例>>Java>>正文


Java GhostSlot.getStack方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:32,代码来源:GhostSlotHandler.java

示例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);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:13,代码来源:GuiInventoryPanel.java

示例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);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:15,代码来源:GuiSensor.java

示例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);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:7,代码来源:GhostSlotHandler.java

示例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);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderCore,代码行数:29,代码来源:GhostSlotHandler.java


注:本文中的com.enderio.core.client.gui.widget.GhostSlot.getStack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。