mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
May or may not work at any given time
This commit is contained in:
parent
4cba8b05a5
commit
564179c1c2
3 changed files with 25 additions and 11 deletions
|
|
@ -89,6 +89,7 @@ public class BlockEntityUtils {
|
||||||
try {
|
try {
|
||||||
return MAPPINGS.get(tag.get("id").getValue()).getExtraTags(tag);
|
return MAPPINGS.get(tag.get("id").getValue()).getExtraTags(tag);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
System.out.println(tag);
|
||||||
int x = ((Number) tag.getValue().get("x").getValue()).intValue();
|
int x = ((Number) tag.getValue().get("x").getValue()).intValue();
|
||||||
int y = ((Number) tag.getValue().get("y").getValue()).intValue();
|
int y = ((Number) tag.getValue().get("y").getValue()).intValue();
|
||||||
int z = ((Number) tag.getValue().get("z").getValue()).intValue();
|
int z = ((Number) tag.getValue().get("z").getValue()).intValue();
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
|
||||||
byteBuf.writeBytes(chunkData.biomes); // Biomes - 256 bytes
|
byteBuf.writeBytes(chunkData.biomes); // Biomes - 256 bytes
|
||||||
byteBuf.writeByte(0); // Border blocks - Edu edition only
|
byteBuf.writeByte(0); // Border blocks - Edu edition only
|
||||||
VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now
|
VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now
|
||||||
|
byteBuf.writeBytes(chunkData.blockEntities);
|
||||||
|
|
||||||
byte[] payload = new byte[byteBuf.writerIndex()];
|
byte[] payload = new byte[byteBuf.writerIndex()];
|
||||||
byteBuf.readBytes(payload);
|
byteBuf.readBytes(payload);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import org.geysermc.connector.world.chunk.ChunkSection;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.geysermc.connector.network.translators.BlockEntityUtils.MINECRAFT;
|
||||||
|
|
||||||
public class ChunkUtils {
|
public class ChunkUtils {
|
||||||
|
|
||||||
public static ChunkData translateToBedrock(Column column) {
|
public static ChunkData translateToBedrock(Column column) {
|
||||||
|
|
@ -47,17 +49,28 @@ public class ChunkUtils {
|
||||||
BlockState blockState = chunk.get(x, y, z);
|
BlockState blockState = chunk.get(x, y, z);
|
||||||
BlockEntry block = TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
|
BlockEntry block = TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
|
||||||
|
|
||||||
if(!block.getJavaIdentifier().contains("sign")) {
|
section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z),
|
||||||
section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z),
|
block.getBedrockId() << 4 | block.getBedrockData());
|
||||||
block.getBedrockId() << 4 | block.getBedrockData());
|
|
||||||
|
|
||||||
if (block.getJavaIdentifier().contains("waterlogged=true")) {
|
if (block.getJavaIdentifier().contains("waterlogged=true")) {
|
||||||
section.getBlockStorageArray()[1].setFullBlock(ChunkSection.blockPosition(x, y, z),
|
|
||||||
9 << 4); // water id
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
section.getBlockStorageArray()[1].setFullBlock(ChunkSection.blockPosition(x, y, z),
|
section.getBlockStorageArray()[1].setFullBlock(ChunkSection.blockPosition(x, y, z),
|
||||||
0);
|
9 << 4); // water id
|
||||||
|
}
|
||||||
|
|
||||||
|
//Signs are special
|
||||||
|
if(block.getJavaIdentifier().contains("sign")) {
|
||||||
|
CompoundTag tag = new CompoundTag("");
|
||||||
|
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.StringTag("id", MINECRAFT + "sign"));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.StringTag("Text1", "\"text\":\"\""));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.StringTag("Text2", "\"text\":\"\""));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.StringTag("Text3", "\"text\":\"\""));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.StringTag("Text4", "\"text\":\"\""));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.IntTag("x", x));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.IntTag("y", y));
|
||||||
|
tag.put(new com.github.steveice10.opennbt.tag.builtin.IntTag("z", z));
|
||||||
|
|
||||||
|
tiles.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -70,11 +83,10 @@ public class ChunkUtils {
|
||||||
NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(stream);
|
NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(stream);
|
||||||
|
|
||||||
for (CompoundTag tag : tiles) {
|
for (CompoundTag tag : tiles) {
|
||||||
if(tag.get("id").getValue().toString().contains("sign")) continue;
|
|
||||||
try {
|
try {
|
||||||
nbtStream.write(BlockEntityUtils.getExtraTags(tag));
|
nbtStream.write(BlockEntityUtils.getExtraTags(tag));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//
|
//The close method of the streams doesn't do anything anyway
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue