3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 08:10:11 +01:00

Remove special cases in block/item populators that are no longer necessary

Dieser Commit ist enthalten in:
Konicai 2023-05-13 00:05:22 -04:00
Ursprung d0bf0013ec
Commit 21623fee20
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 710D09287708C823
2 geänderte Dateien mit 2 neuen und 43 gelöschten Zeilen

Datei anzeigen

@ -66,37 +66,9 @@ public final class BlockRegistryPopulator {
}
private static void registerBedrockBlocks() {
BiFunction<String, NbtMapBuilder, String> woolMapper = (bedrockIdentifier, statesBuilder) -> {
if (bedrockIdentifier.equals("minecraft:wool")) {
String color = (String) statesBuilder.remove("color");
if ("silver".equals(color)) {
color = "light_gray";
}
return "minecraft:" + color + "_wool";
}
return null;
};
BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
.put(ObjectIntPair.of("1_19_80", Bedrock_v582.CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> {
String identifier = woolMapper.apply(bedrockIdentifier, statesBuilder);
if (identifier != null) {
return identifier;
}
switch (bedrockIdentifier) {
case "minecraft:log", "minecraft:log2" -> {
String woodType = (String) statesBuilder.remove(bedrockIdentifier.equals("minecraft:log") ? "old_log_type" : "new_log_type");
return "minecraft:" + woodType + "_log";
}
case "minecraft:fence" -> {
String woodType = (String) statesBuilder.remove("wood_type");
return "minecraft:" + woodType + "_fence";
}
default -> {
return null;
}
}
})
.put(ObjectIntPair.of("1_19_80", Bedrock_v582.CODEC.getProtocolVersion()), emptyMapper)
.build();
// We can keep this strong as nothing should be garbage collected

Datei anzeigen

@ -198,20 +198,7 @@ public class ItemRegistryPopulator {
continue;
}
String bedrockIdentifier;
if (mappingItem.getBedrockIdentifier().equals("minecraft:wool")) {
bedrockIdentifier = javaItem.javaIdentifier();
} else {
bedrockIdentifier = mappingItem.getBedrockIdentifier();
}
//1.19.80+
if (mappingItem.getBedrockIdentifier().equals("minecraft:log") ||
mappingItem.getBedrockIdentifier().equals("minecraft:log2") ||
mappingItem.getBedrockIdentifier().equals("minecraft:fence")) {
bedrockIdentifier = javaItem.javaIdentifier();
}
String bedrockIdentifier = mappingItem.getBedrockIdentifier();
ItemDefinition definition = definitions.get(bedrockIdentifier);
if (definition == null) {
throw new RuntimeException("Missing Bedrock ItemDefinition in mappings: " + bedrockIdentifier);