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

Merge branch 'feature/1.20' into feature/1.20-more

Dieser Commit ist enthalten in:
Konicai 2023-05-13 00:13:07 -04:00
Commit e978df5a3b
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() { 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; BiFunction<String, NbtMapBuilder, String> emptyMapper = (bedrockIdentifier, statesBuilder) -> null;
ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> blockMappers = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder() 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) -> { .put(ObjectIntPair.of("1_19_80", Bedrock_v582.CODEC.getProtocolVersion()), emptyMapper)
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;
}
}
})
.build(); .build();
// We can keep this strong as nothing should be garbage collected // We can keep this strong as nothing should be garbage collected

Datei anzeigen

@ -198,20 +198,7 @@ public class ItemRegistryPopulator {
continue; continue;
} }
String bedrockIdentifier; String bedrockIdentifier = mappingItem.getBedrockIdentifier();
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();
}
ItemDefinition definition = definitions.get(bedrockIdentifier); ItemDefinition definition = definitions.get(bedrockIdentifier);
if (definition == null) { if (definition == null) {
throw new RuntimeException("Missing Bedrock ItemDefinition in mappings: " + bedrockIdentifier); throw new RuntimeException("Missing Bedrock ItemDefinition in mappings: " + bedrockIdentifier);