Skip to content

Commit

Permalink
Update 1.18.1 data sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjackson committed Jan 3, 2022
1 parent 67183df commit 57b8539
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ public void onInitializeClient() {
BlockEntityRendererRegistry.INSTANCE.register(ProjectorMod.DISPLAY_ENTITY, DisplayEntityRenderer::new);

DisplayClicked.EVENT.register((block, callback) -> {
DisplayGui gui = new DisplayGui(block);
DisplayGui gui = new DisplayGui(block, callback);
DisplayScreen screen = new DisplayScreen(gui);
MinecraftClient.getInstance().setScreen(screen);

// set the default state
// gui.setup(block, callback);

return ActionResult.PASS;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
if (!blockEntity.detectNearbyBlocks().mainBlock) {
return ActionResult.SUCCESS;
}

// call the event that is handled in the client mod
DisplayClicked.EVENT.invoker().interact(blockEntity, () -> {
blockEntity.markForUpdate();
Expand Down
23 changes: 3 additions & 20 deletions src/main/java/com/github/hashicraft/projector/ui/DisplayGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
public class DisplayGui extends LightweightGuiDescription {
private ArrayList<WTextField> urlFields = new ArrayList<WTextField>();

private DisplayEntity currentEntity;
private DisplayGuiCallback callback;

public DisplayGui(DisplayEntity display) {
public DisplayGui(DisplayEntity display, DisplayGuiCallback callback) {
ArrayList<String> urls = display.getPictures();


WGridPanel root = new WGridPanel();
setRootPanel(root);
root.setInsets(Insets.ROOT_PANEL);
Expand Down Expand Up @@ -71,10 +67,10 @@ public DisplayGui(DisplayEntity display) {
}

// notify the opener that the dialog has completed
// this.callback.onSave();
callback.onSave();

MinecraftClient.getInstance().player.closeScreen();
MinecraftClient.getInstance().setScreen((Screen)null);
MinecraftClient.getInstance().setScreen((Screen) null);
});

root.add(button, 0, 7, 16, 1);
Expand All @@ -87,17 +83,4 @@ public DisplayGui(DisplayEntity display) {

root.validate(this);
}

// public void setup(DisplayEntity pictureBlockEntity, DisplayGuiCallback callback) {
// this.currentEntity = pictureBlockEntity;
// this.callback = callback;

// ArrayList<String> urls = pictureBlockEntity.getPictures();

// int n = 0;
// for (String url : urls) {
// urlFields.get(n).setText(url);
// n++;
// }
// }
}

0 comments on commit 57b8539

Please sign in to comment.