Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ public SingletonBitArray copy() {
return SingletonBitArray.INSTANCE;
}

@Override
public String toString() {
return "SingletonBitArray{" + "size=" + size() + ", version=" + getVersion() + '}';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,13 @@ private void checkPersistentIds() {
}
}

@Override
public String toString() {
return "BedrockDataPalette{" +
"palette=" + palette +
", bitArray=" + bitArray +
", persistentPalette=" + persistentPalette +
'}';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,7 @@ private void buildLegacyBlockStateMappings() {
this.bedrockBlockStateUpgrader.upgradeToLatest(tag);
final BedrockBlockState bedrockBlockState = BedrockBlockState.fromNbt(tag);
if (!this.bedrockBlockStates.contains(bedrockBlockState)) {
// TODO: This is broken
//throw new RuntimeException("Legacy block state " + bedrockBlockState.toBlockStateString() + " is not mapped to a modern block state");
throw new RuntimeException("Legacy block state " + bedrockBlockState.toBlockStateString() + " is not mapped to a modern block state");
}

this.bedrockLegacyBlockStates.put(id << 6 | metadata & 63, bedrockBlockState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ protected void register() {
final int count = wrapper.read(BedrockTypes.UNSIGNED_VAR_INT); // entry count
for (int i = 0; i < count; i++) {
final String dimensionIdentifier = wrapper.read(BedrockTypes.STRING); // dimension identifier
final int maximumHeight = wrapper.read(BedrockTypes.VAR_INT); // maximum height
final int minimumHeight = wrapper.read(BedrockTypes.VAR_INT); // minimum height
final int maximumHeight = minimumHeight + wrapper.read(BedrockTypes.VAR_INT); // maximum height
wrapper.read(BedrockTypes.VAR_INT); // generator type
wrapper.read(BedrockTypes.VAR_INT); // dimension type
wrapper.read(BedrockTypes.UUID); // pack id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static void register(final BedrockProtocol protocol) {
section.addPalette(PaletteType.BIOMES, new BedrockBiomeArray(biomeData));
}
} else {
for (int i = 0; i < sections.length; i++) {
for (int i = 0; i < sectionCount; i++) {
BedrockDataPalette biomePalette = BedrockTypes.RUNTIME_DATA_PALETTE.read(dataBuf); // biome palette
if (biomePalette == null) {
if (i == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ private void resolvePersistentIds(final BedrockChunkSection bedrockSection) {
if (palette instanceof BedrockDataPalette bedrockPalette) {
if (bedrockPalette.usesPersistentIds()) {
bedrockPalette.resolvePersistentIds(bedrockBlockStateTag -> {
if (!(bedrockBlockStateTag instanceof CompoundTag)) {
ViaBedrock.getPlatform().getLogger().log(Level.WARNING, "Invalid block state tag: Palette=" + bedrockPalette + " Tag=" + bedrockBlockStateTag);
return blockStateRewriter.bedrockId(BedrockBlockState.INFO_UPDATE);
}
final int bedrockBlockState = blockStateRewriter.bedrockId((CompoundTag) bedrockBlockStateTag);
if (bedrockBlockState != -1) {
return bedrockBlockState;
Expand Down
Loading
Loading