Block changes work (again)

This commit is contained in:
EOT3000 2019-09-14 19:21:55 -04:00
parent 1c5744e52a
commit 3f45b21689
3 changed files with 10 additions and 1 deletions

View file

@ -91,6 +91,12 @@ public class GeyserConnector implements Connector {
}
private GeyserConnector() {
System.out.println(12 << 4);
System.out.println(2 << 2);
System.out.println(1 << 2 | 4);
System.out.println(23 << 3);
System.out.println(UUID.randomUUID().toString());
//Metric
if(!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) {

View file

@ -33,6 +33,7 @@ import lombok.Getter;
public class BedrockItem {
public static BedrockItem AIR = new BedrockItem("minecraft:air", 0, 0);
public static BedrockItem DIRT = new BedrockItem("minecraft:dirt", 3, 0);
private String identifier;
private int id;

View file

@ -4,10 +4,12 @@ import com.flowpowered.math.vector.Vector3i;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockChangeRecord;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
import org.geysermc.api.Geyser;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.item.BedrockItem;
import org.geysermc.connector.network.translators.item.ItemTranslator;
import org.geysermc.connector.world.GlobalBlockPalette;
public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChangePacket> {
@Override
@ -19,7 +21,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChang
BedrockItem i = new ItemTranslator().getBedrockBlock(record.getBlock());
pack.setDataLayer(0);
pack.setRuntimeId(i.getId() << 4 | i.getData());
pack.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(i.hashCode()));
pack.setBlockPosition(new Vector3i(
record.getPosition().getX()
, record.getPosition().getY()