Minecraft 1.20

This commit is contained in:
LOOHP
2023-06-07 22:11:02 +01:00
parent 0159361eec
commit 1f021007a1
9 changed files with 173730 additions and 169436 deletions
+2 -2
View File
@@ -139,8 +139,8 @@ public final class Limbo {
//===========================
public final String SERVER_IMPLEMENTATION_VERSION = "1.19.4";
public final int SERVER_IMPLEMENTATION_PROTOCOL = 762;
public final String SERVER_IMPLEMENTATION_VERSION = "1.20";
public final int SERVER_IMPLEMENTATION_PROTOCOL = 763;
public final String LIMBO_IMPLEMENTATION_VERSION;
private final AtomicBoolean isRunning;
@@ -572,11 +572,11 @@ public class ClientConnection extends Thread {
PlayerSpawnEvent spawnEvent = Limbo.getInstance().getEventsManager().callEvent(new PlayerSpawnEvent(player, worldSpawn));
worldSpawn = spawnEvent.getSpawnLocation();
World world = worldSpawn.getWorld();
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, properties.getDefaultGamemode(), Limbo.getInstance().getWorlds(), Limbo.getInstance().getDimensionRegistry().getCodec(), world, 0, (byte) properties.getMaxPlayers(), 8, 8, properties.isReducedDebugInfo(), true, false, true);
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, properties.getDefaultGamemode(), Limbo.getInstance().getWorlds(), Limbo.getInstance().getDimensionRegistry().getCodec(), world, 0, (byte) properties.getMaxPlayers(), 8, 8, properties.isReducedDebugInfo(), true, false, true, 0);
sendPacket(join);
Limbo.getInstance().getUnsafe().a(player, properties.getDefaultGamemode());
ByteArrayOutputStream brandOut = new ByteArrayOutputStream();
DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8);
sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray());
@@ -598,9 +598,9 @@ public class ClientConnection extends Thread {
String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
player.playerInteractManager.update();
PacketPlayOutDeclareCommands declare = DeclareCommands.getDeclareCommandsPacket(player);
if (declare != null) {
sendPacket(declare);
@@ -44,7 +44,6 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
private int chunkZ;
private Chunk chunk;
private Environment environment;
private boolean trustEdges;
private long[] skyLightBitMasks;
private long[] blockLightBitMasks;
private long[] skyLightBitMasksEmpty;
@@ -52,12 +51,11 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
private List<Byte[]> skylightArrays;
private List<Byte[]> blocklightArrays;
public ClientboundLevelChunkWithLightPacket(int chunkX, int chunkZ, Chunk chunk, Environment environment, boolean trustEdges, List<Byte[]> skylightArrays, List<Byte[]> blocklightArrays) {
public ClientboundLevelChunkWithLightPacket(int chunkX, int chunkZ, Chunk chunk, Environment environment, List<Byte[]> skylightArrays, List<Byte[]> blocklightArrays) {
this.chunkX = chunkX;
this.chunkZ = chunkZ;
this.chunk = chunk;
this.environment = environment;
this.trustEdges = trustEdges;
this.skylightArrays = skylightArrays;
this.blocklightArrays = blocklightArrays;
@@ -96,10 +94,6 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
return environment;
}
public boolean isTrustEdges() {
return trustEdges;
}
public long[] getSkyLightBitMasks() {
return skyLightBitMasks;
}
@@ -258,7 +252,6 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
DataTypeIO.writeCompoundTag(output, each);
}
output.writeBoolean(trustEdges);
DataTypeIO.writeVarInt(output, skyLightBitMasks.length);
for (long l : skyLightBitMasks) {
output.writeLong(l);
@@ -49,8 +49,9 @@ public class PacketPlayOutLogin extends PacketOut {
private boolean enableRespawnScreen;
private boolean isDebug;
private boolean isFlat;
private int portalCooldown;
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode, List<World> worlds, CompoundTag dimensionCodec, World world, long hashedSeed, byte maxPlayers, int viewDistance, int simulationDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug, boolean isFlat) {
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode, List<World> worlds, CompoundTag dimensionCodec, World world, long hashedSeed, byte maxPlayers, int viewDistance, int simulationDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug, boolean isFlat, int portalCooldown) {
this.entityId = entityId;
this.isHardcore = isHardcore;
this.gamemode = gamemode;
@@ -66,6 +67,7 @@ public class PacketPlayOutLogin extends PacketOut {
this.enableRespawnScreen = enableRespawnScreen;
this.isDebug = isDebug;
this.isFlat = isFlat;
this.portalCooldown = portalCooldown;
}
public int getEntityId() {
@@ -154,6 +156,7 @@ public class PacketPlayOutLogin extends PacketOut {
output.writeBoolean(isDebug);
output.writeBoolean(isFlat);
output.writeBoolean(false);
DataTypeIO.writeVarInt(output, portalCooldown);
return buffer.toByteArray();
}
@@ -33,6 +33,7 @@ import net.querz.mca.Chunk;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -123,7 +124,7 @@ public class PlayerInteractManager {
if (!currentViewing.containsKey(chunkPos)) {
Chunk chunk = chunkPos.getWorld().getChunkAt(chunkPos.getChunkX(), chunkPos.getChunkZ());
if (chunk == null) {
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), entry.getValue(), world.getEnvironment(), true, new ArrayList<>(), new ArrayList<>());
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), entry.getValue(), world.getEnvironment(), Collections.emptyList(), Collections.emptyList());
player.clientConnection.sendPacket(chunkdata);
} else {
List<Byte[]> blockChunk = world.getLightEngineBlock().getBlockLightBitMask(chunkPos.getChunkX(), chunkPos.getChunkZ());
@@ -137,7 +138,7 @@ public class PlayerInteractManager {
if (skyChunk == null) {
skyChunk = new ArrayList<>();
}
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), chunk, world.getEnvironment(), true, skyChunk, blockChunk);
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), chunk, world.getEnvironment(), skyChunk, blockChunk);
player.clientConnection.sendPacket(chunkdata);
}
}