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


Java CreativeTabs.CREATIVE_TAB_ARRAY属性代码示例

本文整理汇总了Java中net.minecraft.creativetab.CreativeTabs.CREATIVE_TAB_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java CreativeTabs.CREATIVE_TAB_ARRAY属性的具体用法?Java CreativeTabs.CREATIVE_TAB_ARRAY怎么用?Java CreativeTabs.CREATIVE_TAB_ARRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.creativetab.CreativeTabs的用法示例。


在下文中一共展示了CreativeTabs.CREATIVE_TAB_ARRAY属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseClicked

/**
 * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
 */
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
    if (mouseButton == 0)
    {
        int i = mouseX - this.guiLeft;
        int j = mouseY - this.guiTop;

        for (CreativeTabs creativetabs : CreativeTabs.CREATIVE_TAB_ARRAY)
        {
            if (this.isMouseOverTab(creativetabs, i, j))
            {
                return;
            }
        }
    }

    super.mouseClicked(mouseX, mouseY, mouseButton);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:GuiContainerCreative.java

示例2: mouseReleased

/**
 * Called when a mouse button is released.
 */
protected void mouseReleased(int mouseX, int mouseY, int state)
{
    if (state == 0)
    {
        int i = mouseX - this.guiLeft;
        int j = mouseY - this.guiTop;

        for (CreativeTabs creativetabs : CreativeTabs.CREATIVE_TAB_ARRAY)
        {
            if (this.isMouseOverTab(creativetabs, i, j))
            {
                this.setCurrentCreativeTab(creativetabs);
                return;
            }
        }
    }

    super.mouseReleased(mouseX, mouseY, state);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:GuiContainerCreative.java

示例3: updateCreativeSearch

private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    CreativeTabs tab = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];
    if (tab.hasSearchBar() && tab != CreativeTabs.SEARCH)
    {
        tab.displayAllRelevantItems(guicontainercreative$containercreative.itemList);
        updateFilteredItems(guicontainercreative$containercreative);
        return;
    }

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }
    updateFilteredItems(guicontainercreative$containercreative);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:GuiContainerCreative.java

示例4: mouseReleased

/**
 * Called when a mouse button is released.
 */
protected void mouseReleased(int mouseX, int mouseY, int state)
{
    if (state == 0)
    {
        int i = mouseX - this.guiLeft;
        int j = mouseY - this.guiTop;

        for (CreativeTabs creativetabs : CreativeTabs.CREATIVE_TAB_ARRAY)
        {
            if (creativetabs != null && this.isMouseOverTab(creativetabs, i, j))
            {
                this.setCurrentCreativeTab(creativetabs);
                return;
            }
        }
    }

    super.mouseReleased(mouseX, mouseY, state);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:GuiContainerCreative.java

示例5: getIC2Tab

public static void getIC2Tab()
{
	for (int i = 0; i < CreativeTabs.CREATIVE_TAB_ARRAY.length; i++) {
		if (CreativeTabs.CREATIVE_TAB_ARRAY[i].getTabLabel().equalsIgnoreCase("IC2")) {
			ic2Tab = CreativeTabs.CREATIVE_TAB_ARRAY[i];
		}
	}
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:8,代码来源:CompositeGear.java

示例6: drawGuiContainerForegroundLayer

/**
 * Draw the foreground layer for the GuiContainer (everything in front of the items)
 */
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    CreativeTabs creativetabs = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];

    if (creativetabs.drawInForegroundOfTab())
    {
        GlStateManager.disableBlend();
        this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:GuiContainerCreative.java

示例7: drawGuiContainerBackgroundLayer

/**
 * Draws the background layer of this container (behind the items).
 */
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.enableGUIStandardItemLighting();
    CreativeTabs creativetabs = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];

    for (CreativeTabs creativetabs1 : CreativeTabs.CREATIVE_TAB_ARRAY)
    {
        this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);

        if (creativetabs1.getTabIndex() != selectedTabIndex)
        {
            this.drawTab(creativetabs1);
        }
    }

    this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    this.searchField.drawTextBox();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    int i = this.guiLeft + 175;
    int j = this.guiTop + 18;
    int k = j + 112;
    this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);

    if (creativetabs.shouldHidePlayerInventory())
    {
        this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
    }

    this.drawTab(creativetabs);

    if (creativetabs == CreativeTabs.INVENTORY)
    {
        GuiInventory.drawEntityOnScreen(this.guiLeft + 88, this.guiTop + 45, 20, (float)(this.guiLeft + 88 - mouseX), (float)(this.guiTop + 45 - 30 - mouseY), this.mc.player);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:GuiContainerCreative.java

示例8: updateFilteredItems

private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
{
    if (CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex] == CreativeTabs.SEARCH) // FORGE: Only add enchanted books to the regular search
    for (Enchantment enchantment : Enchantment.REGISTRY)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.ENCHANTED_BOOK.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }
    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase();

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips))
        {
            if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:GuiContainerCreative.java

示例9: drawGuiContainerForegroundLayer

/**
 * Draw the foreground layer for the GuiContainer (everything in front of the items)
 */
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    CreativeTabs creativetabs = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];

    if (creativetabs != null && creativetabs.drawInForegroundOfTab())
    {
        GlStateManager.disableBlend();
        this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:GuiContainerCreative.java

示例10: drawScreen

/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    boolean flag = Mouse.isButtonDown(0);
    int i = this.guiLeft;
    int j = this.guiTop;
    int k = i + 175;
    int l = j + 18;
    int i1 = k + 14;
    int j1 = l + 112;

    if (!this.wasClicking && flag && mouseX >= k && mouseY >= l && mouseX < i1 && mouseY < j1)
    {
        this.isScrolling = this.needsScrollBars();
    }

    if (!flag)
    {
        this.isScrolling = false;
    }

    this.wasClicking = flag;

    if (this.isScrolling)
    {
        this.currentScroll = ((float)(mouseY - l) - 7.5F) / ((float)(j1 - l) - 15.0F);
        this.currentScroll = MathHelper.clamp(this.currentScroll, 0.0F, 1.0F);
        ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);

    for (CreativeTabs creativetabs : CreativeTabs.CREATIVE_TAB_ARRAY)
    {
        if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY))
        {
            break;
        }
    }

    if (this.destroyItemSlot != null && selectedTabIndex == CreativeTabs.INVENTORY.getTabIndex() && this.isPointInRegion(this.destroyItemSlot.xDisplayPosition, this.destroyItemSlot.yDisplayPosition, 16, 16, mouseX, mouseY))
    {
        this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY);
    }

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableLighting();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:GuiContainerCreative.java

