本文整理汇总了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);
}));
}
示例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;
}
示例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;
}
}
示例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));
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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));
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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);
}
});
}
示例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;
}
示例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;
}