3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 15:00:11 +01:00

one more change

Dieser Commit ist enthalten in:
onebeastchris 2024-08-20 23:35:09 +02:00
Ursprung c13f9281d5
Commit 1867c6dc6a
3 geänderte Dateien mit 6 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -136,8 +136,8 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("force-resource-packs")
private boolean forceResourcePacks = true;
@JsonProperty("resource-pack-urls")
private List<String> resourcePackUrls = new ArrayList<>();
// @JsonProperty("resource-pack-urls")
// private List<String> resourcePackUrls = new ArrayList<>();
@JsonProperty("xbox-achievements-enabled")
private boolean xboxAchievementsEnabled = false;

Datei anzeigen

@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
@Getter
public class GeyserDefineResourcePacksEventImpl extends GeyserDefineResourcePacksEvent {
@ -50,7 +51,7 @@ public class GeyserDefineResourcePacksEventImpl extends GeyserDefineResourcePack
@Override
public @NonNull List<ResourcePack> resourcePacks() {
return List.copyOf(packs.values().stream().map(ResourcePackHolder::pack).toList());
return packs.values().stream().map(ResourcePackHolder::pack).collect(Collectors.toUnmodifiableList());
}
@Override

Datei anzeigen

@ -140,7 +140,7 @@ public class SessionLoadResourcePacksEventImpl extends SessionLoadResourcePacksE
public List<ResourcePackStackPacket.Entry> orderedPacks() {
TreeSet<Map.Entry<GeyserResourcePack, Double>> sortedPacks = packs.values().stream()
// Map each ResourcePack to a pair of (GeyserResourcePack, Priority)
.map(holder -> new AbstractMap.SimpleEntry<>(holder.pack(), getPriority(holder.pack())))
.map(holder -> new AbstractMap.SimpleEntry<>(holder.pack(), priority(holder.pack())))
// Sort by priority in ascending order
.collect(Collectors.toCollection(() -> new TreeSet<>(Map.Entry.comparingByValue(Comparator.naturalOrder()))));
@ -188,7 +188,7 @@ public class SessionLoadResourcePacksEventImpl extends SessionLoadResourcePacksE
// Helper methods to get the options for a ResourcePack
private double getPriority(GeyserResourcePack pack) {
private double priority(GeyserResourcePack pack) {
OptionHolder holder = options.get(pack.uuid());
OptionHolder defaultHolder = packs.get(pack.uuid()).optionHolder();
Objects.requireNonNull(defaultHolder); // should never be null