當前位置: 首頁>>代碼示例>>Java>>正文


Java GuiContainer類代碼示例

本文整理匯總了Java中net.minecraft.client.gui.inventory.GuiContainer的典型用法代碼示例。如果您正苦於以下問題:Java GuiContainer類的具體用法?Java GuiContainer怎麽用?Java GuiContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GuiContainer類屬於net.minecraft.client.gui.inventory包,在下文中一共展示了GuiContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawPotionEffect

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
public static void drawPotionEffect(PotionEffect potion, int x, int y) {
    int index = potion.getPotion().getStatusIconIndex();
    GlStateManager.pushMatrix();
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.disableLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableColorMaterial();
    GlStateManager.enableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.color(1.f, 1.f, 1.f, 1.f);
    MC.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND);
    drawTexturedRect(x, y, index % 8 * 18, 198 + index / 8 * 18, 18, 18, 100);
    potion.getPotion().renderHUDEffect(x, y, potion, MC, 255);
    GlStateManager.disableLighting();
    GlStateManager.enableDepth();
    GlStateManager.color(1.f, 1.f, 1.f, 1.f);
    GlStateManager.popMatrix();
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:19,代碼來源:SurfaceHelper.java

示例2: ModuleChestStealer

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
public ModuleChestStealer() {
    super("ChestStealer", "steals chest", Ordering.OTHER, 0, 0);
    addValue(mode, delay, validate, itemFilter, itemFilterMode);
    addTicker(new Ticker("cheststealer_ticker", () -> {
        if (Wrapper.theWorld() == null) return;
        if (Wrapper.currentScreen() == null || !(Wrapper.currentScreen() instanceof GuiChest)) return;
        GuiChest chest = (GuiChest) Wrapper.currentScreen();

        if (validate.getValue() && !ItemUtil.isValidChest(chest)) return;

        int item = (mode.getCurrent().equalsIgnoreCase("vertical") ? getItemVertical(chest) : mode.getCurrent().equalsIgnoreCase("horizontal") ? getItemHorizontal(chest) : getItemRandom(chest));

        if (item == -1 || ItemUtil.isChestEmpty(chest) || ItemUtil.player_inventoryFull()) {
            try {
                Thread.sleep(100, 150);
            } catch (InterruptedException e) {
            }
            Wrapper.displayGuiScreen(null);
            return;
        }

        sleep((long) Math.floor(delay.getValue() / 1.5 + ThreadLocalRandom.current().nextInt((int) delay.getValue() / 4, (int) delay.getValue() / 3)));
        Wrapper.windowClick(Wrapper.inventoryId((Container) ReflectionUtil.getFieldValue("field_147002_h", chest, GuiContainer.class)), item, 0, ClickMode.QUICK_MOVE);
    }));
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:26,代碼來源:ModuleChestStealer.java

示例3: checks

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
private boolean checks() {

        if (!Mouse.isButtonDown(Wrapper.convertKeyToLWJGL(Wrapper.getKeyCode(Wrapper.keybindAttack()))))
            return false;

        if (Wrapper.theWorld() == null || Wrapper.thePlayer() == null)
            return false;

        if (Bit.getInstance().getGlobalValueManager().find_bool("weapon only").getValue()
                && !Wrapper.isHoldingWeapon() && Wrapper.currentScreen() == null)
            return false;

        if ((Wrapper.currentScreen() != null && !inventory.getValue()) || (inventory.getValue() && Wrapper.currentScreen() != null && !(Wrapper.currentScreen() instanceof GuiContainer)))
            return false;

        if (Wrapper.player_isUsingItem() || Wrapper.player_isBlocking())
            return false;

        return true;
    }
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:21,代碼來源:ModuleAutoclicker.java

示例4: onItemStackTooltip

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOW)
public void onItemStackTooltip(RenderTooltipEvent.Pre event) {
	if (!Config.isToggledEnabled() && !isEnableKeyHeld()) {
		return;
	}
	ItemStack itemStack = event.getStack();
	//noinspection ConstantConditions
	if (itemStack == null || itemStack.isEmpty()) {
		return;
	}
	if (Config.isJeiOnly() && !ItemStack.areItemStacksEqual(itemStack, JeiCompat.getStackUnderMouse())) {
		return;
	}

	Minecraft minecraft = Minecraft.getMinecraft();
	GuiScreen currentScreen = minecraft.currentScreen;
	if (currentScreen instanceof GuiContainer) {
		GuiContainer guiContainer = (GuiContainer) currentScreen;
		renderZoomedStack(itemStack, guiContainer, minecraft);
	}
}
 
