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


Java GuiChest类代码示例

本文整理汇总了Java中net.minecraft.client.gui.inventory.GuiChest的典型用法代码示例。如果您正苦于以下问题:Java GuiChest类的具体用法?Java GuiChest怎么用?Java GuiChest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ModuleChestStealer

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的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

示例2: getItemVertical

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:24,代码来源:ModuleChestStealer.java

示例3: getItemRandom

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:17,代码来源:ModuleChestStealer.java

示例4: displayGUIChest

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
/**
 * 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));
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:EntityPlayerSP.java

示例5: generate2DInventoryArray

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:16,代码来源:ModuleChestStealer.java

示例6: getItemHorizontal

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
    }
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:13,代码来源:ModuleChestStealer.java

示例7: isChestEmpty

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:8,代码来源:ItemUtil.java

示例8: isValidChest

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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);
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:8,代码来源:ItemUtil.java

示例9: displayGUIChest

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:37,代码来源:EntityPlayerSP.java

示例10: displayGUIChest

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:EntityPlayerSP.java

示例11: create

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
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;
}
 
开发者ID:sidben,项目名称:VisibleArmorSlots,代码行数:30,代码来源:InfoGuiOverlayDisplayParams.java

示例12: getClientGuiElement

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
@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;
}
 
开发者ID:DracoAnimus,项目名称:Coding,代码行数:14,代码来源:GuiHandler.java

示例13: onOpenGui

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
@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);
		}
	});
}
 
开发者ID:FyberOptic,项目名称:JustBackpack,代码行数:30,代码来源:ClientProxy.java

示例14: getClientGuiElement

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
@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;
}
 
开发者ID:andykuo1,项目名称:mcplus_mods,代码行数:13,代码来源:GuiHandlerSatchel.java

示例15: isDoubleChest

import net.minecraft.client.gui.inventory.GuiChest; //导入依赖的package包/类
public static boolean isDoubleChest(GuiChest chest) {
    return ((IInventory) ReflectionUtil.getFieldValue("field_147015_w", chest)).func_70302_i_() == 54;
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:4,代码来源:ItemUtil.java


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