Minecraft 1.19.4

This commit is contained in:
LOOHP 2023-03-16 02:44:42 +00:00
parent ba0f98b6c7
commit cfd8a0ab2c
12 changed files with 61738 additions and 54461 deletions

View File

@ -24,7 +24,7 @@
<groupId>com.loohp</groupId> <groupId>com.loohp</groupId>
<artifactId>Limbo</artifactId> <artifactId>Limbo</artifactId>
<name>Limbo</name> <name>Limbo</name>
<version>0.7.2-ALPHA</version> <version>0.7.4-ALPHA</version>
<description>Standalone Limbo Minecraft Server.</description> <description>Standalone Limbo Minecraft Server.</description>
<url>https://github.com/LOOHP/Limbo</url> <url>https://github.com/LOOHP/Limbo</url>
@ -136,7 +136,7 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}-1.19.3</finalName> <finalName>${project.artifactId}-${project.version}-1.19.4</finalName>
</build> </build>
<profiles> <profiles>

View File

@ -139,8 +139,8 @@ public final class Limbo {
//=========================== //===========================
public final String SERVER_IMPLEMENTATION_VERSION = "1.19.3"; public final String SERVER_IMPLEMENTATION_VERSION = "1.19.4";
public final int SERVER_IMPLEMENTATION_PROTOCOL = 761; public final int SERVER_IMPLEMENTATION_PROTOCOL = 762;
public final String LIMBO_IMPLEMENTATION_VERSION; public final String LIMBO_IMPLEMENTATION_VERSION;
private final AtomicBoolean isRunning; private final AtomicBoolean isRunning;

View File

@ -99,10 +99,14 @@ public class Channel implements AutoCloseable {
} }
packet = write.getPacket(); packet = write.getPacket();
byte[] packetByte = packet.serializePacket(); byte[] packetByte = packet.serializePacket();
writePacketRaw(packetByte);
return true;
}
public void writePacketRaw(byte[] packetByte) throws IOException {
DataTypeIO.writeVarInt(output, packetByte.length); DataTypeIO.writeVarInt(output, packetByte.length);
output.write(packetByte); output.write(packetByte);
output.flush(); output.flush();
return true;
} }
@Override @Override

View File

