public GuiPortalModifier(InventoryPlayer player, TileEntityPortalModifier modifier) { super(new ContainerPortalModifier(player, modifier), null); portalModifier = modifier; hasInteractedWith = false; isActive = portalModifier.isActive(); extendedSlots.add( new GuiTextureSlot( xSize - 24, 15, Textures.getItemStackFromTexture(portalModifier.texture), this)); }
@Override protected void mouseClicked(int x, int y, int buttonClicked) { super.mouseClicked(x, y, buttonClicked); if (isPointInRegion(7, 46, 162, 18, x, y)) { PacketDispatcher.sendPacketToServer( PacketEnhancedPortals.makePacket( new PacketGui(portalModifier, GuiIds.PortalModifierNetwork))); } else if (isShiftKeyDown() && getSlotAtPosition(x, y) != null) { ItemStack itemStack = getSlotAtPosition(x, y).getStack(); PortalTexture Text = Textures.getTextureFromItemStack(itemStack); if (Text != null) { extendedSlots.get(0).setSlot(itemStack); } } }
@Override public void extendedSlotChanged(GuiExtendedItemSlot slot) { ItemStack stack = slot.getItemStack(); if (stack.itemID == EnhancedPortals_deprecated.proxy.blockDummyPortal.blockID) { stack = new ItemStack(Item.dyePowder, 1, stack.getItemDamage()); } PortalTexture text = Textures.getTextureFromItemStack(stack); if (text != null) { portalModifier.texture = text.getID(); } else { portalModifier.texture = "C:5"; } hasInteractedWith = true; }