Skip to content

Commit

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

# https://github.com/emilyploszaj/trinkets/releases
trinkets_version=3.6.0
# while we wait for an official release
# https://maven.wispforest.io/dev/emi/trinkets/
trinkets_version=3.7.0-pre.3

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void store(Text deathMessage, PlayerEntity player) {
deathInfo.setProperty(DeathInfo.INVENTORY_KEY, new InventoryProperty(player.getInventory()));

deathInfo.setProperty(DeathInfo.COORDINATES_KEY, new CoordinatesProperty(player.getBlockPos()));
deathInfo.setProperty(DeathInfo.DIMENSION_KEY, new StringProperty("deathlog.deathinfoproperty.dimension", player.world.getRegistryKey().getValue().toString()));
deathInfo.setProperty(DeathInfo.DIMENSION_KEY, new StringProperty("deathlog.deathinfoproperty.dimension", player.getWorld().getRegistryKey().getValue().toString()));

if (client.isInSingleplayer()) {
deathInfo.setProperty(DeathInfo.LOCATION_KEY, new LocationProperty(((MinecraftServerAccessor) client.getServer()).deathlog_getSession().getDirectoryName(), false));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package com.glisco.deathlog.client.gui;

import io.wispforest.owo.ui.container.HorizontalFlowLayout;
import io.wispforest.owo.ui.core.Animation;
import io.wispforest.owo.ui.core.Easing;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Sizing;
import io.wispforest.owo.ui.util.Drawer;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.*;
import io.wispforest.owo.ui.util.UISounds;
import io.wispforest.owo.util.EventSource;
import io.wispforest.owo.util.EventStream;
import net.minecraft.client.util.math.MatrixStack;
import org.lwjgl.glfw.GLFW;

public class DeathListEntryContainer extends HorizontalFlowLayout {
public class DeathListEntryContainer extends FlowLayout {

protected final EventStream<OnSelected> selectedEvents = OnSelected.newStream();
protected final Animation<Insets> slideAnimation;
Expand All @@ -21,7 +16,7 @@ public class DeathListEntryContainer extends HorizontalFlowLayout {
protected boolean selected = false;

public DeathListEntryContainer() {
super(Sizing.content(), Sizing.content());
super(Sizing.content(), Sizing.content(), Algorithm.HORIZONTAL);
this.slideAnimation = this.padding.animate(150, Easing.QUADRATIC, this.padding.get().add(0, 0, 5, 0));
}

Expand All @@ -30,9 +25,9 @@ public EventSource<OnSelected> onSelected() {
}

@Override
public void draw(MatrixStack matrices, int mouseX, int mouseY, float partialTicks, float delta) {
super.draw(matrices, mouseX, mouseY, partialTicks, delta);
if (this.selected) Drawer.drawRectOutline(matrices, this.x, this.y, this.width, this.height, 0xFFAFAFAF);
public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partialTicks, float delta) {
super.draw(context, mouseX, mouseY, partialTicks, delta);
if (this.selected) context.drawRectOutline(this.x, this.y, this.width, this.height, 0xFFAFAFAF);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.glisco.deathlog.client.gui;

import com.glisco.deathlog.mixin.SystemToastAccessor;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.toast.SystemToast;
import net.minecraft.client.toast.Toast;
import net.minecraft.client.toast.ToastManager;
Expand All @@ -15,8 +16,8 @@ public DeathLogToast(Type type, Text title, @Nullable Text description) {
}

@Override
public Visibility draw(MatrixStack matrices, ToastManager manager, long startTime) {
super.draw(matrices, manager, startTime);
public Visibility draw(DrawContext context, ToastManager manager, long startTime) {
super.draw(context, manager, startTime);
return startTime - ((SystemToastAccessor) this).deathlog_getStartTime() < 10000L ? Toast.Visibility.SHOW : Toast.Visibility.HIDE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.glisco.deathlog.client.DeathLogClient;
import com.glisco.deathlog.client.gui.DeathLogToast;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.toast.SystemToast;
import net.minecraft.client.util.math.MatrixStack;
Expand All @@ -20,7 +21,7 @@ public class TitleScreenMixin {
private static boolean firstRenderCompleted = false;

@Inject(method = "render", at = @At("HEAD"))
private void onFirstRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
private void onFirstRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (firstRenderCompleted) return;
firstRenderCompleted = true;

Expand Down
14 changes: 8 additions & 6 deletions src/main/java/com/glisco/deathlog/server/DeathLogServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ private int executeList(CommandContext<ServerCommandSource> context, @Nullable S
var leftText = deathInfo.getLeftColumnText().iterator();
var rightText = deathInfo.getRightColumnText().iterator();

context.getSource().sendFeedback(Text.literal(""), false);
context.getSource().sendFeedback(Text.literal("§7-- §aBegin §bDeath Info Entry [" + i + "]§7--"), false);
int idx = i;

context.getSource().sendFeedback(() -> Text.literal(""), false);
context.getSource().sendFeedback(() -> Text.literal("§7-- §aBegin §bDeath Info Entry [" + idx + "]§7--"), false);
while (leftText.hasNext()) {
context.getSource().sendFeedback(((MutableText) leftText.next()).append(Text.literal(": ")).append(((MutableText) rightText.next()).formatted(Formatting.WHITE)), false);
context.getSource().sendFeedback(() -> ((MutableText) leftText.next()).append(Text.literal(": ")).append(((MutableText) rightText.next()).formatted(Formatting.WHITE)), false);
}
context.getSource().sendFeedback(Text.literal("§7-- §cEnd §bDeath Info Entry [" + i + "]§7--"), false);
context.getSource().sendFeedback(() -> Text.literal("§7-- §cEnd §bDeath Info Entry [" + idx + "]§7--"), false);
}

if (infoListSize > 0) context.getSource().sendFeedback(Text.literal(""), false);
context.getSource().sendFeedback(Text.literal("Queried §b" + infoListSize + "§r death info entries for player ").append("§b" + profile.getName()), false);
if (infoListSize > 0) context.getSource().sendFeedback(() -> Text.literal(""), false);
context.getSource().sendFeedback(() -> Text.literal("Queried §b" + infoListSize + "§r death info entries for player ").append("§b" + profile.getName()), false);

return infoListSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void store(Text deathMessage, PlayerEntity player) {
deathInfo.setProperty(DeathInfo.INVENTORY_KEY, new InventoryProperty(player.getInventory()));

deathInfo.setProperty(DeathInfo.COORDINATES_KEY, new CoordinatesProperty(player.getBlockPos()));
deathInfo.setProperty(DeathInfo.DIMENSION_KEY, new StringProperty("deathlog.deathinfoproperty.dimension", player.world.getRegistryKey().getValue().toString()));
deathInfo.setProperty(DeathInfo.DIMENSION_KEY, new StringProperty("deathlog.deathinfoproperty.dimension", player.getWorld().getRegistryKey().getValue().toString()));
deathInfo.setProperty(DeathInfo.LOCATION_KEY, new LocationProperty("Server", true));
deathInfo.setProperty(DeathInfo.SCORE_KEY, new ScoreProperty(player.getScore(), player.experienceLevel, player.experienceProgress, player.totalExperience));
deathInfo.setProperty(DeathInfo.DEATH_MESSAGE_KEY, new StringProperty("deathlog.deathinfoproperty.death_message", deathMessage.getString()));
Expand Down

0 comments on commit 8286f5c

Please sign in to comment.