geforkt von Mirrors/AxiomPaperPlugin
Dieser Commit ist enthalten in:
Ursprung
e9a2b15259
Commit
8cfed96b39
@ -1,6 +1,7 @@
|
||||
package com.moulberry.axiom.packet;
|
||||
|
||||
import com.moulberry.axiom.AxiomConstants;
|
||||
import com.moulberry.axiom.AxiomPaper;
|
||||
import com.moulberry.axiom.buffer.BiomeBuffer;
|
||||
import com.moulberry.axiom.buffer.CompressedBlockEntity;
|
||||
import com.moulberry.axiom.buffer.MojBuf;
|
||||
@ -9,18 +10,17 @@ import com.moulberry.axiom.integration.RegionProtection;
|
||||
import com.moulberry.axiom.integration.VersionTranslator;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
@ -85,13 +85,14 @@ public class SetBlockBufferPacketListener implements AxiomPacketListener {
|
||||
changedChunks.add(world.getChunkAt(x << 2, z << 2));
|
||||
});
|
||||
|
||||
ServerLevel level = AxiomPaper.convert(world);
|
||||
//TODO multiversioning
|
||||
var chunkMap = world.getChunkSource().chunkMap;
|
||||
ChunkMap chunkMap = level.getChunkSource().chunkMap;
|
||||
HashMap<ServerPlayer, List<LevelChunk>> map = new HashMap<>();
|
||||
for (LevelChunk chunk : changedChunks) {
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
for (Chunk chunk : changedChunks) {
|
||||
ChunkPos chunkPos = new ChunkPos(chunk.getX(), chunk.getZ());
|
||||
for (ServerPlayer serverPlayer2 : chunkMap.getPlayers(chunkPos, false)) {
|
||||
map.computeIfAbsent(serverPlayer2, serverPlayer -> new ArrayList<>()).add(chunk);
|
||||
map.computeIfAbsent(serverPlayer2, serverPlayer -> new ArrayList<>()).add((LevelChunk) ((CraftChunk)chunk).getHandle(ChunkStatus.BIOMES));
|
||||
}
|
||||
}
|
||||
map.forEach((serverPlayer, list) -> serverPlayer.connection.send(ClientboundChunksBiomesPacket.forChunks(list)));
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren