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

View File

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

View File

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

View File

@ -404,12 +404,12 @@ public class ClientConnection extends Thread {
int state = 0;
for (int i = 0; i < data.length; i++) {
if (!properties.isReducedDebugInfo()) {
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": " + data[i]);
Limbo.getInstance().getConsole().sendMessage(i + ": " + data[i]);
}
switch (state) {
default:
Limbo.getInstance().getConsole().sendMessage(String.valueOf(i) + ": ignore data: State: " + String.valueOf(state));
Limbo.getInstance().getConsole().sendMessage(i + ": ignore data: State: " + state);
break;
case 0:
host = data[i];
@ -437,7 +437,7 @@ public class ClientConnection extends Thread {
}
}
if (state != 6) {
throw new IllegalStateException("Illegal bungee state: " + String.valueOf(state));
throw new IllegalStateException("Illegal bungee state: " + state);
}
if (!properties.isReducedDebugInfo()) {
@ -580,12 +580,12 @@ public class ClientConnection extends Thread {
ByteArrayOutputStream brandOut = new ByteArrayOutputStream();
DataTypeIO.writeString(new DataOutputStream(brandOut), properties.getServerModName(), StandardCharsets.UTF_8);
sendPluginMessage(BRAND_ANNOUNCE_CHANNEL, brandOut.toByteArray());
SkinResponse skinresponce = (isVelocityModern || isBungeeGuard || isBungeecord) && forwardedSkin != null ? forwardedSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
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()));
sendPacket(info);
Set<PlayerAbilityFlags> flags = new HashSet<>();
if (properties.isAllowFlight()) {
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() + ")";
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);
}
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch());
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()));
sendPacket(positionLook);
player.getDataWatcher().update();
PacketPlayOutEntityMetadata show = new PacketPlayOutEntityMetadata(player, false, Player.class.getDeclaredField("skinLayers"));
sendPacket(show);
@ -667,14 +667,14 @@ public class ClientConnection extends Thread {
CheckedBiConsumer<PlayerMoveEvent, Location, IOException> processMoveEvent = (event, originalTo) -> {
if (event.isCancelled()) {
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);
} else {
Location to = event.getTo();
Limbo.getInstance().getUnsafe().a(player, to);
// If an event handler used setTo, let's make sure we tell the player about it.
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);
}
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);
output.writeByte(Packet.getPlayOut().get(getClass()));
int value = 0;
byte value = 0;
for (PlayerAbilityFlags flag : flags) {
value = value | flag.getValue();
value = (byte) (value | flag.getValue());
}
output.writeByte(value);

View File

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

View File

@ -59,7 +59,7 @@ public class MojangAPIUtils {
connection.addRequestProperty("Cache-Control", "no-cache, no-store, must-revalidate");
connection.addRequestProperty("Pragma", "no-cache");
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\"")) {
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"));

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

File diff suppressed because it is too large Load Diff