diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/config/BlockIdConfig.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/config/BlockIdConfig.java index 3c39e11c..5291205e 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/config/BlockIdConfig.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/config/BlockIdConfig.java @@ -66,7 +66,7 @@ public BlockIdConfig(ConfigurationNode node, ConfigurationLoader> 1; // blockByteIndex / 2 + boolean largeHalf = (blockByteIndex & 0x1) != 0; // (blockByteIndex % 2) == 0 + + int blockId = this.blocks[blockByteIndex] & 0xFF; + + if (this.add.length > 0) { + blockId = blockId | (getByteHalf(this.add[blockHalfByteIndex], largeHalf) << 8); + } + + int blockData = getByteHalf(this.data[blockHalfByteIndex], largeHalf); + + return blockId + ":" + blockData; + } + public LightData getLightData(Vector3i pos) { int x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16) int y = pos.getY() & 0xF; diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java index 6c93ba0a..4b93bd08 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java @@ -43,7 +43,7 @@ import net.querz.nbt.Tag; import net.querz.nbt.mca.MCAUtil; -class ChunkAnvil113 extends Chunk { +public class ChunkAnvil113 extends Chunk { private BiomeMapper biomeIdMapper; private boolean isGenerated; diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/Biome.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/Biome.java index 8f8fcb30..e3963214 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/Biome.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/Biome.java @@ -26,6 +26,7 @@ import com.flowpowered.math.vector.Vector3f; import com.flowpowered.math.vector.Vector4f; +import com.google.common.base.MoreObjects; import de.bluecolored.bluemap.core.util.ConfigUtils; import de.bluecolored.bluemap.core.util.MathUtils; @@ -103,6 +104,17 @@ public static Biome create(String id, ConfigurationNode node) { return biome; } - + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("id", getId()) + .add("ordinal", getOrdinal()) + .add("humidity", getHumidity()) + .add("temp", getTemp()) + .add("waterColor", getWaterColor()) + .add("overlayFoliageColor", getOverlayFoliageColor()) + .add("overlayGrassColor", getOverlayGrassColor()) + .toString(); + } } diff --git a/BlueMapSponge/src/main/java/de/bluecolored/bluemap/sponge/Commands.java b/BlueMapSponge/src/main/java/de/bluecolored/bluemap/sponge/Commands.java index 9a7461dc..47a0e649 100644 --- a/BlueMapSponge/src/main/java/de/bluecolored/bluemap/sponge/Commands.java +++ b/BlueMapSponge/src/main/java/de/bluecolored/bluemap/sponge/Commands.java @@ -1,5 +1,6 @@ package de.bluecolored.bluemap.sponge; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -27,6 +28,9 @@ import com.google.common.collect.Lists; import de.bluecolored.bluemap.core.logger.Logger; +import de.bluecolored.bluemap.core.mca.Chunk; +import de.bluecolored.bluemap.core.mca.ChunkAnvil112; +import de.bluecolored.bluemap.core.mca.MCAWorld; import de.bluecolored.bluemap.core.render.hires.HiresModelManager; import de.bluecolored.bluemap.core.world.Block; import de.bluecolored.bluemap.core.world.World; @@ -51,9 +55,24 @@ public CommandSpec createRootCommand() { Block block = world.getBlock(loc.getBlockPosition()); Block blockBelow = world.getBlock(loc.getBlockPosition().add(0, -1, 0)); + String blockIdMeta = ""; + String blockBelowIdMeta = ""; + + if (world instanceof MCAWorld) { + try { + Chunk chunk = ((MCAWorld) world).getChunk(MCAWorld.blockToChunk(loc.getBlockPosition())); + if (chunk instanceof ChunkAnvil112) { + blockIdMeta = " (id:" + ((ChunkAnvil112) chunk).getBlockIdMeta(loc.getBlockPosition()) + ")"; + blockBelowIdMeta = " (id:" + ((ChunkAnvil112) chunk).getBlockIdMeta(loc.getBlockPosition().add(0, -1, 0)) + ")"; + } + } catch (IOException ex) { + Logger.global.logError("Failed to read chunk for debug!", ex); + } + } + source.sendMessages(Lists.newArrayList( - Text.of("Block: " + block), - Text.of("Block below: " + blockBelow) + Text.of("Block: " + block + blockIdMeta), + Text.of("Block below: " + blockBelow + blockBelowIdMeta) )); }