@ -404,12 +404,12 @@ public class ClientConnection extends Thread {
int state = 0; int state = 0;
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {
if (!properties.isReducedDebugInfo()) { if (!properties.isReducedDebugInfo()) {
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": " + data[i]); Limbo.getInstance().getConsole().sendMessage(i + ": " + data[i]);
} }
switch (state) { switch (state) {
default: default:
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": ignore data: State: " + String.valueOf(state)); Limbo.getInstance().getConsole().sendMessage(i + ": ignore data: State: " + state);
break; break;
case 0: case 0:
host = data[i]; host = data[i];
@ -437,7 +437,7 @@ public class ClientConnection extends Thread {
} }
} }
if (state != 6) { if (state != 6) {
throw new IllegalStateException("Illegal bungee state: " + String.valueOf(state)); throw new IllegalStateException("Illegal bungee state: " + state);
} }
if (!properties.isReducedDebugInfo()) { if (!properties.isReducedDebugInfo()) {
@ -580,12 +580,12 @@ public class ClientConnection extends Thread {
ByteArrayOutputStream brandOut = new ByteArrayOutputStream(); ByteArrayOutputStream brandOut = new ByteArrayOutputStream();
DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8); DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8);
sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray()); sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray());
SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName()); SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null; PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null;
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(EnumSet.of(PlayerInfoAction.ADD_PLAYER, PlayerInfoAction.UPDATE_GAME_MODE, PlayerInfoAction.UPDATE_LISTED, PlayerInfoAction.UPDATE_LATENCY, PlayerInfoAction.UPDATE_DISPLAY_NAME), player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), true, Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty())); PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(EnumSet.of(PlayerInfoAction.ADD_PLAYER, PlayerInfoAction.UPDATE_GAME_MODE, PlayerInfoAction.UPDATE_LISTED, PlayerInfoAction.UPDATE_LATENCY, PlayerInfoAction.UPDATE_DISPLAY_NAME), player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), true, Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty()));
sendPacket(info); sendPacket(info);
Set<PlayerAbilityFlags> flags = new HashSet<>(); Set<PlayerAbilityFlags> flags = new HashSet<>();
if (properties.isAllowFlight()) { if (properties.isAllowFlight()) {
flags.add(PlayerAbilityFlags.FLY); flags.add(PlayerAbilityFlags.FLY);
@ -598,21 +598,21 @@ public class ClientConnection extends Thread {
String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "<ip address withheld>") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")"; 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!"); Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
player.playerInteractManager.update(); player.playerInteractManager.update();
PacketPlayOutDeclareCommands declare = DeclareCommands.getDeclareCommandsPacket(player); PacketPlayOutDeclareCommands declare = DeclareCommands.getDeclareCommandsPacket(player);
if (declare != null) { if (declare != null) {
sendPacket(declare); sendPacket(declare);
} }
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch()); PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch());
sendPacket(spawnPos); sendPacket(spawnPos);
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1, false); PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1);
Limbo.getInstance().getUnsafe().a(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch())); Limbo.getInstance().getUnsafe().a(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch()));
sendPacket(positionLook); sendPacket(positionLook);
player.getDataWatcher().update(); player.getDataWatcher().update();
PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers")); PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers"));
sendPacket(show); sendPacket(show);
@ -667,14 +667,14 @@ public class ClientConnection extends Thread {
CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> { CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> {
if (event.isCancelled()) { if (event.isCancelled()) {
Location returnTo = event.getFrom(); Location returnTo = event.getFrom();
PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1, false); PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1);
sendPacket(cancel); sendPacket(cancel);
} else { } else {
Location to = event.getTo(); Location to = event.getTo();
Limbo.getInstance().getUnsafe().a(player, to); Limbo.getInstance().getUnsafe().a(player, to);
// If an event handler used setTo, let's make sure we tell the player about it. // If an event handler used setTo, let's make sure we tell the player about it.
if (!originalTo.equals(to)) { if (!originalTo.equals(to)) {
PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1, false); PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1);
sendPacket(pos); sendPacket(pos);
} }
PacketPlayOutUpdateViewPosition response = new PacketPlayOutUpdateViewPosition((int) player.getLocation().getX() >> 4, (int) player.getLocation().getZ() >> 4); PacketPlayOutUpdateViewPosition response = new PacketPlayOutUpdateViewPosition((int) player.getLocation().getX() >> 4, (int) player.getLocation().getZ() >> 4);

View File

@ -70,9 +70,9 @@ public class PacketPlayOutPlayerAbilities extends PacketOut {
DataOutputStream output = new DataOutputStream(buffer); DataOutputStream output = new DataOutputStream(buffer);
output.writeByte(Packet.getPlayOut().get(getClass())); output.writeByte(Packet.getPlayOut().get(getClass()));
int value = 0; byte value = 0;
for (PlayerAbilityFlags flag : flags) { for (PlayerAbilityFlags flag : flags) {
value = value | flag.getValue(); value = (byte) (value | flag.getValue());
} }
output.writeByte(value); output.writeByte(value);

View File

@ -55,9 +55,8 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
private float pitch; private float pitch;
private Set<PlayerTeleportFlags> flags; private Set<PlayerTeleportFlags> flags;
private int teleportId; private int teleportId;
private boolean dismountVehicle;
public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, boolean dismountVehicle, PlayerTeleportFlags... flags) { public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, PlayerTeleportFlags... flags) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
@ -65,7 +64,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
this.pitch = pitch; this.pitch = pitch;
this.teleportId = teleportId; this.teleportId = teleportId;
this.flags = new HashSet<>(Arrays.asList(flags)); this.flags = new HashSet<>(Arrays.asList(flags));
this.dismountVehicle = dismountVehicle;
} }
public double getX() { public double getX() {
@ -96,10 +94,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
return teleportId; return teleportId;
} }
public boolean isDismountVehicle() {
return dismountVehicle;
}
@Override @Override
public byte[] serializePacket() throws IOException { public byte[] serializePacket() throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@ -119,7 +113,6 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
output.writeByte(flag); output.writeByte(flag);
DataTypeIO.writeVarInt(output, teleportId); DataTypeIO.writeVarInt(output, teleportId);
output.writeBoolean(dismountVehicle);
return buffer.toByteArray(); return buffer.toByteArray();
} }

