From e821350f37576909751053ec39fba3f15b852689 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Sat, 6 Aug 2022 22:29:17 +0300 Subject: [PATCH] Updated to Minecraft `1.19.1` and `1.19.2` --- build.gradle | 6 ++--- gradle.properties | 14 +++++----- .../easteregg/technoblade/Technoblade.java | 7 ++--- .../java/dev/kir/sync/entity/ShellEntity.java | 2 +- .../sync/mixin/ServerPlayerEntityMixin.java | 26 +++++++++---------- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index a92ca90..cfab587 100644 --- a/build.gradle +++ b/build.gradle @@ -101,10 +101,10 @@ dependencies { modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}" modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" - modImplementation "dev.emi:trinkets:${project.trinkets_version}" + modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" modCompileOnly("io.github.ladysnake:requiem-api:${project.requiem_version}", { transitive false }) - modImplementation "maven.modrinth:origins:${project.origins_version}" - modImplementation "com.github.apace100:apoli:${project.apoli_version}" + modCompileOnly "maven.modrinth:origins:${project.origins_version}" + modCompileOnly "com.github.apace100:apoli:${project.apoli_version}" modCompileOnly "maven.modrinth:haema:${project.haema_version}" } diff --git a/gradle.properties b/gradle.properties index f49e8e3..0e117e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/versions.html -minecraft_version=1.19 -yarn_mappings=1.19+build.1 -loader_version=0.14.7 +minecraft_version=1.19.1 +yarn_mappings=1.19.1+build.6 +loader_version=0.14.9 # Mod Properties mod_version=4.3 @@ -13,11 +13,11 @@ maven_group=dev.kir archives_base_name=sync # Dependencies -fabric_version=0.55.2+1.19 +fabric_version=0.58.5+1.19.1 tr_energy_version=2.2.0 -satin_version=1.8.0 -cloth_version=7.0.65 -modmenu_version=4.0.0 +satin_version=1.9.0 +cloth_version=8.0.75 +modmenu_version=4.0.6 trinkets_version=3.4.0 requiem_version=2.0.0-beta.8 origins_version=1.6.1 diff --git a/src/main/java/dev/kir/sync/easteregg/technoblade/Technoblade.java b/src/main/java/dev/kir/sync/easteregg/technoblade/Technoblade.java index d6f8bf3..5c460d0 100644 --- a/src/main/java/dev/kir/sync/easteregg/technoblade/Technoblade.java +++ b/src/main/java/dev/kir/sync/easteregg/technoblade/Technoblade.java @@ -12,14 +12,11 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; -import net.minecraft.network.message.MessageSender; -import net.minecraft.network.message.MessageType; import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import net.minecraft.sound.SoundEvent; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.world.GameMode; import java.util.List; @@ -30,7 +27,7 @@ public class Technoblade extends AbstractClientPlayerEntity { private static final Identifier TECHNOBLADE_SKIN = Sync.locate("textures/entity/technoblade.png"); private static final GameProfile TECHNOBLADE_GAME_PROFILE = new GameProfile(UUID.fromString("b876ec32-e396-476b-a115-8438d83c67d4"), "Technoblade"); - private static final PlayerListEntry TECHNOBLADE_PLAYER_LIST_ENTRY = new PlayerListEntry(new PlayerListS2CPacket.Entry(TECHNOBLADE_GAME_PROFILE, 0, GameMode.CREATIVE, null, null), null); + private static final PlayerListEntry TECHNOBLADE_PLAYER_LIST_ENTRY = new PlayerListEntry(new PlayerListS2CPacket.Entry(TECHNOBLADE_GAME_PROFILE, 0, GameMode.CREATIVE, null, null), null, false); // Feel free to add new quotes to this list if you are reading this private static final List TECHNOBLADE_QUOTES = Stream.of( "so long nerds", @@ -103,7 +100,7 @@ public Text getRandomQuote() { public void speak() { Text quote = this.getRandomQuote(); - MinecraftClient.getInstance().inGameHud.onChatMessage(BuiltinRegistries.MESSAGE_TYPE.get(MessageType.CHAT), quote, new MessageSender(this.uuid, this.getDisplayName())); + MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(Text.translatable("chat.type.text", this.getDisplayName(), quote.getString())); } @Override diff --git a/src/main/java/dev/kir/sync/entity/ShellEntity.java b/src/main/java/dev/kir/sync/entity/ShellEntity.java index 781e863..2add032 100644 --- a/src/main/java/dev/kir/sync/entity/ShellEntity.java +++ b/src/main/java/dev/kir/sync/entity/ShellEntity.java @@ -114,7 +114,7 @@ private static PlayerListEntry getPlayerEntry(ShellState state) { } if (entry == null) { - entry = new PlayerListEntry(new PlayerListS2CPacket.Entry(new GameProfile(state.getOwnerUuid(), state.getOwnerName()), 0, null, null, null), client.getServicesSignatureVerifier()); + entry = new PlayerListEntry(new PlayerListS2CPacket.Entry(new GameProfile(state.getOwnerUuid(), state.getOwnerName()), 0, null, null, null), client.getServicesSignatureVerifier(), false); } PLAYER_ENTRY_CACHE.put(state.getOwnerUuid(), entry); diff --git a/src/main/java/dev/kir/sync/mixin/ServerPlayerEntityMixin.java b/src/main/java/dev/kir/sync/mixin/ServerPlayerEntityMixin.java index 55b501f..0c56252 100644 --- a/src/main/java/dev/kir/sync/mixin/ServerPlayerEntityMixin.java +++ b/src/main/java/dev/kir/sync/mixin/ServerPlayerEntityMixin.java @@ -17,8 +17,8 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.nbt.NbtList; +import net.minecraft.network.PacketCallbacks; import net.minecraft.network.encryption.PlayerPublicKey; -import net.minecraft.network.message.MessageType; import net.minecraft.network.packet.s2c.play.*; import net.minecraft.scoreboard.AbstractTeam; import net.minecraft.server.MinecraftServer; @@ -338,23 +338,21 @@ public boolean updateKillableEntityPostDeath() { @Unique private void sendDeathMessageInChat() { Text text = this.getDamageTracker().getDeathMessage(); - this.networkHandler.sendPacket(new DeathMessageS2CPacket(this.getDamageTracker(), text), (future) -> { - if (!future.isSuccess()) { - String truncatedText = text.asTruncatedString(256); - Text tooLong = Text.translatable("death.attack.message_too_long", (Text.literal(truncatedText)).formatted(Formatting.YELLOW)); - Text magic = (Text.translatable("death.attack.even_more_magic", this.getDisplayName())).styled((style) -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooLong))); - this.networkHandler.sendPacket(new DeathMessageS2CPacket(this.getDamageTracker(), magic)); - } - }); - AbstractTeam team = this.getScoreboardTeam(); - if (team != null && team.getDeathMessageVisibilityRule() != AbstractTeam.VisibilityRule.ALWAYS) { - if (team.getDeathMessageVisibilityRule() == AbstractTeam.VisibilityRule.HIDE_FOR_OTHER_TEAMS) { + this.networkHandler.sendPacket(new DeathMessageS2CPacket(this.getDamageTracker(), text), PacketCallbacks.of(() -> { + String truncatedString = text.asTruncatedString(256); + Text messageWasTooLong = Text.translatable("death.attack.message_too_long", Text.literal(truncatedString).formatted(Formatting.YELLOW)); + Text magic = Text.translatable("death.attack.even_more_magic", this.getDisplayName()).styled((style) -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, messageWasTooLong))); + return new DeathMessageS2CPacket(this.getDamageTracker(), magic); + })); + AbstractTeam abstractTeam = this.getScoreboardTeam(); + if (abstractTeam != null && abstractTeam.getDeathMessageVisibilityRule() != AbstractTeam.VisibilityRule.ALWAYS) { + if (abstractTeam.getDeathMessageVisibilityRule() == AbstractTeam.VisibilityRule.HIDE_FOR_OTHER_TEAMS) { this.server.getPlayerManager().sendToTeam(this, text); - } else if (team.getDeathMessageVisibilityRule() == AbstractTeam.VisibilityRule.HIDE_FOR_OWN_TEAM) { + } else if (abstractTeam.getDeathMessageVisibilityRule() == AbstractTeam.VisibilityRule.HIDE_FOR_OWN_TEAM) { this.server.getPlayerManager().sendToOtherTeams(this, text); } } else { - this.server.getPlayerManager().broadcast(text, MessageType.SYSTEM); + this.server.getPlayerManager().broadcast(text, false); } }