示例11: renderToolTip

protected void renderToolTip(ItemStack stack, int x, int y)
{
    if (selectedTabIndex == CreativeTabs.SEARCH.getTabIndex())
    {
        List<String> list = stack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips);
        CreativeTabs creativetabs = stack.getItem().getCreativeTab();

        if (creativetabs == null && stack.getItem() == Items.ENCHANTED_BOOK)
        {
            Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack);

            if (map.size() == 1)
            {
                Enchantment enchantment = (Enchantment)map.keySet().iterator().next();

                for (CreativeTabs creativetabs1 : CreativeTabs.CREATIVE_TAB_ARRAY)
                {
                    if (creativetabs1.hasRelevantEnchantmentType(enchantment.type))
                    {
                        creativetabs = creativetabs1;
                        break;
                    }
                }
            }
        }

        if (creativetabs != null)
        {
            list.add(1, "" + TextFormatting.BOLD + TextFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
        }

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
            }
            else
            {
                list.set(i, TextFormatting.GRAY + (String)list.get(i));
            }
        }

        this.drawHoveringText(list, x, y);
    }
    else
    {
        super.renderToolTip(stack, x, y);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:GuiContainerCreative.java

示例12: needsScrollBars

/**
 * returns (if you are not on the inventoryTab) and (the flag isn't set) and (you have more than 1 page of items)
 */
private boolean needsScrollBars()
{
    if (CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex] == null) return false;
    return selectedTabIndex != CreativeTabs.INVENTORY.getTabIndex() && CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).canScroll();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:GuiContainerCreative.java

示例13: renderToolTip

protected void renderToolTip(ItemStack stack, int x, int y)
{
    if (selectedTabIndex == CreativeTabs.SEARCH.getTabIndex())
    {
        List<String> list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
        CreativeTabs creativetabs = stack.getItem().getCreativeTab();

        if (creativetabs == null && stack.getItem() == Items.ENCHANTED_BOOK)
        {
            Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack);

            if (map.size() == 1)
            {
                Enchantment enchantment = (Enchantment)map.keySet().iterator().next();

                for (CreativeTabs creativetabs1 : CreativeTabs.CREATIVE_TAB_ARRAY)
                {
                    if (creativetabs1.hasRelevantEnchantmentType(enchantment.type))
                    {
                        creativetabs = creativetabs1;
                        break;
                    }
                }
            }
        }

        if (creativetabs != null)
        {
            list.add(1, "" + TextFormatting.BOLD + TextFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
        }

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + (String)list.get(i));
            }
            else
            {
                list.set(i, TextFormatting.GRAY + (String)list.get(i));
            }
        }

        net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(stack);
        this.drawHoveringText(list, x, y);
        net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
    }
    else
    {
        super.renderToolTip(stack, x, y);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:52,代码来源:GuiContainerCreative.java

示例14: drawGuiContainerBackgroundLayer

/**
 * Draws the background layer of this container (behind the items).
 */
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.enableGUIStandardItemLighting();
    CreativeTabs creativetabs = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];

    int start = tabPage * 10;
    int end = Math.min(CreativeTabs.CREATIVE_TAB_ARRAY.length, ((tabPage + 1) * 10 + 2));
    if (tabPage != 0) start += 2;

    for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.CREATIVE_TAB_ARRAY,start,end))
    {
        this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);

        if (creativetabs1 == null) continue;
        if (creativetabs1.getTabIndex() != selectedTabIndex)
        {
            this.drawTab(creativetabs1);
        }
    }

    if (tabPage != 0)
    {
        if (creativetabs != CreativeTabs.SEARCH)
        {
            this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
            drawTab(CreativeTabs.SEARCH);
        }
        if (creativetabs != CreativeTabs.INVENTORY)
        {
            this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);
            drawTab(CreativeTabs.INVENTORY);
        }
    }

    this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    this.searchField.drawTextBox();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    int i = this.guiLeft + 175;
    int j = this.guiTop + 18;
    int k = j + 112;
    this.mc.getTextureManager().bindTexture(CREATIVE_INVENTORY_TABS);

    if (creativetabs.shouldHidePlayerInventory())
    {
        this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
    }

    if (creativetabs == null || creativetabs.getTabPage() != tabPage)
    {
        if (creativetabs != CreativeTabs.SEARCH && creativetabs != CreativeTabs.INVENTORY)
        {
            return;
        }
    }

    this.drawTab(creativetabs);

    if (creativetabs == CreativeTabs.INVENTORY)
    {
        GuiInventory.drawEntityOnScreen(this.guiLeft + 88, this.guiTop + 45, 20, (float)(this.guiLeft + 88 - mouseX), (float)(this.guiTop + 45 - 30 - mouseY), this.mc.thePlayer);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:67,代码来源:GuiContainerCreative.java


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