@SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { GuiScreen gui = event.getGui(); if(gui !=null && gui instanceof GuiScreenHorseInventory){ GuiScreenHorseInventory horseGui = (GuiScreenHorseInventory)gui; EntityHorse horse = (EntityHorse)ReflectionUtils.getPrivateValue(horseGui, GuiScreenHorseInventory.class, ObfuscatedNames.GuiScreenHorseInventory_horseEntity); if(horse !=null && HorseAccessories.hasEnderChest(horse)){ ContainerHorseChest animalchest = new ContainerHorseChest("HorseChest", 2); animalchest.setCustomName(horse.getName()); event.setGui(new GuiHorseEnderChest(CrystalMod.proxy.getClientPlayer().inventory, animalchest, horse)); PacketGuiMessage pkt = new PacketGuiMessage("Gui"); pkt.setOpenGui(GuiHandler.GUI_ID_ENTITY, horse.getEntityId(), 0, 0); CrystalModNetwork.sendToServer(pkt); } } }
@SideOnly(value = Side.CLIENT) @SubscribeEvent public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) { GuiScreen gui = event.getGui(); boolean showInvToggle = false; boolean showCraftToggle = false; if (gui instanceof GuiInventory || gui instanceof GuiPlayerExtended || gui instanceof GuiPlayerExtWorkbench || gui instanceof GuiScreenHorseInventory) { // gui left and top are private, so are the sizes int xSize = 176; int ySize = 166; int guiLeft = (gui.width - xSize) / 2; int guiTop = (gui.height - ySize) / 2; int x = 44 + guiLeft; int y = guiTop; EntityPlayer player = Minecraft.getMinecraft().player; final IPlayerExtendedProperties data = CapabilityRegistry.getPlayerProperties(player); showInvToggle = data.hasInventoryExtended();// && !(gui instanceof GuiPlayerExtWorkbench); showCraftToggle = data.hasInventoryCrafting();// && !(gui instanceof GuiPlayerExtended); if (event.getButtonList() == null) { event.setButtonList(new ArrayList<GuiButton>()); } if (showInvToggle) { event.getButtonList().add(new ButtonTabToggleInventory(gui, x, y)); } if (showCraftToggle) { event.getButtonList().add(new ButtonTabToggleCrafting(gui, x - 17, y));//the 17 is width + 2 } } }
public void displayGUIHorse(EntityHorse horse, IInventory horseInventory) { this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, horseInventory, horse)); }
public void openGuiHorseInventory(AbstractHorse horse, IInventory inventoryIn) { this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, inventoryIn, horse)); }
public void openGuiHorseInventory(EntityHorse horse, IInventory inventoryIn) { this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, inventoryIn, horse)); }
public void displayGUIHorse(EntityHorse par1EntityHorse, IInventory par2IInventory) { this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, par2IInventory, par1EntityHorse)); }
public void displayGUIHorse(EntityHorse p_110298_1_, IInventory p_110298_2_) { this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, p_110298_2_, p_110298_1_)); }
public void func_110298_a(EntityHorse p_110298_1_, IInventory p_110298_2_) { this.field_71159_c.func_71373_a(new GuiScreenHorseInventory(this.field_71071_by, p_110298_2_, p_110298_1_)); }