開發者ID:mezz,項目名稱:ItemZoom,代碼行數:22,代碼來源:EventHandler.java

示例5: load

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@Override
public void load(GuiContainer gui) {
    if (isEnabled()) {
        setInputFocused(null);

        ItemList.loadItems.restart();

        getLayoutStyle().init();
        layout(gui);
    }

    NEIController.load(gui);

    if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+
    {
        gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us
    }
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:19,代碼來源:LayoutManager.java

示例6: clearCraftingGridOfItems

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
private static boolean clearCraftingGridOfItems(GuiContainer gui, SlotRange range, RecipeStorage recipes, boolean nonMatchingOnly)
{
    int numSlots = gui.inventorySlots.inventorySlots.size();

    for (int i = 0, slotNum = range.getFirst();
        i < range.getSlotCount() && i < recipes.getSelectedRecipe().getRecipeLength() && slotNum < numSlots;
        i++, slotNum++)
    {
        Slot slotTmp = gui.inventorySlots.getSlot(slotNum);

        if (slotTmp != null && slotTmp.getHasStack() &&
            (nonMatchingOnly == false || areStacksEqual(recipes.getSelectedRecipe().getRecipe()[i], slotTmp.getStack()) == false))
        {
            shiftClickSlot(gui, slotNum);

            // Failed to clear the slot
            if (slotTmp.getHasStack())
            {
                return false;
            }
        }
    }

    return true;
}
 
開發者ID:maruohon,項目名稱:itemscroller,代碼行數:26,代碼來源:InventoryUtils.java

示例7: mouseClicked

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if (stackover == null || !(gui instanceof GuiRecipe)) {
        return false;
    }

    if (button == 0) {
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
    }

    if (button == 1) {
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    }

    return false;
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:18,代碼來源:RecipeItemInputHandler.java

示例8: load

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@Override
public void load(GuiContainer gui) {
    if (isEnabled()) {
        setInputFocused(null);

        ItemList.loadItems.restart();
        overlayRenderer = null;

        getLayoutStyle().init();
        layout(gui);
    }

    NEIController.load(gui);

    if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+
        gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us
}
 
開發者ID:SneakyTactician,項目名稱:BIGB,代碼行數:18,代碼來源:LayoutManager.java

示例9: foregroundRenderEvent

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@SubscribeEvent
public void foregroundRenderEvent(GuiContainerEvent.DrawForeground event) {
    GuiContainer container = event.getGuiContainer();
    GlStateTracker.pushState();
    Point mousePos = GuiDraw.getMousePosition();

    GlStateManager.translate(-container.getGuiLeft(), -container.getGuiTop(), 100F);
    drawHandlers.forEach(handler -> handler.renderObjects(container, mousePos.x, mousePos.y));

    drawHandlers.forEach(handler -> handler.postRenderObjects(container, mousePos.x, mousePos.y));

    GlStateManager.translate(container.getGuiLeft(), container.getGuiTop(), -100F);
    GuiHelper.enable3DRender();

    GlStateManager.pushMatrix();
    for (Slot slot : container.inventorySlots.inventorySlots) {
        GlStateTracker.pushState();
        drawHandlers.forEach(handler -> handler.renderSlotOverlay(container, slot));
        GlStateTracker.popState();
    }
    GlStateManager.popMatrix();

    GlStateTracker.popState();
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:25,代碼來源:NEIClientEventHandler.java

示例10: handleItemDisplayName

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@Override
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack stack, List<String> currenttip) {
    String overridename = ItemInfo.getNameOverride(stack);
    if (overridename != null)
        currenttip.set(0, overridename);

    String mainname = currenttip.get(0);
    if (showIDs()) {
        mainname += " " + Item.getIdFromItem(stack.getItem());
        if (stack.getItemDamage() != 0)
            mainname += ":" + stack.getItemDamage();

        currenttip.set(0, mainname);
    }

    return currenttip;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:18,代碼來源:LayoutManager.java

示例11: mapIngredSlots

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients)
{
    Slot[][] recipeSlotList = new Slot[ingredients.size()][];
    for(int i = 0; i < ingredients.size(); i++)//identify slots
    {
        LinkedList<Slot> recipeSlots = new LinkedList<Slot>();
        PositionedStack pstack = ingredients.get(i);
        for(Slot slot : (List<Slot>)gui.inventorySlots.inventorySlots)
        {
            if(slot.xDisplayPosition == pstack.relx+offsetx && slot.yDisplayPosition == pstack.rely+offsety)
            {
                recipeSlots.add(slot);
                break;
            }
        }
        recipeSlotList[i] = recipeSlots.toArray(new Slot[0]);
    }
    return recipeSlotList;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:21,代碼來源:DefaultOverlayHandler.java

示例12: overlayRecipe

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
    final List<PositionedStack> ingredients = (List<PositionedStack>)recipe.getIngredientStacks(recipeIndex);
    final List<DistributedIngred> ingredStacks = this.getPermutationIngredients(ingredients);
    if (!this.clearIngredients(gui, ingredients)) {
        return;
    }
    this.findInventoryQuantities(gui, ingredStacks);
    final List<IngredientDistribution> assignedIngredients = this.assignIngredients(ingredients, ingredStacks);
    if (assignedIngredients == null) {
        return;
    }
    this.assignIngredSlots(gui, ingredients, assignedIngredients);
    final int quantity = this.calculateRecipeQuantity(assignedIngredients);
    if (quantity != 0) {
        this.moveIngredients(gui, assignedIngredients, quantity);
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:18,代碼來源:FMPMicroBlocksOverlayHandler.java

示例13: setExternalGuiPosition

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
public void setExternalGuiPosition(GuiScreen gui)
{
    if (gui instanceof GuiContainer) {
        final int candidateGuiLeft = ((GuiContainer) gui).getGuiLeft();
        final int candidateGuiTop = ((GuiContainer) gui).getGuiTop();

        // -- NOTE --
        // The creative inventory would cause this method to be fired twice, once for
        // net.minecraft.client.gui.inventory.GuiContainerCreative (with correct values)
        // and once for net.minecraft.client.gui.inventory.GuiInventory (with wrong values).
        //
        // I ignore the second call so the gui overlay preserves the correct values.
        if (gui instanceof GuiInventory && candidateGuiLeft == 0 && candidateGuiTop == 0) { return; }

        this._externalGuiLeft = candidateGuiLeft;
        this._externalGuiTop = candidateGuiTop;

    } else {
        this._externalGuiLeft = -1;
        this._externalGuiTop = -1;

    }

    LogHelper.trace("GuiExtraSlotsOverlay.setExternalGuiPosition() - left: %d, top: %d", this._externalGuiLeft, this._externalGuiTop);
}
 
開發者ID:sidben,項目名稱:VisibleArmorSlots,代碼行數:26,代碼來源:GuiExtraSlotsOverlay.java

示例14: renderObjects

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@Override
public void renderObjects(GuiContainer gui, int mousex, int mousey) {
    if (!isHidden()) {
        layout(gui);
        if (isEnabled()) {
            getLayoutStyle().drawBackground(gui);
            for (Widget widget : drawWidgets) {
                widget.draw(mousex, mousey);
            }
        } else {
            options.draw(mousex, mousey);
        }

        GlStateManager.enableLighting();
        GlStateManager.disableDepth();
    } else {
        showItemPanel = false;
    }
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:20,代碼來源:LayoutManager.java

示例15: mapIngredSlots

import net.minecraft.client.gui.inventory.GuiContainer; //導入依賴的package包/類
@SuppressWarnings ("unchecked")
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients) {
    Slot[][] recipeSlotList = new Slot[ingredients.size()][];
    for (int i = 0; i < ingredients.size(); i++)//identify slots
    {
        LinkedList<Slot> recipeSlots = new LinkedList<>();
        PositionedStack pstack = ingredients.get(i);
        for (Slot slot : gui.inventorySlots.inventorySlots) {
            if (slot.xPos == pstack.relx + offsetx && slot.yPos == pstack.rely + offsety) {
                recipeSlots.add(slot);
                break;
            }
        }
        recipeSlotList[i] = recipeSlots.toArray(new Slot[0]);
    }
    return recipeSlotList;
}
 
開發者ID:TheCBProject,項目名稱:NotEnoughItems,代碼行數:18,代碼來源:DefaultOverlayHandler.java


注:本文中的net.minecraft.client.gui.inventory.GuiContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。