mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
1.15.2 EntityMetaData (big refactor update)
This commit is contained in:
parent
f692d13174
commit
cbf7eaffbd
@ -28,17 +28,10 @@ public class DirectPalette implements Palette {
|
||||
|
||||
@Override
|
||||
public byte getBitsPerBlock() {
|
||||
switch (version) {
|
||||
case VERSION_1_9_4:
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
if (version.getVersionNumber() <= ProtocolVersion.VERSION_1_12_2.getVersionNumber()) {
|
||||
return 13;
|
||||
case VERSION_1_13_2:
|
||||
case VERSION_1_14_4:
|
||||
return 14;
|
||||
}
|
||||
return -1;
|
||||
return 14;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class PacketMultiBlockChange implements ClientboundPacket {
|
||||
byte pos = buffer.readByte();
|
||||
byte y = buffer.readByte();
|
||||
int blockId = buffer.readVarInt();
|
||||
blocks.put(new InChunkLocation(((pos & 0xF0) >>> 4), y, (pos & 0xF)), Blocks.getBlock(blockId, buffer.getVersion()));
|
||||
blocks.put(new InChunkLocation(((pos & 0xF0 >>> 4) & 0xF), y, (pos & 0xF)), Blocks.getBlock(blockId, buffer.getVersion()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import de.bixilon.minosoft.game.datatypes.scoreboard.ScoreboardObjective;
|
||||
import de.bixilon.minosoft.game.datatypes.scoreboard.ScoreboardScore;
|
||||
import de.bixilon.minosoft.game.datatypes.scoreboard.Team;
|
||||
import de.bixilon.minosoft.game.datatypes.world.BlockPosition;
|
||||
import de.bixilon.minosoft.game.datatypes.world.Chunk;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.nbt.tag.CompoundTag;
|
||||
import de.bixilon.minosoft.nbt.tag.StringTag;
|
||||
@ -293,7 +294,12 @@ public class PacketHandler {
|
||||
}
|
||||
|
||||
public void handle(PacketMultiBlockChange pkg) {
|
||||
connection.getPlayer().getWorld().getChunk(pkg.getLocation()).setBlocks(pkg.getBlocks());
|
||||
Chunk chunk = connection.getPlayer().getWorld().getChunk(pkg.getLocation());
|
||||
if (chunk == null) {
|
||||
Log.warn(String.format("Server tried to change blocks in unloaded chunks! (location=%s)", pkg.getLocation()));
|
||||
return;
|
||||
}
|
||||
chunk.setBlocks(pkg.getBlocks());
|
||||
}
|
||||
|
||||
public void handle(PacketRespawn pkg) {
|
||||
|
@ -19,6 +19,7 @@ import de.bixilon.minosoft.game.datatypes.world.Chunk;
|
||||
import de.bixilon.minosoft.game.datatypes.world.ChunkNibble;
|
||||
import de.bixilon.minosoft.game.datatypes.world.ChunkNibbleLocation;
|
||||
import de.bixilon.minosoft.game.datatypes.world.palette.Palette;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
@ -181,6 +182,16 @@ public class ChunkUtil {
|
||||
blockId &= individualValueMask;
|
||||
|
||||
Block block = palette.byId(blockId);
|
||||
if (block == null) {
|
||||
String blockName;
|
||||
if (buffer.getVersion().getVersionNumber() <= ProtocolVersion.VERSION_1_12_2.getVersionNumber()) {
|
||||
blockName = String.format("%d:%d", blockId >> 4, blockId & 0xF);
|
||||
} else {
|
||||
blockName = String.valueOf(blockId);
|
||||
}
|
||||
Log.warn(String.format("Server sent unknown block: %s", blockName));
|
||||
continue;
|
||||
}
|
||||
if (block.equals(Blocks.nullBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user