mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-24 03:25:17 +01:00
Merge branch 'master' into mc/1.12
This commit is contained in:
commit
19ed9a4b00
@ -66,7 +66,7 @@ public BlockIdConfig(ConfigurationNode node, ConfigurationLoader<? extends Confi
|
||||
|
||||
BlockIDMeta idmeta = new BlockIDMeta(blockId, blockMeta);
|
||||
BlockState state = BlockState.fromString(value);
|
||||
|
||||
|
||||
if (blockId == 0) state = BlockState.AIR; //use the static field to increase render speed (== comparison)
|
||||
|
||||
mappings.put(idmeta, state);
|
||||
|
@ -35,7 +35,7 @@
|
||||
import net.querz.nbt.ListTag;
|
||||
import net.querz.nbt.mca.MCAUtil;
|
||||
|
||||
class ChunkAnvil112 extends Chunk {
|
||||
public class ChunkAnvil112 extends Chunk {
|
||||
private BlockIdMapper blockIdMapper;
|
||||
private BiomeMapper biomeIdMapper;
|
||||
|
||||
@ -84,6 +84,15 @@ public BlockState getBlockState(Vector3i pos) {
|
||||
return section.getBlockState(pos);
|
||||
}
|
||||
|
||||
public String getBlockIdMeta(Vector3i pos) {
|
||||
int sectionY = MCAUtil.blockToChunk(pos.getY());
|
||||
|
||||
Section section = this.sections[sectionY];
|
||||
if (section == null) return "0:0";
|
||||
|
||||
return section.getBlockIdMeta(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LightData getLightData(Vector3i pos) {
|
||||
int sectionY = MCAUtil.blockToChunk(pos.getY());
|
||||
@ -119,7 +128,7 @@ public Section(CompoundTag sectionData) {
|
||||
this.skyLight = sectionData.getByteArray("SkyLight");
|
||||
this.data = sectionData.getByteArray("Data");
|
||||
}
|
||||
|
||||
|
||||
public int getSectionY() {
|
||||
return sectionY;
|
||||
}
|
||||
@ -145,6 +154,25 @@ public BlockState getBlockState(Vector3i pos) {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
public String getBlockIdMeta(Vector3i pos) {
|
||||
int x = pos.getX() & 0xF; // Math.floorMod(pos.getX(), 16)
|
||||
int y = pos.getY() & 0xF;
|
||||
int z = pos.getZ() & 0xF;
|
||||
int blockByteIndex = y * 256 + z * 16 + x;
|
||||
int blockHalfByteIndex = blockByteIndex >> 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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user