From 910aaf9b97c4a6d82d2db1a3e756434dcb6a8f91 Mon Sep 17 00:00:00 2001 From: Patbox Date: Sun, 10 Dec 2023 12:53:48 +0100 Subject: [PATCH] Update to 1.20.4 --- build.gradle | 4 +- gradle.properties | 10 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../extras/chat_filter/ChatFilterConfig.java | 3 +- .../game_portal/StyledMenuPortalBackend.java | 5 +- .../lobby/block/ContributorStatueBlock.java | 6 ++ .../extras/lobby/block/SnakeBlock.java | 6 ++ .../lobby/block/TransientDoorBlock.java | 2 +- .../extras/lobby/contributor/Contributor.java | 4 +- .../criterion/TaterCollectedCriterion.java | 44 +++++++----- .../lobby/criterion/WearTaterCriterion.java | 72 +++++++++---------- .../nucleoid/extras/mixin/TextCodecMixin.java | 25 +++++++ .../extras/mixin/TextSerializerMixin.java | 22 ------ .../mixin/lobby/SkullBlockEntityAccessor.java | 5 +- .../player_list/ServerScoreboardMixin.java | 4 +- .../extras/placeholder/GameTextContent.java | 8 +++ .../extras/sidebar/NucleoidSidebar.java | 10 ++- src/main/resources/extras.mixins.json | 2 +- 18 files changed, 135 insertions(+), 99 deletions(-) create mode 100644 src/main/java/xyz/nucleoid/extras/mixin/TextCodecMixin.java delete mode 100644 src/main/java/xyz/nucleoid/extras/mixin/TextSerializerMixin.java diff --git a/build.gradle b/build.gradle index 5cefe3d8..631aef25 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.1.+' + id 'fabric-loom' version '1.4.+' id 'maven-publish' } @@ -24,7 +24,7 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation 'xyz.nucleoid:plasmid:0.5.102-SNAPSHOT+1.20.2' + modImplementation 'xyz.nucleoid:plasmid:0.5.102-SNAPSHOT+1.20.4' //modCompileOnly "com.viaversion:viaversion-api:4.7.0-SNAPSHOT" modCompileOnly "dev.gegy:player-roles-api:1.6.5" diff --git a/gradle.properties b/gradle.properties index 5cd087c9..af6465c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.4 -loader_version=0.14.22 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.1 +loader_version=0.15.1 # Dependencies -fabric_version=0.89.3+1.20.2 +fabric_version=0.91.1+1.20.4 # Mod Properties -mod_version=1.3.1 +mod_version=1.3.2 maven_group=xyz.nucleoid archives_base_name=nucleoid-extras diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84d1f85f..e411586a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/xyz/nucleoid/extras/chat_filter/ChatFilterConfig.java b/src/main/java/xyz/nucleoid/extras/chat_filter/ChatFilterConfig.java index 8dc37e68..5bbfbd5d 100644 --- a/src/main/java/xyz/nucleoid/extras/chat_filter/ChatFilterConfig.java +++ b/src/main/java/xyz/nucleoid/extras/chat_filter/ChatFilterConfig.java @@ -14,6 +14,7 @@ import net.minecraft.util.Formatting; import net.minecraft.util.dynamic.Codecs; import org.jetbrains.annotations.Nullable; +import xyz.nucleoid.plasmid.util.PlasmidCodecs; import java.util.*; import java.util.stream.Collectors; @@ -23,7 +24,7 @@ public final class ChatFilterConfig { instance.group( Codec.STRING.listOf().optionalFieldOf("illegal_words", ImmutableList.of()).forGetter(c -> new ArrayList<>(c.illegalWords)), Codec.STRING.listOf().optionalFieldOf("contains_illegal_text", ImmutableList.of()).forGetter(c -> c.containsIllegalText), - Codecs.TEXT.optionalFieldOf("feedback_message").forGetter(c -> Optional.ofNullable(c.feedbackMessage)), + PlasmidCodecs.TEXT.optionalFieldOf("feedback_message").forGetter(c -> Optional.ofNullable(c.feedbackMessage)), Registries.SOUND_EVENT.createEntryCodec().optionalFieldOf("feedback_sound").forGetter(c -> Optional.ofNullable(c.feedbackSound)) ).apply(instance, ChatFilterConfig::new) ); diff --git a/src/main/java/xyz/nucleoid/extras/game_portal/StyledMenuPortalBackend.java b/src/main/java/xyz/nucleoid/extras/game_portal/StyledMenuPortalBackend.java index 7c0c72f0..b9630e41 100644 --- a/src/main/java/xyz/nucleoid/extras/game_portal/StyledMenuPortalBackend.java +++ b/src/main/java/xyz/nucleoid/extras/game_portal/StyledMenuPortalBackend.java @@ -24,6 +24,7 @@ import xyz.nucleoid.plasmid.game.portal.GamePortalDisplay; import xyz.nucleoid.plasmid.game.portal.menu.InvalidMenuEntry; import xyz.nucleoid.plasmid.game.portal.menu.MenuEntry; +import xyz.nucleoid.plasmid.util.IdentityHashStrategy; import java.util.ArrayList; import java.util.Comparator; @@ -77,7 +78,7 @@ public ItemStack getIcon() { @Override public int getPlayerCount() { int count = 0; - var list = new ObjectOpenCustomHashSet(Util.identityHashStrategy()); + var list = new ObjectOpenCustomHashSet(IdentityHashStrategy.INSTANCE); provideGameSpaces(list::add); for (var entry : list) { count += Math.max(0, entry.getPlayers().size()); @@ -140,7 +141,7 @@ private void fill(ServerPlayerEntity player, SimpleGui gui, boolean viewOpen) { } private void fillOpen(ServerPlayerEntity player, SimpleGui gui, MutableInt page) { - var gamesTemp = new ObjectOpenCustomHashSet(Util.identityHashStrategy()); + var gamesTemp = new ObjectOpenCustomHashSet(IdentityHashStrategy.INSTANCE); this.provideGameSpaces(gamesTemp::add); var games = new ArrayList<>(gamesTemp); games.sort(Comparator.comparingInt(space -> -space.getPlayers().size())); diff --git a/src/main/java/xyz/nucleoid/extras/lobby/block/ContributorStatueBlock.java b/src/main/java/xyz/nucleoid/extras/lobby/block/ContributorStatueBlock.java index d4a83d34..0af756f1 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/block/ContributorStatueBlock.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/block/ContributorStatueBlock.java @@ -2,6 +2,7 @@ import java.util.List; +import com.mojang.serialization.MapCodec; import eu.pb4.polymer.core.api.block.PolymerBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -38,6 +39,11 @@ public ContributorStatueBlock(Settings settings) { this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH)); } + @Override + protected MapCodec getCodec() { + return null; + } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient() && player.isCreativeLevelTwoOp()) { diff --git a/src/main/java/xyz/nucleoid/extras/lobby/block/SnakeBlock.java b/src/main/java/xyz/nucleoid/extras/lobby/block/SnakeBlock.java index 61e20af8..aebfcc30 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/block/SnakeBlock.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/block/SnakeBlock.java @@ -1,5 +1,6 @@ package xyz.nucleoid.extras.lobby.block; +import com.mojang.serialization.MapCodec; import eu.pb4.polymer.core.api.block.PolymerBlock; import net.minecraft.block.*; import net.minecraft.item.ItemPlacementContext; @@ -104,4 +105,9 @@ protected void appendProperties(Builder builder) { builder.add(FACING); builder.add(ACTIVE); } + + @Override + protected MapCodec getCodec() { + return null; + } } diff --git a/src/main/java/xyz/nucleoid/extras/lobby/block/TransientDoorBlock.java b/src/main/java/xyz/nucleoid/extras/lobby/block/TransientDoorBlock.java index 59e71c1f..69f43c00 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/block/TransientDoorBlock.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/block/TransientDoorBlock.java @@ -24,7 +24,7 @@ public class TransientDoorBlock extends DoorBlock implements PolymerBlock { private final Block polymerBlock; public TransientDoorBlock(Block block) { - super(AbstractBlock.Settings.copy(block), block instanceof DoorBlock door ? door.getBlockSetType() : BlockSetType.OAK); + super(block instanceof DoorBlock door ? door.getBlockSetType() : BlockSetType.OAK, AbstractBlock.Settings.copy(block)); this.polymerBlock = block; } diff --git a/src/main/java/xyz/nucleoid/extras/lobby/contributor/Contributor.java b/src/main/java/xyz/nucleoid/extras/lobby/contributor/Contributor.java index c4347140..fed25aa4 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/contributor/Contributor.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/contributor/Contributor.java @@ -75,12 +75,12 @@ public GameProfile createGameProfile(MinecraftServer server) { } public void loadGameProfileProperties(MinecraftServer server, GameProfile profile, Consumer callback) { - SkullBlockEntityAccessor.callFetchProfileWithTextures(profile).thenAccept(optional -> { + /*SkullBlockEntityAccessor.callFetchProfileWithTextures(profile).thenAccept(optional -> { optional.ifPresent(fullProfile -> { server.getUserCache().add(fullProfile); callback.accept(fullProfile); }); - }); + });*/ } @Override diff --git a/src/main/java/xyz/nucleoid/extras/lobby/criterion/TaterCollectedCriterion.java b/src/main/java/xyz/nucleoid/extras/lobby/criterion/TaterCollectedCriterion.java index e6df1e5b..0256cf33 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/criterion/TaterCollectedCriterion.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/criterion/TaterCollectedCriterion.java @@ -2,40 +2,43 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancement.criterion.AbstractCriterion; -import net.minecraft.advancement.criterion.AbstractCriterionConditions; -import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer; import net.minecraft.predicate.entity.LootContextPredicate; import net.minecraft.registry.Registries; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; import xyz.nucleoid.extras.lobby.block.tater.CubicPotatoBlock; +import xyz.nucleoid.extras.lobby.block.tater.TinyPotatoBlock; import java.util.Optional; public class TaterCollectedCriterion extends AbstractCriterion { - @Override - protected TaterCollectedCriterion.Conditions conditionsFromJson(JsonObject obj, Optional playerPredicate, AdvancementEntityPredicateDeserializer predicateDeserializer) { - Identifier tater = obj.has("tater") ? new Identifier(obj.get("tater").getAsString()) : null; - if(tater != null && !Registries.BLOCK.containsId(tater)) { - throw new JsonSyntaxException("No tater exists with ID "+tater+"!"); - } - Integer count = obj.has("count") ? obj.get("count").getAsString().equals("all") ? CubicPotatoBlock.TATERS.size() : obj.get("count").getAsInt() : null; - return new Conditions(playerPredicate, tater, count); - } - public void trigger(ServerPlayerEntity player, Identifier tater, int count) { this.trigger(player, conditions -> conditions.matches(tater, count)); } - public static class Conditions extends AbstractCriterionConditions { - private final Identifier tater; + @Override + public Codec getConditionsCodec() { + return Conditions.CODEC; + } + + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") + public static class Conditions implements AbstractCriterion.Conditions { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Identifier.CODEC.fieldOf("tater").forGetter(Conditions::getTater), + Codec.INT.optionalFieldOf("count").forGetter(i -> i.optionalCount) + ).apply(instance, Conditions::new)); + + private final Identifier tater; private final Integer count; + private final Optional optionalCount; - public Conditions(Optional playerPredicate, Identifier tater, Integer count) { - super(playerPredicate); + public Conditions(Identifier tater, Optional count) { this.tater = tater; - this.count = count; + this.count = count.orElse(TinyPotatoBlock.TATERS.size()); + this.optionalCount = count; } public Identifier getTater() { @@ -51,5 +54,10 @@ public boolean matches(Identifier tater, int count) { boolean countMatches = getCount() == null || getCount() <= count; return taterMatches && countMatches; } - } + + @Override + public Optional player() { + return Optional.empty(); + } + } } diff --git a/src/main/java/xyz/nucleoid/extras/lobby/criterion/WearTaterCriterion.java b/src/main/java/xyz/nucleoid/extras/lobby/criterion/WearTaterCriterion.java index 44cbd937..4af99f28 100644 --- a/src/main/java/xyz/nucleoid/extras/lobby/criterion/WearTaterCriterion.java +++ b/src/main/java/xyz/nucleoid/extras/lobby/criterion/WearTaterCriterion.java @@ -2,9 +2,10 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancement.criterion.AbstractCriterion; -import net.minecraft.advancement.criterion.AbstractCriterionConditions; -import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer; import net.minecraft.predicate.entity.LootContextPredicate; import net.minecraft.registry.Registries; import net.minecraft.server.network.ServerPlayerEntity; @@ -18,25 +19,12 @@ public class WearTaterCriterion extends AbstractCriterion { public static final Calendar CALENDAR = Calendar.getInstance(); - @Override - protected WearTaterCriterion.Conditions conditionsFromJson(JsonObject obj, Optional playerPredicate, AdvancementEntityPredicateDeserializer predicateDeserializer) { - Identifier tater = obj.has("tater") ? new Identifier(obj.get("tater").getAsString()) : null; - if(tater != null && !Registries.BLOCK.containsId(tater)) { - throw new JsonSyntaxException("No tater exists with ID "+tater+"!"); - } - Integer dayOfWeek = obj.has("day_of_week") ? dayOfWeekToInt(obj.get("day_of_week").getAsString()) : null; - if(dayOfWeek != null && (dayOfWeek > 7 || dayOfWeek < 1)) { - throw new JsonSyntaxException("Invalid day of week specified!"); - } - return new Conditions(playerPredicate, tater, dayOfWeek); - } - public void trigger(ServerPlayerEntity player, Identifier tater) { CALENDAR.setTime(new Date()); this.trigger(player, conditions -> conditions.matches(tater, CALENDAR.get(Calendar.DAY_OF_WEEK))); } - public int dayOfWeekToInt(String day) { + public static int dayOfWeekToInt(String day) { return switch (day.toLowerCase(Locale.ROOT)) { case "monday" -> Calendar.MONDAY; case "tuesday" -> Calendar.TUESDAY; @@ -49,28 +37,40 @@ public int dayOfWeekToInt(String day) { }; } - public static class Conditions extends AbstractCriterionConditions { - private final Identifier tater; - private final Integer dayOfWeek; + public static String dayOfWeekToString(int day) { + return switch (day) { + case Calendar.MONDAY -> "monday"; + case Calendar.TUESDAY -> "tuesday"; + case Calendar.WEDNESDAY -> "wednesday"; + case Calendar.THURSDAY -> "thursday"; + case Calendar.FRIDAY -> "friday"; + case Calendar.SATURDAY -> "saturday"; + case Calendar.SUNDAY -> "sunday"; + default -> Integer.toString(day); + }; + } - public Conditions(Optional playerPredicate, Identifier tater, Integer dayOfWeek) { - super(playerPredicate); - this.tater = tater; - this.dayOfWeek = dayOfWeek; - } + @Override + public Codec getConditionsCodec() { + return Conditions.CODEC; + } - public Identifier getTater() { - return tater; - } + public record Conditions(Identifier tater, int dayOfWeek) implements AbstractCriterion.Conditions { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Identifier.CODEC.fieldOf("tater").forGetter(Conditions::tater), + Codec.STRING.xmap(WearTaterCriterion::dayOfWeekToInt, WearTaterCriterion::dayOfWeekToString) + .fieldOf("day_of_week").forGetter(Conditions::dayOfWeek) + ).apply(instance, Conditions::new)); - public Integer getDayOfWeek() { - return dayOfWeek; - } + public boolean matches(Identifier tater, int dayOfWeek) { + boolean taterMatches = tater() == null || tater().equals(tater); + boolean dayOfWeekMatches = dayOfWeek() == dayOfWeek; + return taterMatches && dayOfWeekMatches; + } - public boolean matches(Identifier tater, int dayOfWeek) { - boolean taterMatches = getTater() == null || getTater().equals(tater); - boolean dayOfWeekMatches = getDayOfWeek() == null || getDayOfWeek() == dayOfWeek; - return taterMatches && dayOfWeekMatches; - } - } + @Override + public Optional player() { + return Optional.empty(); + } + } } diff --git a/src/main/java/xyz/nucleoid/extras/mixin/TextCodecMixin.java b/src/main/java/xyz/nucleoid/extras/mixin/TextCodecMixin.java new file mode 100644 index 00000000..897840fa --- /dev/null +++ b/src/main/java/xyz/nucleoid/extras/mixin/TextCodecMixin.java @@ -0,0 +1,25 @@ +package xyz.nucleoid.extras.mixin; + +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.mojang.serialization.Codec; +import net.minecraft.text.Text; +import net.minecraft.text.TextCodecs; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import xyz.nucleoid.extras.placeholder.GameTextContent; +import xyz.nucleoid.packettweaker.PacketContext; + +import java.util.function.Function; + +@Mixin(TextCodecs.class) +public class TextCodecMixin { + @ModifyReturnValue(method = "createCodec", at = @At("RETURN")) + private static Codec addCustomTextType(Codec original) { + return original.xmap(Function.identity(), text -> { + if (text.getContent() instanceof GameTextContent gameTextContent) { + return gameTextContent.toVanilla(PacketContext.get().getPlayer(), text); + } + return text; + }); + } +} diff --git a/src/main/java/xyz/nucleoid/extras/mixin/TextSerializerMixin.java b/src/main/java/xyz/nucleoid/extras/mixin/TextSerializerMixin.java deleted file mode 100644 index 58c972b2..00000000 --- a/src/main/java/xyz/nucleoid/extras/mixin/TextSerializerMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package xyz.nucleoid.extras.mixin; - -import net.minecraft.text.*; -import net.minecraft.util.Formatting; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import xyz.nucleoid.extras.placeholder.GameTextContent; -import xyz.nucleoid.packettweaker.PacketContext; -import xyz.nucleoid.plasmid.game.manager.GameSpaceManager; - -@Mixin(Text.Serializer.class) -public class TextSerializerMixin { - @ModifyVariable(method = "serialize(Lnet/minecraft/text/Text;Ljava/lang/reflect/Type;Lcom/google/gson/JsonSerializationContext;)Lcom/google/gson/JsonElement;", at = @At("HEAD"), argsOnly = true) - private Text extras$serializeText(Text text) { - if (text.getContent() instanceof GameTextContent gameTextContent) { - return gameTextContent.toVanilla(PacketContext.get().getTarget(), text); - } - - return text; - } -} diff --git a/src/main/java/xyz/nucleoid/extras/mixin/lobby/SkullBlockEntityAccessor.java b/src/main/java/xyz/nucleoid/extras/mixin/lobby/SkullBlockEntityAccessor.java index 9a276094..2d228b7d 100644 --- a/src/main/java/xyz/nucleoid/extras/mixin/lobby/SkullBlockEntityAccessor.java +++ b/src/main/java/xyz/nucleoid/extras/mixin/lobby/SkullBlockEntityAccessor.java @@ -10,8 +10,5 @@ @Mixin(SkullBlockEntity.class) public class SkullBlockEntityAccessor { - @Invoker - public static CompletableFuture> callFetchProfileWithTextures(GameProfile profile) { - throw new AssertionError(); - } + } diff --git a/src/main/java/xyz/nucleoid/extras/mixin/player_list/ServerScoreboardMixin.java b/src/main/java/xyz/nucleoid/extras/mixin/player_list/ServerScoreboardMixin.java index ec7c922e..df352164 100644 --- a/src/main/java/xyz/nucleoid/extras/mixin/player_list/ServerScoreboardMixin.java +++ b/src/main/java/xyz/nucleoid/extras/mixin/player_list/ServerScoreboardMixin.java @@ -18,7 +18,7 @@ public class ServerScoreboardMixin { @Final private MinecraftServer server; - @Inject(method = "addPlayerToTeam", at = @At(value = "INVOKE", target = "Lnet/minecraft/scoreboard/ServerScoreboard;runUpdateListeners()V", shift = At.Shift.AFTER)) + @Inject(method = "addScoreHolderToTeam", at = @At(value = "INVOKE", target = "Lnet/minecraft/scoreboard/ServerScoreboard;runUpdateListeners()V", shift = At.Shift.AFTER)) private void extras$updatePlayerAfterJoining(String playerName, Team team, CallbackInfoReturnable cir) { var player = this.server.getPlayerManager().getPlayer(playerName); if (player != null) { @@ -26,7 +26,7 @@ public class ServerScoreboardMixin { } } - @Inject(method = "removePlayerFromTeam", at = @At("TAIL")) + @Inject(method = "removeScoreHolderFromTeam", at = @At("TAIL")) private void extras$updatePlayerAfterLeaving(String playerName, Team team, CallbackInfo ci) { var player = this.server.getPlayerManager().getPlayer(playerName); if (player != null) { diff --git a/src/main/java/xyz/nucleoid/extras/placeholder/GameTextContent.java b/src/main/java/xyz/nucleoid/extras/placeholder/GameTextContent.java index acb1173a..fb3b3fbf 100644 --- a/src/main/java/xyz/nucleoid/extras/placeholder/GameTextContent.java +++ b/src/main/java/xyz/nucleoid/extras/placeholder/GameTextContent.java @@ -1,5 +1,6 @@ package xyz.nucleoid.extras.placeholder; +import com.mojang.serialization.*; import net.minecraft.screen.ScreenTexts; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.*; @@ -7,6 +8,8 @@ import xyz.nucleoid.plasmid.game.GameSpace; import xyz.nucleoid.plasmid.game.manager.GameSpaceManager; +import java.util.stream.Stream; + public record GameTextContent(GameSpace gameSpace) implements TextContent { public Text toVanilla(@Nullable ServerPlayerEntity player, Text text) { if (player == null) { @@ -36,4 +39,9 @@ public Text toVanilla(@Nullable ServerPlayerEntity player, Text text) { return out; } + + @Override + public Type getType() { + return null; + } } diff --git a/src/main/java/xyz/nucleoid/extras/sidebar/NucleoidSidebar.java b/src/main/java/xyz/nucleoid/extras/sidebar/NucleoidSidebar.java index 9eaf59ce..ddae771b 100644 --- a/src/main/java/xyz/nucleoid/extras/sidebar/NucleoidSidebar.java +++ b/src/main/java/xyz/nucleoid/extras/sidebar/NucleoidSidebar.java @@ -47,6 +47,8 @@ public final class NucleoidSidebar { private static final Text SIZE_FORCING_TEXT = Text.literal(" ".repeat(34)); + private final boolean enabled = NucleoidExtrasConfig.get().sidebar(); + private static Text[] createAnimatedTitle(String string, Text append, Style leftStyle, Style middleStyle, Style rightStyle) { List texts = new ArrayList<>(); @@ -162,10 +164,14 @@ private void writeGamesToSidebar(LineBuilder builder, Collection