View File

@ -251,7 +251,7 @@ public class Player extends LivingEntity implements CommandSender, InventoryHold
PacketPlayOutRespawn respawn = new PacketPlayOutRespawn(location.getWorld(), Limbo.getInstance().getDimensionRegistry().getCodec(), 0, gamemode, false, false, true); PacketPlayOutRespawn respawn = new PacketPlayOutRespawn(location.getWorld(), Limbo.getInstance().getDimensionRegistry().getCodec(), 0, gamemode, false, false, true);
clientConnection.sendPacket(respawn); clientConnection.sendPacket(respawn);
} }
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), 1, false); PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), 1);
clientConnection.sendPacket(positionLook); clientConnection.sendPacket(positionLook);
} catch (IOException e) {} } catch (IOException e) {}
} }

View File

@ -59,7 +59,7 @@ public class MojangAPIUtils {
connection.addRequestProperty("Cache-Control", "no-cache, no-store, must-revalidate"); connection.addRequestProperty("Cache-Control", "no-cache, no-store, must-revalidate");
connection.addRequestProperty("Pragma", "no-cache"); connection.addRequestProperty("Pragma", "no-cache");
if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) { if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
String reply = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); String reply = new BufferedReader(new InputStreamReader(connection.getInputStream())).lines().collect(Collectors.joining()).replace(" ", "");
if (!reply.contains("\"error\":\"BadRequestException\"")) { if (!reply.contains("\"error\":\"BadRequestException\"")) {
String uuid = reply.split("\"id\":\"")[1].split("\"")[0]; String uuid = reply.split("\"id\":\"")[1].split("\"")[0];
return UUID.fromString(uuid.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5")); return UUID.fromString(uuid.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)", "$1-$2-$3-$4-$5"));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,61 +12,61 @@
"PacketLoginOutPluginMessaging": "0x04" "PacketLoginOutPluginMessaging": "0x04"
}, },
"PlayIn": { "PlayIn": {
"0x11": "PacketPlayInKeepAlive", "0x12": "PacketPlayInKeepAlive",
"0x04": "ServerboundChatCommandPacket", "0x04": "ServerboundChatCommandPacket",
"0x05": "PacketPlayInChat", "0x05": "PacketPlayInChat",
"0x14": "PacketPlayInPositionAndLook", "0x15": "PacketPlayInPositionAndLook",
"0x13": "PacketPlayInPosition", "0x14": "PacketPlayInPosition",
"0x15": "PacketPlayInRotation", "0x16": "PacketPlayInRotation",
"0x0C": "PacketPlayInPluginMessaging", "0x0D": "PacketPlayInPluginMessaging",
"0x08": "PacketPlayInTabComplete", "0x09": "PacketPlayInTabComplete",
"0x28": "PacketPlayInHeldItemChange", "0x28": "PacketPlayInHeldItemChange",
"0x24": "PacketPlayInResourcePackStatus", "0x24": "PacketPlayInResourcePackStatus",
"0x32": "PacketPlayInBlockPlace", "0x32": "PacketPlayInBlockPlace",
"0x31": "PacketPlayInUseItem", "0x31": "PacketPlayInUseItem",
"0x2B": "PacketPlayInSetCreativeSlot", "0x2B": "PacketPlayInSetCreativeSlot",
"0x0A": "PacketPlayInWindowClick", "0x0B": "PacketPlayInWindowClick",
"0x0B": "PacketPlayInCloseWindow", "0x0C": "PacketPlayInCloseWindow",
"0x19": "PacketPlayInPickItem", "0x1A": "PacketPlayInPickItem",
"0x1C": "PacketPlayInBlockDig", "0x1D": "PacketPlayInBlockDig",
"0x23": "PacketPlayInItemName" "0x23": "PacketPlayInItemName"
}, },
"PlayOut": { "PlayOut": {
"PacketPlayOutLogin": "0x24", "PacketPlayOutLogin": "0x28",
"PacketPlayOutPositionAndLook": "0x38", "PacketPlayOutPositionAndLook": "0x3C",
"PacketPlayOutSpawnPosition": "0x4C", "PacketPlayOutSpawnPosition": "0x50",
"ClientboundSystemChatPacket": "0x60", "ClientboundSystemChatPacket": "0x64",
"PacketPlayOutPlayerAbilities": "0x30", "PacketPlayOutPlayerAbilities": "0x34",
"ClientboundLevelChunkWithLightPacket": "0x20", "ClientboundLevelChunkWithLightPacket": "0x24",
"PacketPlayOutUnloadChunk": "0x1B", "PacketPlayOutUnloadChunk": "0x1E",
"PacketPlayOutKeepAlive": "0x1F", "PacketPlayOutKeepAlive": "0x23",
"PacketPlayOutPlayerInfo": "0x36", "PacketPlayOutPlayerInfo": "0x3A",
"PacketPlayOutUpdateViewPosition": "0x4A", "PacketPlayOutUpdateViewPosition": "0x4E",
"PacketPlayOutDisconnect": "0x17", "PacketPlayOutDisconnect": "0x1A",
"PacketPlayOutPluginMessaging": "0x15", "PacketPlayOutPluginMessaging": "0x17",
"PacketPlayOutTabComplete": "0x0D", "PacketPlayOutTabComplete": "0x0F",
"PacketPlayOutDeclareCommands": "0x0E", "PacketPlayOutDeclareCommands": "0x10",
"PacketPlayOutRespawn": "0x3E", "PacketPlayOutRespawn": "0x41",
"PacketPlayOutGameState": "0x1C", "PacketPlayOutGameState": "0x1F",
"PacketPlayOutEntityDestroy": "0x3A", "PacketPlayOutEntityDestroy": "0x3E",
"PacketPlayOutEntityMetadata": "0x4E", "PacketPlayOutEntityMetadata": "0x52",
"PacketPlayOutSpawnEntity": "0x00", "PacketPlayOutSpawnEntity": "0x01",
"PacketPlayOutHeldItemChange": "0x49", "PacketPlayOutHeldItemChange": "0x4D",
"PacketPlayOutPlayerListHeaderFooter": "0x61", "PacketPlayOutPlayerListHeaderFooter": "0x65",
"PacketPlayOutResourcePackSend": "0x3C", "PacketPlayOutResourcePackSend": "0x40",
"ClientboundSetTitlesAnimationPacket": "0x5C", "ClientboundSetTitlesAnimationPacket": "0x60",
"ClientboundSetTitleTextPacket": "0x5B", "ClientboundSetTitleTextPacket": "0x5F",
"ClientboundSetSubtitleTextPacket": "0x59", "ClientboundSetSubtitleTextPacket": "0x5D",
"ClientboundSetActionBarTextPacket": "0x42", "ClientboundSetActionBarTextPacket": "0x46",
"ClientboundClearTitlesPacket": "0x0C", "ClientboundClearTitlesPacket": "0x0E",
"PacketPlayOutBoss": "0x0A", "PacketPlayOutBoss": "0x0B",
"PacketPlayOutNamedSoundEffect": "0x5E", "PacketPlayOutNamedSoundEffect": "0x62",
"PacketPlayOutStopSound": "0x5F", "PacketPlayOutStopSound": "0x63",
"PacketPlayOutWindowItems": "0x10", "PacketPlayOutWindowItems": "0x12",
"PacketPlayOutSetSlot": "0x12", "PacketPlayOutSetSlot": "0x14",
"PacketPlayOutOpenWindow": "0x2C", "PacketPlayOutOpenWindow": "0x30",
"PacketPlayOutCloseWindow": "0x0F", "PacketPlayOutCloseWindow": "0x11",
"PacketPlayOutWindowData": "0x11" "PacketPlayOutWindowData": "0x13"
}, },
"StatusIn": { "StatusIn": {
"0x01": "PacketStatusInPing", "0x01": "PacketStatusInPing",

File diff suppressed because it is too large Load Diff