forked from GeyserMC/Geyser
Block changes work (again)
This commit is contained in:
parent
1c5744e52a
commit
3f45b21689
3 changed files with 10 additions and 1 deletions
|
@ -91,6 +91,12 @@ public class GeyserConnector implements Connector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private GeyserConnector() {
|
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());
|
System.out.println(UUID.randomUUID().toString());
|
||||||
//Metric
|
//Metric
|
||||||
if(!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) {
|
if(!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import lombok.Getter;
|
||||||
public class BedrockItem {
|
public class BedrockItem {
|
||||||
|
|
||||||
public static BedrockItem AIR = new BedrockItem("minecraft:air", 0, 0);
|
public static BedrockItem AIR = new BedrockItem("minecraft:air", 0, 0);
|
||||||
|
public static BedrockItem DIRT = new BedrockItem("minecraft:dirt", 3, 0);
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private int id;
|
private int id;
|
||||||
|
|
|
@ -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.data.game.world.block.BlockChangeRecord;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
|
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
|
||||||
|
import org.geysermc.api.Geyser;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.item.BedrockItem;
|
import org.geysermc.connector.network.translators.item.BedrockItem;
|
||||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||||
|
import org.geysermc.connector.world.GlobalBlockPalette;
|
||||||
|
|
||||||
public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChangePacket> {
|
public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChangePacket> {
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +21,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChang
|
||||||
BedrockItem i = new ItemTranslator().getBedrockBlock(record.getBlock());
|
BedrockItem i = new ItemTranslator().getBedrockBlock(record.getBlock());
|
||||||
|
|
||||||
pack.setDataLayer(0);
|
pack.setDataLayer(0);
|
||||||
pack.setRuntimeId(i.getId() << 4 | i.getData());
|
pack.setRuntimeId(GlobalBlockPalette.getOrCreateRuntimeId(i.hashCode()));
|
||||||
pack.setBlockPosition(new Vector3i(
|
pack.setBlockPosition(new Vector3i(
|
||||||
record.getPosition().getX()
|
record.getPosition().getX()
|
||||||
, record.getPosition().getY()
|
, record.getPosition().getY()
|
||||||
|
|
Loading…
Reference in a new issue