Java 类net.minecraft.client.gui.inventory.GuiChest 实例源码

项目:bit-client    文件:ModuleChestStealer.java   
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);
    }));
}
项目:bit-client    文件:ModuleChestStealer.java   
private int getItemVertical(GuiChest chest) {
    int[][] array = generate2DInventoryArray(chest);

    int offset = 0;

    int row = 0;

    while (true) {
        ItemStack i = ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70301_a(array[row][offset]);

        if (i != null && ((itemFilter.getValue() && !ItemUtil.isUseless(i, itemFilterMode.getCurrent())) || !itemFilter.getValue()))
            return array[row][offset];

        row++;

        if (row >= 3) {
            row = 0;
            offset++;
            if (offset > 8) break;
        }
    }
    return -1;
}
项目:bit-client    文件:ModuleChestStealer.java   
private int getItemRandom(GuiChest chest) {
    try {
        if (Wrapper.player_inventory() == null) return -1;
        List<Integer> items = new ArrayList<>();
        for (int i = 0; i < ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_(); i++) {
            ItemStack stack = ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70301_a(i);
            if (stack != null && ((itemFilter.getValue() && !ItemUtil.isUseless(stack, itemFilterMode.getCurrent())) || !itemFilter.getValue()))
                items.add(i);
        }
        if (items.isEmpty()) return -1;
        Collections.shuffle(items);
        return items.get(0);
    } catch (Exception e) {
        return -1;
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory) {
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject) chestInventory).getGuiID()
            : "minecraft:container";

    if ("minecraft:chest".equals(s)) {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    } else if ("minecraft:hopper".equals(s)) {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    } else if ("minecraft:furnace".equals(s)) {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    } else if ("minecraft:brewing_stand".equals(s)) {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    } else if ("minecraft:beacon".equals(s)) {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    } else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s)) {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    } else {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:bit-client    文件:ModuleChestStealer.java   
private int[][] generate2DInventoryArray(GuiChest chest) {
    int[][] array = new int[((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_() / 9][9];
    int row = 0;
    int i = 0;
    for (int slot = 0; slot < ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_(); slot++) {
        array[row][i] = slot;
        if (i % 8 == 0 && i >= 8) {
            i = 0;
            row++;
            continue;
        }
        i++;
    }
    return array;
}
项目:bit-client    文件:ModuleChestStealer.java   
private int getItemHorizontal(GuiChest chest) {
    try {
        for (int i = 0; i < ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_(); i++) {
            ItemStack stack = ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70301_a(i);
            if (stack != null && ((itemFilter.getValue() && !ItemUtil.isUseless(stack, itemFilterMode.getCurrent())) || !itemFilter.getValue()))
                return i;
        }
        return -1;
    } catch (Exception e) {
        return -1;
    }
}
项目:bit-client    文件:ItemUtil.java   
public static boolean isChestEmpty(GuiChest chest) {
    for (int i = 0; i < ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_(); i++) {
        ItemStack stack = ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70301_a(i);
        if (stack != null) return false;
    }
    return true;
}
项目:bit-client    文件:ItemUtil.java   
public static boolean isValidChest(GuiChest chest) {
    if (chest == null) return false;
    IInventory inventory = ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest));
    int size = inventory.func_70302_i_();
    String title = inventory.func_145825_b();
    return (title.toLowerCase().contains("chest") || title.toLowerCase().contains("tier")) && (size == 27 || size == 54);
}
项目:DecompiledMinecraft    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:CustomWorldGen    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:VisibleArmorSlots    文件:InfoGuiOverlayDisplayParams.java   
public static InfoGuiOverlayDisplayParams create(GuiContainer gui, String guiClassName)
{
    if (gui == null) { return InfoGuiOverlayDisplayParams.EMPTY; }


    // Check for blacklisted gui's
    if (isBlacklisted(gui)) { return InfoGuiOverlayDisplayParams.EMPTY; }


    int overlayX = 0;
    int overlayY = 0;

    if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_LEFT)) {
        overlayX = gui.getGuiLeft() - GuiExtraSlotsOverlay.GUI_WIDTH - ModConfig.extraSlotsMargin();
    } else if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_RIGHT)) {
        overlayX = gui.getGuiLeft() + gui.getXSize() + ModConfig.extraSlotsMargin();
    }
    overlayY = gui.getGuiTop() + gui.getYSize() - GuiExtraSlotsOverlay.GUI_HEIGHT - 4;


    // HOTFIX: Chest containers have their height (YSize) wrong
    if (gui instanceof GuiChest || gui instanceof GuiShulkerBox) {
        overlayY -= 1;
    }


    final InfoGuiOverlayDisplayParams displayParams = new InfoGuiOverlayDisplayParams(overlayX, overlayY, true);
    return displayParams;
}
项目:Coding    文件:GuiHandler.java   
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    if(ID==ID_HOARD){
        /**
         * Create a new GuiChest, but replace the container by a modified version
         */
        TileEntityTemporaryHoard tile=(TileEntityTemporaryHoard) world.getTileEntity(x, y, z);
        GuiChest gui=new GuiChest(player.inventory,tile.getInventory());
        gui.inventorySlots=tile.getNewInventoryContainer(player.inventory);
        return gui;
    }
    return null;
}
项目:JustBackpack    文件:ClientProxy.java   
@Override
//public void onOpenGui(EntityPlayerSP player, IInteractionObject guiObject)
public void onOpenGui(EntityPlayerSP player, String guiID, IChatComponent displayName, int slots)
{       
    String backpackName = displayName.c();
    int slotNum = -1;

    if (backpackName.contains("|")) {
        String[] split = backpackName.split("\\|");
        if (split.length > 1) {             
            backpackName = backpackName.substring(split[0].length() + 1);
            try {
                slotNum = Integer.parseInt(split[0]);
            }
            catch (NumberFormatException e) {}
        }
    }

    IInventory backpackInventory = new InventoryBasic(backpackName, true, 9 * 3);       
    final int finalSlot = slotNum;

    Minecraft.getMinecraft().displayGuiScreen(new GuiChest(player.inventory, backpackInventory) {
        @Override
        protected void handleMouseClick(Slot param0, int param1, int param2, EnumContainerAction param3) {              
            if (param0 != null && finalSlot == param0.slotIndex) return;
            else super.handleMouseClick(param0, param1, param2, param3);
        }
    });
}
项目:ExpandedRailsMod    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:mcplus_mods    文件:GuiHandlerSatchel.java   
@Override
public Object getClientGuiElement(int parID, EntityPlayer parPlayer, World parWorld, int parX, int parY, int parZ)
{
    switch(parID)
    {
    case 0:
        return new GuiSatchel(parPlayer, parPlayer.getCurrentEquippedItem());
    case 1:
        return new GuiChest(parPlayer.inventory, parPlayer.getInventoryEnderChest());
    }
    return null;
}
项目:bit-client    文件:ItemUtil.java   
public static boolean isDoubleChest(GuiChest chest) {
    return ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_() == 54;
}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        if ("minecraft:shulker_box".equals(s))
        {
            this.mc.displayGuiScreen(new GuiShulkerBox(this.inventory, chestInventory));
        }
        else
        {
            this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
        }
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:Backmemed    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory.
 */
