Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Update BlockRegistryPopulator
Dieser Commit ist enthalten in:
Ursprung
b79a12ea8e
Commit
a21ca9922b
@ -138,7 +138,7 @@ public final class BlockRegistryPopulator {
|
|||||||
List<NbtMap> vanillaBlockStates;
|
List<NbtMap> vanillaBlockStates;
|
||||||
List<NbtMap> blockStates;
|
List<NbtMap> blockStates;
|
||||||
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResourceOrThrow(String.format("bedrock/block_palette.%s.nbt", palette.key()));
|
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResourceOrThrow(String.format("bedrock/block_palette.%s.nbt", palette.key()));
|
||||||
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
||||||
NbtMap blockPalette = (NbtMap) nbtInputStream.readTag();
|
NbtMap blockPalette = (NbtMap) nbtInputStream.readTag();
|
||||||
|
|
||||||
vanillaBlockStates = new ArrayList<>(blockPalette.getList("blocks", NbtType.COMPOUND));
|
vanillaBlockStates = new ArrayList<>(blockPalette.getList("blocks", NbtType.COMPOUND));
|
||||||
@ -260,7 +260,7 @@ public final class BlockRegistryPopulator {
|
|||||||
bedrockDefinition = customBlockStateDefinitions.get(blockStateOverride);
|
bedrockDefinition = customBlockStateDefinitions.get(blockStateOverride);
|
||||||
if (bedrockDefinition == null) {
|
if (bedrockDefinition == null) {
|
||||||
throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Custom block override: \n" +
|
throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Custom block override: \n" +
|
||||||
blockStateOverride);
|
blockStateOverride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +409,6 @@ public final class BlockRegistryPopulator {
|
|||||||
Deque<String> cleanIdentifiers = new ArrayDeque<>();
|
Deque<String> cleanIdentifiers = new ArrayDeque<>();
|
||||||
|
|
||||||
int javaRuntimeId = -1;
|
int javaRuntimeId = -1;
|
||||||
int cobwebBlockId = -1;
|
|
||||||
int furnaceRuntimeId = -1;
|
int furnaceRuntimeId = -1;
|
||||||
int furnaceLitRuntimeId = -1;
|
int furnaceLitRuntimeId = -1;
|
||||||
int honeyBlockRuntimeId = -1;
|
int honeyBlockRuntimeId = -1;
|
||||||
@ -417,10 +416,6 @@ public final class BlockRegistryPopulator {
|
|||||||
int spawnerRuntimeId = -1;
|
int spawnerRuntimeId = -1;
|
||||||
int uniqueJavaId = -1;
|
int uniqueJavaId = -1;
|
||||||
int waterRuntimeId = -1;
|
int waterRuntimeId = -1;
|
||||||
int bubbleColumnUpwardRuntimeId = -1;
|
|
||||||
int bubbleColumnDragRuntimeId = -1;
|
|
||||||
int soulSandRuntimeId = -1;
|
|
||||||
int iceRuntimeId = -1;
|
|
||||||
Iterator<Map.Entry<String, JsonNode>> blocksIterator = blocksJson.fields();
|
Iterator<Map.Entry<String, JsonNode>> blocksIterator = blocksJson.fields();
|
||||||
while (blocksIterator.hasNext()) {
|
while (blocksIterator.hasNext()) {
|
||||||
javaRuntimeId++;
|
javaRuntimeId++;
|
||||||
@ -489,10 +484,7 @@ public final class BlockRegistryPopulator {
|
|||||||
// It's possible to only have this store differences in names, but the key set of all Java names is used in sending command suggestions
|
// It's possible to only have this store differences in names, but the key set of all Java names is used in sending command suggestions
|
||||||
BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern());
|
BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern());
|
||||||
|
|
||||||
if (javaId.contains("cobweb")) {
|
if (javaId.startsWith("minecraft:furnace[facing=north")) {
|
||||||
cobwebBlockId = uniqueJavaId;
|
|
||||||
|
|
||||||
} else if (javaId.startsWith("minecraft:furnace[facing=north")) {
|
|
||||||
if (javaId.contains("lit=true")) {
|
if (javaId.contains("lit=true")) {
|
||||||
furnaceLitRuntimeId = javaRuntimeId;
|
furnaceLitRuntimeId = javaRuntimeId;
|
||||||
} else {
|
} else {
|
||||||
@ -508,24 +500,9 @@ public final class BlockRegistryPopulator {
|
|||||||
honeyBlockRuntimeId = javaRuntimeId;
|
honeyBlockRuntimeId = javaRuntimeId;
|
||||||
} else if (javaId.equals("minecraft:slime_block")) {
|
} else if (javaId.equals("minecraft:slime_block")) {
|
||||||
slimeBlockRuntimeId = javaRuntimeId;
|
slimeBlockRuntimeId = javaRuntimeId;
|
||||||
} else if (javaId.startsWith("minecraft:bubble_column")) {
|
|
||||||
if (javaId.contains("drag=true")) {
|
|
||||||
bubbleColumnDragRuntimeId = javaRuntimeId;
|
|
||||||
} else {
|
|
||||||
bubbleColumnUpwardRuntimeId = javaRuntimeId;
|
|
||||||
}
|
|
||||||
} else if (javaId.equals("minecraft:soul_sand")) {
|
|
||||||
soulSandRuntimeId = javaRuntimeId;
|
|
||||||
} else if (javaId.equals("minecraft:ice")) {
|
|
||||||
iceRuntimeId = javaRuntimeId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cobwebBlockId == -1) {
|
|
||||||
throw new AssertionError("Unable to find cobwebs in palette");
|
|
||||||
}
|
|
||||||
BlockStateValues.JAVA_COBWEB_ID = cobwebBlockId;
|
|
||||||
|
|
||||||
if (furnaceRuntimeId == -1) {
|
if (furnaceRuntimeId == -1) {
|
||||||
throw new AssertionError("Unable to find furnace in palette");
|
throw new AssertionError("Unable to find furnace in palette");
|
||||||
}
|
}
|
||||||
@ -570,15 +547,15 @@ public final class BlockRegistryPopulator {
|
|||||||
int stateRuntimeId = javaBlockState.javaId();
|
int stateRuntimeId = javaBlockState.javaId();
|
||||||
String pistonBehavior = javaBlockState.pistonBehavior();
|
String pistonBehavior = javaBlockState.pistonBehavior();
|
||||||
BlockMapping blockMapping = BlockMapping.builder()
|
BlockMapping blockMapping = BlockMapping.builder()
|
||||||
.canBreakWithHand(javaBlockState.canBreakWithHand())
|
.canBreakWithHand(javaBlockState.canBreakWithHand())
|
||||||
.pickItem(javaBlockState.pickItem())
|
.pickItem(javaBlockState.pickItem())
|
||||||
.isNonVanilla(true)
|
.isNonVanilla(true)
|
||||||
.javaIdentifier(javaId)
|
.javaIdentifier(javaId)
|
||||||
.javaBlockId(javaBlockState.stateGroupId())
|
.javaBlockId(javaBlockState.stateGroupId())
|
||||||
.hardness(javaBlockState.blockHardness())
|
.hardness(javaBlockState.blockHardness())
|
||||||
.pistonBehavior(pistonBehavior == null ? PistonBehavior.NORMAL : PistonBehavior.getByName(pistonBehavior))
|
.pistonBehavior(pistonBehavior == null ? PistonBehavior.NORMAL : PistonBehavior.getByName(pistonBehavior))
|
||||||
.isBlockEntity(javaBlockState.hasBlockEntity())
|
.isBlockEntity(javaBlockState.hasBlockEntity())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Block.Builder builder = Block.builder()
|
Block.Builder builder = Block.builder()
|
||||||
.destroyTime(javaBlockState.blockHardness());
|
.destroyTime(javaBlockState.blockHardness());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren