Skip to content

Instantly share code, notes, and snippets.

@codeHusky
Created January 22, 2018 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeHusky/3ce2a5c5c968c5f881dd17672f4decb3 to your computer and use it in GitHub Desktop.
Save codeHusky/3ce2a5c5c968c5f881dd17672f4decb3 to your computer and use it in GitHub Desktop.
example impl of hotbar items
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