public void displayGUIChest(IInventory chestInventory)
{
    String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container";

    if ("minecraft:chest".equals(s))
    {
        this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
    }
    else if ("minecraft:hopper".equals(s))
    {
        this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory));
    }
    else if ("minecraft:furnace".equals(s))
    {
        this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory));
    }
    else if ("minecraft:brewing_stand".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory));
    }
    else if ("minecraft:beacon".equals(s))
    {
        this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory));
    }
    else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s))
    {
        if ("minecraft:shulker_box".equals(s))
        {
            this.mc.displayGuiScreen(new GuiShulkerBox(this.inventory, chestInventory));
        }
        else
        {
            this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory));
        }
    }
    else
    {
        this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory));
    }
}
项目:4Space-5    文件:NEIChestGuiHandler.java   
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
    return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.<Integer>emptyList();
}
项目:4Space-5    文件:NEIChestGuiHandler.java   
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
    return gui instanceof GuiChest ? Arrays.asList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
}
项目:BIGB    文件:NEIChestGuiHandler.java   
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
    return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.<Integer>emptyList();
}
项目:BIGB    文件:NEIChestGuiHandler.java   
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
    return gui instanceof GuiChest ? Arrays.asList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
}
项目:Alchemy    文件:ItemRingSpace.java   
@Override
@SideOnly(Side.CLIENT)
public Object getClientGuiElement(EntityPlayer player, World world, int x, int y, int z) {
    InventoryItem inventory = getInventory(getFormLiving(player));
    return inventory == null ? null : new GuiChest(player.inventory, inventory);
}
项目:NotEnoughItems    文件:NEIChestGuiHandler.java   
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
    return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
}
项目:NotEnoughItems    文件:NEIChestGuiHandler.java   
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
    return gui instanceof GuiChest ? Collections.singletonList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
}
项目:Resilience-Client-Source    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    this.mc.displayGuiScreen(new GuiChest(this.inventory, par1IInventory));
}
项目:Cauldron    文件:EntityPlayerSP.java   
public void displayGUIChest(IInventory p_71007_1_)
{
    this.mc.displayGuiScreen(new GuiChest(this.inventory, p_71007_1_));
}
项目:Cauldron    文件:EntityPlayerSP.java   
public void displayGUIChest(IInventory p_71007_1_)
{
    this.mc.displayGuiScreen(new GuiChest(this.inventory, p_71007_1_));
}
项目:RuneCraftery    文件:EntityPlayerSP.java   
public void func_71007_a(IInventory p_71007_1_) {
   this.field_71159_c.func_71373_a(new GuiChest(this.field_71071_by, p_71007_1_));
}
项目:RuneCraftery    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    this.mc.displayGuiScreen(new GuiChest(this.inventory, par1IInventory));
}
项目:BetterNutritionMod    文件:EntityPlayerSP.java   
/**
 * Displays the GUI for interacting with a chest inventory. Args: chestInventory
 */
public void displayGUIChest(IInventory par1IInventory)
{
    this.mc.displayGuiScreen(new GuiChest(this.inventory, par1IInventory));
}