Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Block changes work
Dieser Commit ist enthalten in:
Ursprung
3f7dc3170e
Commit
77c8acefdb
@ -54,10 +54,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerU
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.*;
|
||||
import com.nukkitx.nbt.CompoundTagBuilder;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import com.nukkitx.nbt.stream.NBTOutputStream;
|
||||
@ -102,13 +99,10 @@ import org.geysermc.connector.network.translators.java.entity.spawn.JavaSpawnPla
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaDisplayScoreboardTranslator;
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaScoreboardObjectiveTranslator;
|
||||
import org.geysermc.connector.network.translators.java.scoreboard.JavaUpdateScoreTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaChunkDataTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaNotifyClientTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.*;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaOpenWindowTranslator;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator;
|
||||
import org.geysermc.connector.network.translators.java.JavaTitleTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaSpawnPositionTranslator;
|
||||
import org.geysermc.connector.network.translators.java.world.JavaUpdateTimeTranslator;
|
||||
import org.geysermc.connector.network.translators.java.window.JavaWindowItemsTranslator;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -178,6 +172,7 @@ public class TranslatorsInit {
|
||||
Registry.registerJava(ServerScoreboardObjectivePacket.class, new JavaScoreboardObjectiveTranslator());
|
||||
Registry.registerJava(ServerDisplayScoreboardPacket.class, new JavaDisplayScoreboardTranslator());
|
||||
Registry.registerJava(ServerUpdateScorePacket.class, new JavaUpdateScoreTranslator());
|
||||
Registry.registerJava(ServerBlockChangePacket.class, new JavaBlockChangeTranslator());
|
||||
|
||||
Registry.registerBedrock(AnimatePacket.class, new BedrockAnimateTranslator());
|
||||
Registry.registerBedrock(CommandRequestPacket.class, new BedrockCommandRequestTranslator());
|
||||
|
@ -0,0 +1,30 @@
|
||||
package org.geysermc.connector.network.translators.java.world;
|
||||
|
||||
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.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;
|
||||
|
||||
public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChangePacket> {
|
||||
@Override
|
||||
public void translate(ServerBlockChangePacket packet, GeyserSession session) {
|
||||
UpdateBlockPacket pack = new UpdateBlockPacket();
|
||||
|
||||
BlockChangeRecord record = packet.getRecord();
|
||||
|
||||
BedrockItem i = new ItemTranslator().getBedrockBlock(record.getBlock());
|
||||
|
||||
pack.setDataLayer(0);
|
||||
pack.setRuntimeId(i.getId() >> 4 | i.getData());
|
||||
pack.setBlockPosition(new Vector3i(
|
||||
record.getPosition().getX()
|
||||
, record.getPosition().getY()
|
||||
, record.getPosition().getZ()));
|
||||
|
||||
session.getUpstream().sendPacket(pack);
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren