Samalot Posted August 2, 2016 Share Posted August 2, 2016 I feel like I am being a moron... is the location that each Slot is drawn in a custom GUI determined from the custom container? I have dug through the source code and the only mention of coordinates I can find about drawing the slots is from the container class. With that being said: What exactly are the coordinates measured in? I presume pixels, but where from - the origin? In the GUI class, it is possible to reference width and height, so that you can draw each box relative to the screen size... however, if you aren't drawing the slots relative to this, there isn't much point Is there a way to draw slots onto a gui respective to the size of the clients screen? Essentially, I have multiple GUI components that have different widths/heights and would like them all (and their corresponding slot spaces) to be in the centre of the clients screen. This is easy for the GUI components (width / height), but I cant figure out how to achieve it with slots. Thanks in advance. From CustomContainer (extends Container.class) for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { addSlotToContainer(new Slot(parInventoryPlayer, j+i*9+9, 8+j*18, 184+i*18)); } } From Container.class: protected Slot addSlotToContainer(Slot slotIn) { slotIn.slotNumber = this.inventorySlots.size(); this.inventorySlots.add(slotIn); this.inventoryItemStacks.add((Object)null); return slotIn; } From Slot.class: public Slot(IInventory inventoryIn, int index, int xPosition, int yPosition) { this.inventory = inventoryIn; this.slotIndex = index; this.xDisplayPosition = xPosition; this.yDisplayPosition = yPosition; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.