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

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

本文整理了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

  1. @Override
  2. protected void renderHoveredToolTip( int mouseX, int mouseY )
  3. {
  4. final Slot slot = this.getSlot( mouseX, mouseY );
  5. if( slot != null && slot instanceof IMEFluidSlot && slot.isEnabled() )
  6. {
  7. final IMEFluidSlot fluidSlot = (IMEFluidSlot) slot;
  8. if( fluidSlot.getAEFluidStack() != null && fluidSlot.shouldRenderAsFluid() )
  9. {
  10. final IAEFluidStack fluidStack = fluidSlot.getAEFluidStack();
  11. final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( fluidStack.getStackSize() / 1000.0 ) + " B";
  12. final String modName = "" + TextFormatting.BLUE + TextFormatting.ITALIC + Loader.instance()
  13. .getIndexedModList()
  14. .get( Platform.getModId( fluidStack ) )
  15. .getName();
  16. final List<String> list = new ArrayList<>();
  17. list.add( fluidStack.getFluidStack().getLocalizedName() );
  18. list.add( formattedAmount );
  19. list.add( modName );
  20. this.drawHoveringText( list, mouseX, mouseY );
  21. return;
  22. }
  23. }
  24. super.renderHoveredToolTip( mouseX, mouseY );
  25. }

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

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

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

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

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

  1. @Override
  2. protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
  3. GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  4. drawBackground(guiLeft, guiTop, mouseX, mouseY);
  5. this.hoveringFluid = null;
  6. for (int i = 0; i < inventorySlots.inventorySlots.size(); ++i) {
  7. Slot slot = inventorySlots.inventorySlots.get(i);
  8. if (slot.isEnabled() && slot instanceof SlotFilterFluid) {
  9. FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
  10. if (stack != null) {
  11. FLUID_RENDERER.draw(mc, guiLeft + slot.xPos, guiTop + slot.yPos, stack);
  12. if (((SlotFilterFluid) slot).isSizeAllowed()) {
  13. drawQuantity(guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.amount));
  14. GL11.glDisable(GL11.GL_LIGHTING);
  15. }
  16. if (inBounds(guiLeft + slot.xPos, guiTop + slot.yPos, 17, 17, mouseX, mouseY)) {
  17. this.hoveringFluid = stack.getLocalizedName();
  18. }
  19. }
  20. }
  21. }
  22. if (scrollbar != null) {
  23. GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  24. scrollbar.draw(this);
  25. }
  26. }

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

  1. @Override
  2. public void drawSlot(Slot slot) {
  3. mc.getTextureManager().bindTexture(this.getGuiBackground());
  4. if (slot instanceof ISlotOptional) {
  5. if (slot.isEnabled()) {
  6. // TODO: Draw slot background on enabled slots
  7. }
  8. } else if (slot instanceof SlotME && ((SlotME) slot).getAEStack() instanceof IAEItemStack) {
  9. SlotME slotME = (SlotME) slot;
  10. super.drawSlot(slot);
  11. stackSizeRenderer.renderStackSize(this.fontRenderer, (IAEItemStack) slotME.getAEStack(), slot.xPos, slot.yPos);
  12. return;
  13. } else if (slot instanceof ThESlot) {
  14. if (((ThESlot) slot).hasBackgroundIcon()) {
  15. int index = ((ThESlot) slot).getBackgroundIconIndex();
  16. int uv_y = (int) Math.floor((double) index / 16);
  17. int uv_x = index - uv_y * 16;
  18. Minecraft.getMinecraft().getTextureManager().bindTexture(((ThESlot) slot).getBackgroundIcon());
  19. GlStateManager.enableBlend();
  20. GlStateManager.disableLighting();
  21. GlStateManager.enableTexture2D();
  22. GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  23. GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
  24. this.drawTexturedModelRectColor(slot.xPos, slot.yPos, uv_x * 16, uv_y * 16, 16, 16, new Color(1f, 1f, 1f, 0.4f));
  25. //GlStateManager.enableLighting();
  26. }
  27. }
  28. super.drawSlot(slot);
  29. }

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

  1. @Override
  2. public void drawBackground(int x, int y, int mouseX, int mouseY) {
  3. bindTexture("gui/crafter_manager.png");
  4. drawTexture(x, y, 0, 0, screenWidth, getTopHeight());
  5. int rows = getVisibleRows();
  6. int yy = y;
  7. for (int i = 0; i < rows; ++i) {
  8. yy += 18;
  9. drawTexture(x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), screenWidth, 18);
  10. }
  11. yy += 18;
  12. drawTexture(x, yy, 0, getTopHeight() + (18 * 3), screenWidth, getBottomHeight());
  13. if (container != null && crafterManager.isActive()) {
  14. for (Slot slot : container.inventorySlots) {
  15. if (slot instanceof SlotCrafterManager && slot.isEnabled()) {
  16. drawTexture(x + slot.xPos - 1, y + slot.yPos - 1, 0, 193, 18, 18);
  17. }
  18. }
  19. }
  20. if (searchField != null) {
  21. searchField.drawTextBox();
  22. }
  23. }

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

  1. @Override
  2. protected void handleMouseClick(Slot slot, int slotId, int mouseButton, ClickType type) {
  3. boolean valid = type != ClickType.QUICK_MOVE && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty();
  4. if (valid && slot instanceof SlotFilter && slot.isEnabled() && ((SlotFilter) slot).isSizeAllowed()) {
  5. if (!slot.getStack().isEmpty()) {
  6. FMLClientHandler.instance().showGuiScreen(new GuiAmount(
  7. (GuiBase) Minecraft.getMinecraft().currentScreen,
  8. Minecraft.getMinecraft().player,
  9. slot.slotNumber,
  10. slot.getStack(),
  11. slot.getSlotStackLimit()
  12. ));
  13. }
  14. } else if (valid && slot instanceof SlotFilterFluid && slot.isEnabled() && ((SlotFilterFluid) slot).isSizeAllowed()) {
  15. FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
  16. if (stack != null) {
  17. FMLClientHandler.instance().showGuiScreen(new GuiFluidAmount(
  18. (GuiBase) Minecraft.getMinecraft().currentScreen,
  19. Minecraft.getMinecraft().player,
  20. slot.slotNumber,
  21. stack,
  22. ((SlotFilterFluid) slot).getFluidInventory().getMaxAmount()
  23. ));
  24. } else {
  25. super.handleMouseClick(slot, slotId, mouseButton, type);
  26. }
  27. } else {
  28. super.handleMouseClick(slot, slotId, mouseButton, type);
  29. }
  30. }

相关文章