Fixed explorer GUI to be able to use getSize() in onUpdate().

* BUG: getSize() always returns 0 in the onUpdate method of explorer GUIs.
This commit is contained in:
Amaury Carrade 2015-09-10 15:26:27 +02:00
parent a403efcd4e
commit 1ddc923b73

View File

@ -79,6 +79,13 @@ abstract public class ExplorerGui<T> extends ActionGui
private Mode mode = Mode.CREATIVE; private Mode mode = Mode.CREATIVE;
public ExplorerGui()
{
// Defined early to be able to use getSize() in the onUpdate method.
setSize(MAX_INVENTORY_SIZE);
}
/** /**
* Sets the displayed data. * Sets the displayed data.
* *
@ -343,8 +350,6 @@ abstract public class ExplorerGui<T> extends ActionGui
pageCountY = (int)Math.ceil((double)dataHeight / (double)viewHeight); pageCountY = (int)Math.ceil((double)dataHeight / (double)viewHeight);
} }
setSize(MAX_INVENTORY_SIZE);
if(pageCountX > 1) if(pageCountX > 1)
{ {
action("previous", MAX_INVENTORY_SIZE - INVENTORY_ROW_SIZE); action("previous", MAX_INVENTORY_SIZE - INVENTORY_ROW_SIZE);