Search in sources :

Example 6 with Chunk

use of com.github.steveice10.mc.protocol.data.game.chunk.Chunk in project DragonProxy by DragonetMC.

the class PERequestChunkRadiusPacketTranslator method translate.

@Override
public Packet[] translate(UpstreamSession session, RequestChunkRadiusPacket packet) {
    session.getDataCache().put(CacheKey.PLAYER_REQUESTED_CHUNK_RADIUS, packet.radius);
    // System.out.println("Requested chunk radius : " + packet.radius);
    session.sendPacket(new ChunkRadiusUpdatedPacket(((RequestChunkRadiusPacket) packet).radius));
    session.getChunkCache().sendOrderedChunks();
    ClientSettingsPacket clientSettingsPacket = new ClientSettingsPacket((String) session.getDataCache().getOrDefault(CacheKey.PLAYER_LANGUAGE, "enUS"), (int) session.getDataCache().getOrDefault(CacheKey.PLAYER_REQUESTED_CHUNK_RADIUS, 5), ChatVisibility.FULL, false, new SkinPart[] {}, Hand.OFF_HAND);
    ((PCDownstreamSession) session.getDownstream()).send(clientSettingsPacket);
    return null;
}
Also used : ChunkRadiusUpdatedPacket(org.dragonet.protocol.packets.ChunkRadiusUpdatedPacket) RequestChunkRadiusPacket(org.dragonet.protocol.packets.RequestChunkRadiusPacket) ClientSettingsPacket(com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket) PCDownstreamSession(org.dragonet.proxy.network.PCDownstreamSession)

Aggregations

ChunkPos (org.dragonet.common.maths.ChunkPos)5 Chunk (com.github.steveice10.mc.protocol.data.game.chunk.Chunk)4 Column (com.github.steveice10.mc.protocol.data.game.chunk.Column)4 BlockPosition (org.dragonet.common.maths.BlockPosition)4 BlockState (com.github.steveice10.mc.protocol.data.game.world.block.BlockState)3 ClientSettingsPacket (com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket)2 ArrayList (java.util.ArrayList)2 PCDownstreamSession (org.dragonet.proxy.network.PCDownstreamSession)2 PlayerListEntry (com.github.steveice10.mc.protocol.data.game.PlayerListEntry)1 BlockStorage (com.github.steveice10.mc.protocol.data.game.chunk.BlockStorage)1 ItemStack (com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack)1 ClientPluginMessagePacket (com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket)1 ClientTeleportConfirmPacket (com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket)1 ServerJoinGamePacket (com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket)1 ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 ItemEntry (org.dragonet.common.data.itemsblocks.ItemEntry)1 CompoundTag (org.dragonet.common.data.nbt.tag.CompoundTag)1 Vector3F (org.dragonet.common.maths.Vector3F)1