Created
January 22, 2018 01:08
-
-
Save codeHusky/3ce2a5c5c968c5f881dd17672f4decb3 to your computer and use it in GitHub Desktop.
example impl of hotbar items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RunnableAction testAction = new RunnableAction(registry, ActionType.NONE,""); | |
testAction.setRunnable(context -> { | |
StateContainer container = new StateContainer(); | |
Page testPage = Page.builder() | |
.setTitle(Text.of("WOAH")) | |
.build("testpage"); | |
container.setInitialState(testPage); | |
container.launchFor(context.getObserver()); | |
}); | |
ActionableElement testElement = new ActionableElement( | |
testAction, | |
ItemStack.builder() | |
.itemType(ItemTypes.COMPASS) | |
.add(Keys.DISPLAY_NAME, Text.of("hub compass thing")) | |
.build()); | |
registry.registerAutoElement(4,testElement); //places compass element in middle of hotbar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment