net.minecraft.inventory.Slot.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中net.minecraft.inventory.Slot.isEnabled()方法的一些代码示例,展示了Slot.isEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.isEnabled()方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:isEnabled

Slot.isEnabled介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
protected void renderHoveredToolTip( int mouseX, int mouseY )
{
  final Slot slot = this.getSlot( mouseX, mouseY );
  if( slot != null && slot instanceof IMEFluidSlot && slot.isEnabled() )
  {
    final IMEFluidSlot fluidSlot = (IMEFluidSlot) slot;
    if( fluidSlot.getAEFluidStack() != null && fluidSlot.shouldRenderAsFluid() )
    {
      final IAEFluidStack fluidStack = fluidSlot.getAEFluidStack();
      final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( fluidStack.getStackSize() / 1000.0 ) + " B";
      final String modName = "" + TextFormatting.BLUE + TextFormatting.ITALIC + Loader.instance()
          .getIndexedModList()
          .get( Platform.getModId( fluidStack ) )
          .getName();
      final List<String> list = new ArrayList<>();
      list.add( fluidStack.getFluidStack().getLocalizedName() );
      list.add( formattedAmount );
      list.add( modName );
      this.drawHoveringText( list, mouseX, mouseY );
      return;
    }
  }
  super.renderHoveredToolTip( mouseX, mouseY );
}

代码示例来源:origin: raoulvdberge/refinedstorage

if (!slot.isEnabled()) {
  continue;

代码示例来源:origin: CyclopsMC/IntegratedDynamics

int slotY = slot.yPos;
if (slot.getHasStack() && slot.isEnabled()) {
  TextureAtlasSprite textureatlassprite = slot.getBackgroundSprite();
  if (textureatlassprite != null) {

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  drawBackground(guiLeft, guiTop, mouseX, mouseY);
  this.hoveringFluid = null;
  for (int i = 0; i < inventorySlots.inventorySlots.size(); ++i) {
    Slot slot = inventorySlots.inventorySlots.get(i);
    if (slot.isEnabled() && slot instanceof SlotFilterFluid) {
      FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
      if (stack != null) {
        FLUID_RENDERER.draw(mc, guiLeft + slot.xPos, guiTop + slot.yPos, stack);
        if (((SlotFilterFluid) slot).isSizeAllowed()) {
          drawQuantity(guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.amount));
          GL11.glDisable(GL11.GL_LIGHTING);
        }
        if (inBounds(guiLeft + slot.xPos, guiTop + slot.yPos, 17, 17, mouseX, mouseY)) {
          this.hoveringFluid = stack.getLocalizedName();
        }
      }
    }
  }
  if (scrollbar != null) {
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    scrollbar.draw(this);
  }
}

代码示例来源:origin: Nividica/ThaumicEnergistics

@Override
public void drawSlot(Slot slot) {
  mc.getTextureManager().bindTexture(this.getGuiBackground());
  if (slot instanceof ISlotOptional) {
    if (slot.isEnabled()) {
      // TODO: Draw slot background on enabled slots
    }
  } else if (slot instanceof SlotME && ((SlotME) slot).getAEStack() instanceof IAEItemStack) {
    SlotME slotME = (SlotME) slot;
    super.drawSlot(slot);
    stackSizeRenderer.renderStackSize(this.fontRenderer, (IAEItemStack) slotME.getAEStack(), slot.xPos, slot.yPos);
    return;
  } else if (slot instanceof ThESlot) {
    if (((ThESlot) slot).hasBackgroundIcon()) {
      int index = ((ThESlot) slot).getBackgroundIconIndex();
      int uv_y = (int) Math.floor((double) index / 16);
      int uv_x = index - uv_y * 16;
      Minecraft.getMinecraft().getTextureManager().bindTexture(((ThESlot) slot).getBackgroundIcon());
      GlStateManager.enableBlend();
      GlStateManager.disableLighting();
      GlStateManager.enableTexture2D();
      GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
      this.drawTexturedModelRectColor(slot.xPos, slot.yPos, uv_x * 16, uv_y * 16, 16, 16, new Color(1f, 1f, 1f, 0.4f));
      //GlStateManager.enableLighting();
    }
  }
  super.drawSlot(slot);
}

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
public void drawBackground(int x, int y, int mouseX, int mouseY) {
  bindTexture("gui/crafter_manager.png");
  drawTexture(x, y, 0, 0, screenWidth, getTopHeight());
  int rows = getVisibleRows();
  int yy = y;
  for (int i = 0; i < rows; ++i) {
    yy += 18;
    drawTexture(x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), screenWidth, 18);
  }
  yy += 18;
  drawTexture(x, yy, 0, getTopHeight() + (18 * 3), screenWidth, getBottomHeight());
  if (container != null && crafterManager.isActive()) {
    for (Slot slot : container.inventorySlots) {
      if (slot instanceof SlotCrafterManager && slot.isEnabled()) {
        drawTexture(x + slot.xPos - 1, y + slot.yPos - 1, 0, 193, 18, 18);
      }
    }
  }
  if (searchField != null) {
    searchField.drawTextBox();
  }
}

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
protected void handleMouseClick(Slot slot, int slotId, int mouseButton, ClickType type) {
  boolean valid = type != ClickType.QUICK_MOVE && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty();
  if (valid && slot instanceof SlotFilter && slot.isEnabled() && ((SlotFilter) slot).isSizeAllowed()) {
    if (!slot.getStack().isEmpty()) {
      FMLClientHandler.instance().showGuiScreen(new GuiAmount(
        (GuiBase) Minecraft.getMinecraft().currentScreen,
        Minecraft.getMinecraft().player,
        slot.slotNumber,
        slot.getStack(),
        slot.getSlotStackLimit()
      ));
    }
  } else if (valid && slot instanceof SlotFilterFluid && slot.isEnabled() && ((SlotFilterFluid) slot).isSizeAllowed()) {
    FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
    if (stack != null) {
      FMLClientHandler.instance().showGuiScreen(new GuiFluidAmount(
        (GuiBase) Minecraft.getMinecraft().currentScreen,
        Minecraft.getMinecraft().player,
        slot.slotNumber,
        stack,
        ((SlotFilterFluid) slot).getFluidInventory().getMaxAmount()
      ));
    } else {
      super.handleMouseClick(slot, slotId, mouseButton, type);
    }
  } else {
    super.handleMouseClick(slot, slotId, mouseButton, type);
  }
}

相关文章