mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge branch 'feature/1.20' into feature/1.20-more
This commit is contained in:
commit
e978df5a3b
2 changed files with 2 additions and 43 deletions
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue