Skip to content

Commit

Permalink
1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gliscowo committed Mar 23, 2023
1 parent 7629d10 commit a43d1ae
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 43 deletions.
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_base_version=1.19.3
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.4
loader_version=0.14.12
minecraft_base_version=1.19.4
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.18
# Mod Properties
mod_version=0.3.2
maven_group=com.glisco
archives_base_name=deathlog
# Dependencies
fabric_version=0.76.0+1.19.3
fabric_version=0.76.0+1.19.4

# https://github.com/emilyploszaj/trinkets/releases
trinkets_version=3.5.1
trinkets_version=3.6.0

# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version=5.0.2
modmenu_version=6.1.0-rc.4

# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.10.3+1.19.3
owo_version=0.10.3+1.19.4

56 changes: 21 additions & 35 deletions src/main/java/com/glisco/deathlog/client/gui/DeathLogScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class DeathLogScreen extends BaseUIModelScreen<FlowLayout> {
private final DirectDeathLogStorage storage;

private FlowLayout detailPanel;
private DropdownComponent activeDropdown = null;

private final Observable<String> currentSearchTerm = Observable.of("");
private boolean canRestore = true;
Expand Down Expand Up @@ -118,28 +117,29 @@ private void buildDeathList() {
container.mouseDown().subscribe((mouseX, mouseY, button) -> {
if (button != GLFW.GLFW_MOUSE_BUTTON_RIGHT) return false;

this.uiAdapter.rootComponent.removeChild(this.activeDropdown);
this.uiAdapter.rootComponent.child(Components.dropdown(Sizing.content()).<DropdownComponent>configure(dropdown -> {
this.activeDropdown = dropdown;

if (this.canRestore) {
dropdown.button(Text.translatable("text.deathlog.action.restore"), dropdown_ -> {
this.storage.restore(infoIndex);
this.removeDropdown();
});
}

dropdown.button(Text.translatable("text.deathlog.action.delete"), dropdown_ -> {
var root = this.uiAdapter.rootComponent;
DropdownComponent.openContextMenu(
this,
root, FlowLayout::child,
container.x() - root.padding().get().left() + mouseX,
container.y() - root.padding().get().top() + mouseY,
dropdown -> {
dropdown.surface(Surface.flat(0xBB000000).and(Surface.outline(0xA75F5F5F)));

if (this.canRestore) {
dropdown.button(Text.translatable("text.deathlog.action.restore"), dropdown_ -> {
this.storage.restore(infoIndex);
dropdown.remove();
});
}

dropdown.button(Text.translatable("text.deathlog.action.delete"), dropdown_ -> {
this.storage.delete(deathInfo);
this.buildDeathList();
this.removeDropdown();
})
.surface(Surface.flat(0xBB000000))
.positioning(Positioning.absolute(
container.x() + (int) mouseX - this.uiAdapter.rootComponent.padding().get().left(),
container.y() + (int) mouseY - this.uiAdapter.rootComponent.padding().get().top()
));
}));
dropdown.remove();
});
}
);

return true;
});
Expand Down Expand Up @@ -242,20 +242,6 @@ private ItemComponent makeItem(ItemStack stack, Insets margins) {
return item;
}

private void removeDropdown() {
this.uiAdapter.rootComponent.removeChild(this.activeDropdown);
this.activeDropdown = null;
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.activeDropdown != null && !this.activeDropdown.isInBoundingBox(mouseX, mouseY)) {
this.removeDropdown();
}

return super.mouseClicked(mouseX, mouseY, button);
}

@Override
public void close() {
this.client.setScreen(this.parent);
Expand Down

0 comments on commit a43d1ae

Please sign in to comment.