1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-31 20:13:33 +01:00

Port sidebar slots patch

This commit is contained in:
Bjarne Koll 2023-09-22 14:33:54 +02:00
parent b5c4a402ee
commit 42b9f5a66d
7 changed files with 9 additions and 8 deletions

View file

@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final class CraftScoreboardTranslations {
- static final int MAX_DISPLAY_SLOT = 19;
+ static final int MAX_DISPLAY_SLOT = Scoreboard.getDisplaySlotNames().length; // Paper
+ static final int MAX_DISPLAY_SLOT = net.minecraft.world.scores.DisplaySlot.values().length; // Paper // TODO - revisit this.
+ @Deprecated // Paper
static final ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.<DisplaySlot, String>builder()
.put(DisplaySlot.BELOW_NAME, "belowName")
.put(DisplaySlot.BELOW_NAME, "below_name")
.put(DisplaySlot.PLAYER_LIST, "list")
.put(DisplaySlot.SIDEBAR, "sidebar")
- .put(DisplaySlot.SIDEBAR_BLACK, "sidebar.team.black")
@ -43,16 +43,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private CraftScoreboardTranslations() {}
public static DisplaySlot toBukkitSlot(int i) {
+ if (true) return org.bukkit.scoreboard.DisplaySlot.NAMES.value(Scoreboard.getDisplaySlotName(i)); // Paper
return CraftScoreboardTranslations.SLOTS.inverse().get(Scoreboard.getDisplaySlotName(i));
static DisplaySlot toBukkitSlot(net.minecraft.world.scores.DisplaySlot minecraft) {
+ if (true) return org.bukkit.scoreboard.DisplaySlot.NAMES.value(minecraft.getSerializedName()); // Paper
return CraftScoreboardTranslations.SLOTS.inverse().get(minecraft.getSerializedName());
}
public static int fromBukkitSlot(DisplaySlot slot) {
+ if (true) return Scoreboard.getDisplaySlotByName(slot.getId()); // Paper
return Scoreboard.getDisplaySlotByName(CraftScoreboardTranslations.SLOTS.get(slot));
static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot slot) {
- return net.minecraft.world.scores.DisplaySlot.CODEC.byName(CraftScoreboardTranslations.SLOTS.get(slot));
+ return net.minecraft.world.scores.DisplaySlot.CODEC.byName(slot.getId()); // Paper
}
static RenderType toBukkitRender(ObjectiveCriteria.RenderType display) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java