mirror of https://github.com/LOOHP/Limbo.git
parent
10c5915d71
commit
32499372bf
4
pom.xml
4
pom.xml
|
|
@ -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.5-ALPHA</version>
|
<version>0.7.6-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.20.1</finalName>
|
<finalName>${project.artifactId}-${project.version}-1.20.2</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,8 @@ public final class Limbo {
|
||||||
|
|
||||||
//===========================
|
//===========================
|
||||||
|
|
||||||
public final String SERVER_IMPLEMENTATION_VERSION = "1.20.1";
|
public final String SERVER_IMPLEMENTATION_VERSION = "1.20.2";
|
||||||
public final int SERVER_IMPLEMENTATION_PROTOCOL = 763;
|
public final int SERVER_IMPLEMENTATION_PROTOCOL = 764;
|
||||||
public final String LIMBO_IMPLEMENTATION_VERSION;
|
public final String LIMBO_IMPLEMENTATION_VERSION;
|
||||||
|
|
||||||
private final AtomicBoolean isRunning;
|
private final AtomicBoolean isRunning;
|
||||||
|
|
@ -236,7 +236,7 @@ public final class Limbo {
|
||||||
Map<Integer, Class<? extends PacketIn>> HandshakeIn = new HashMap<>();
|
Map<Integer, Class<? extends PacketIn>> HandshakeIn = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("HandshakeIn")).keySet()) {
|
for (Object key : ((JSONObject) json.get("HandshakeIn")).keySet()) {
|
||||||
int packetId = Integer.decode((String) key);
|
int packetId = Integer.decode((String) key);
|
||||||
HandshakeIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + (String) ((JSONObject) json.get("HandshakeIn")).get(key)));
|
HandshakeIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + ((JSONObject) json.get("HandshakeIn")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setHandshakeIn(HandshakeIn);
|
Packet.setHandshakeIn(HandshakeIn);
|
||||||
mappingsCount += HandshakeIn.size();
|
mappingsCount += HandshakeIn.size();
|
||||||
|
|
@ -244,14 +244,14 @@ public final class Limbo {
|
||||||
Map<Integer, Class<? extends PacketIn>> StatusIn = new HashMap<>();
|
Map<Integer, Class<? extends PacketIn>> StatusIn = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("StatusIn")).keySet()) {
|
for (Object key : ((JSONObject) json.get("StatusIn")).keySet()) {
|
||||||
int packetId = Integer.decode((String) key);
|
int packetId = Integer.decode((String) key);
|
||||||
StatusIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + (String) ((JSONObject) json.get("StatusIn")).get(key)));
|
StatusIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + ((JSONObject) json.get("StatusIn")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setStatusIn(StatusIn);
|
Packet.setStatusIn(StatusIn);
|
||||||
mappingsCount += StatusIn.size();
|
mappingsCount += StatusIn.size();
|
||||||
|
|
||||||
Map<Class<? extends PacketOut>, Integer> StatusOut = new HashMap<>();
|
Map<Class<? extends PacketOut>, Integer> StatusOut = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("StatusOut")).keySet()) {
|
for (Object key : ((JSONObject) json.get("StatusOut")).keySet()) {
|
||||||
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + (String) key);
|
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + key);
|
||||||
StatusOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("StatusOut")).get(key)));
|
StatusOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("StatusOut")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setStatusOut(StatusOut);
|
Packet.setStatusOut(StatusOut);
|
||||||
|
|
@ -260,30 +260,46 @@ public final class Limbo {
|
||||||
Map<Integer, Class<? extends PacketIn>> LoginIn = new HashMap<>();
|
Map<Integer, Class<? extends PacketIn>> LoginIn = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("LoginIn")).keySet()) {
|
for (Object key : ((JSONObject) json.get("LoginIn")).keySet()) {
|
||||||
int packetId = Integer.decode((String) key);
|
int packetId = Integer.decode((String) key);
|
||||||
LoginIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + (String) ((JSONObject) json.get("LoginIn")).get(key)));
|
LoginIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + ((JSONObject) json.get("LoginIn")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setLoginIn(LoginIn);
|
Packet.setLoginIn(LoginIn);
|
||||||
mappingsCount += LoginIn.size();
|
mappingsCount += LoginIn.size();
|
||||||
|
|
||||||
Map<Class<? extends PacketOut>, Integer> LoginOut = new HashMap<>();
|
Map<Class<? extends PacketOut>, Integer> LoginOut = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("LoginOut")).keySet()) {
|
for (Object key : ((JSONObject) json.get("LoginOut")).keySet()) {
|
||||||
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + (String) key);
|
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + key);
|
||||||
LoginOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("LoginOut")).get(key)));
|
LoginOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("LoginOut")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setLoginOut(LoginOut);
|
Packet.setLoginOut(LoginOut);
|
||||||
mappingsCount += LoginOut.size();
|
mappingsCount += LoginOut.size();
|
||||||
|
|
||||||
|
Map<Integer, Class<? extends PacketIn>> ConfigurationIn = new HashMap<>();
|
||||||
|
for (Object key : ((JSONObject) json.get("ConfigurationIn")).keySet()) {
|
||||||
|
int packetId = Integer.decode((String) key);
|
||||||
|
ConfigurationIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + ((JSONObject) json.get("ConfigurationIn")).get(key)));
|
||||||
|
}
|
||||||
|
Packet.setConfigurationIn(ConfigurationIn);
|
||||||
|
mappingsCount += ConfigurationIn.size();
|
||||||
|
|
||||||
|
Map<Class<? extends PacketOut>, Integer> ConfigurationOut = new HashMap<>();
|
||||||
|
for (Object key : ((JSONObject) json.get("ConfigurationOut")).keySet()) {
|
||||||
|
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + key);
|
||||||
|
ConfigurationOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("ConfigurationOut")).get(key)));
|
||||||
|
}
|
||||||
|
Packet.setConfigurationOut(ConfigurationOut);
|
||||||
|
mappingsCount += ConfigurationOut.size();
|
||||||
|
|
||||||
Map<Integer, Class<? extends PacketIn>> PlayIn = new HashMap<>();
|
Map<Integer, Class<? extends PacketIn>> PlayIn = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("PlayIn")).keySet()) {
|
for (Object key : ((JSONObject) json.get("PlayIn")).keySet()) {
|
||||||
int packetId = Integer.decode((String) key);
|
int packetId = Integer.decode((String) key);
|
||||||
PlayIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + (String) ((JSONObject) json.get("PlayIn")).get(key)));
|
PlayIn.put(packetId, (Class<? extends PacketIn>) Class.forName(classPrefix + ((JSONObject) json.get("PlayIn")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setPlayIn(PlayIn);
|
Packet.setPlayIn(PlayIn);
|
||||||
mappingsCount += PlayIn.size();
|
mappingsCount += PlayIn.size();
|
||||||
|
|
||||||
Map<Class<? extends PacketOut>, Integer> PlayOut = new HashMap<>();
|
Map<Class<? extends PacketOut>, Integer> PlayOut = new HashMap<>();
|
||||||
for (Object key : ((JSONObject) json.get("PlayOut")).keySet()) {
|
for (Object key : ((JSONObject) json.get("PlayOut")).keySet()) {
|
||||||
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + (String) key);
|
Class<? extends PacketOut> packetClass = (Class<? extends PacketOut>) Class.forName(classPrefix + key);
|
||||||
PlayOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("PlayOut")).get(key)));
|
PlayOut.put(packetClass, Integer.decode((String) ((JSONObject) json.get("PlayOut")).get(key)));
|
||||||
}
|
}
|
||||||
Packet.setPlayOut(PlayOut);
|
Packet.setPlayOut(PlayOut);
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public class Channel implements AutoCloseable {
|
public class Channel implements AutoCloseable {
|
||||||
|
|
||||||
|
private final ClientConnection client;
|
||||||
private final List<Pair<Key, ChannelPacketHandler>> handlers;
|
private final List<Pair<Key, ChannelPacketHandler>> handlers;
|
||||||
private final AtomicBoolean valid;
|
private final AtomicBoolean valid;
|
||||||
protected final DataInputStream input;
|
protected final DataInputStream input;
|
||||||
protected final DataOutputStream output;
|
protected final DataOutputStream output;
|
||||||
|
|
||||||
public Channel(DataInputStream input, DataOutputStream output) {
|
public Channel(ClientConnection client, DataInputStream input, DataOutputStream output) {
|
||||||
|
this.client = client;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.handlers = new CopyOnWriteArrayList<>();
|
this.handlers = new CopyOnWriteArrayList<>();
|
||||||
|
|
@ -89,7 +91,13 @@ public class Channel implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean writePacket(PacketOut packet) throws IOException {
|
protected boolean writePacket(PacketOut packet) throws IOException {
|
||||||
|
if (client.getClientState() == ClientConnection.ClientState.DISCONNECTED) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
if (packet.getPacketState() != client.getClientState()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ChannelPacketWrite write = new ChannelPacketWrite(packet);
|
ChannelPacketWrite write = new ChannelPacketWrite(packet);
|
||||||
for (Pair<Key, ChannelPacketHandler> pair : handlers) {
|
for (Pair<Key, ChannelPacketHandler> pair : handlers) {
|
||||||
write = pair.getSecond().write(write);
|
write = pair.getSecond().write(write);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ import com.loohp.limbo.inventory.AnvilInventory;
|
||||||
import com.loohp.limbo.inventory.Inventory;
|
import com.loohp.limbo.inventory.Inventory;
|
||||||
import com.loohp.limbo.inventory.ItemStack;
|
import com.loohp.limbo.inventory.ItemStack;
|
||||||
import com.loohp.limbo.location.Location;
|
import com.loohp.limbo.location.Location;
|
||||||
|
import com.loohp.limbo.network.protocol.packets.ClientboundFinishConfigurationPacket;
|
||||||
|
import com.loohp.limbo.network.protocol.packets.ClientboundRegistryDataPacket;
|
||||||
import com.loohp.limbo.network.protocol.packets.Packet;
|
import com.loohp.limbo.network.protocol.packets.Packet;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketHandshakingIn;
|
import com.loohp.limbo.network.protocol.packets.PacketHandshakingIn;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketIn;
|
import com.loohp.limbo.network.protocol.packets.PacketIn;
|
||||||
|
|
@ -92,6 +94,7 @@ import com.loohp.limbo.network.protocol.packets.PacketStatusInRequest;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketStatusOutPong;
|
import com.loohp.limbo.network.protocol.packets.PacketStatusOutPong;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketStatusOutResponse;
|
import com.loohp.limbo.network.protocol.packets.PacketStatusOutResponse;
|
||||||
import com.loohp.limbo.network.protocol.packets.ServerboundChatCommandPacket;
|
import com.loohp.limbo.network.protocol.packets.ServerboundChatCommandPacket;
|
||||||
|
import com.loohp.limbo.network.protocol.packets.ServerboundFinishConfigurationPacket;
|
||||||
import com.loohp.limbo.player.Player;
|
import com.loohp.limbo.player.Player;
|
||||||
import com.loohp.limbo.player.PlayerInteractManager;
|
import com.loohp.limbo.player.PlayerInteractManager;
|
||||||
import com.loohp.limbo.player.PlayerInventory;
|
import com.loohp.limbo.player.PlayerInventory;
|
||||||
|
|
@ -155,7 +158,7 @@ public class ClientConnection extends Thread {
|
||||||
private final Socket clientSocket;
|
private final Socket clientSocket;
|
||||||
protected Channel channel;
|
protected Channel channel;
|
||||||
private boolean running;
|
private boolean running;
|
||||||
private ClientState state;
|
private volatile ClientState state;
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private TimerTask keepAliveTask;
|
private TimerTask keepAliveTask;
|
||||||
|
|
@ -271,7 +274,7 @@ public class ClientConnection extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setChannel(DataInputStream input, DataOutputStream output) {
|
private void setChannel(DataInputStream input, DataOutputStream output) {
|
||||||
this.channel = new Channel(input, output);
|
this.channel = new Channel(this, input, output);
|
||||||
|
|
||||||
this.channel.addHandlerBefore(DEFAULT_HANDLER_NAMESPACE, new ChannelPacketHandler() {
|
this.channel.addHandlerBefore(DEFAULT_HANDLER_NAMESPACE, new ChannelPacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -294,6 +297,9 @@ public class ClientConnection extends Thread {
|
||||||
case LOGIN:
|
case LOGIN:
|
||||||
packetType = Packet.getLoginIn().get(packetId);
|
packetType = Packet.getLoginIn().get(packetId);
|
||||||
break;
|
break;
|
||||||
|
case CONFIGURATION:
|
||||||
|
packetType = Packet.getConfigurationIn().get(packetId);
|
||||||
|
break;
|
||||||
case PLAY:
|
case PLAY:
|
||||||
packetType = Packet.getPlayIn().get(packetId);
|
packetType = Packet.getPlayIn().get(packetId);
|
||||||
break;
|
break;
|
||||||
|
|
@ -498,7 +504,7 @@ public class ClientConnection extends Thread {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = isBungeecord || isBungeeGuard ? bungeeUUID : (start.hasUniqueId() ? start.getUniqueId() : null);
|
UUID uuid = isBungeecord || isBungeeGuard ? bungeeUUID : start.getUniqueId();
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8));
|
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
@ -511,11 +517,10 @@ public class ClientConnection extends Thread {
|
||||||
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(uuid, username);
|
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(uuid, username);
|
||||||
sendPacket(success);
|
sendPacket(success);
|
||||||
|
|
||||||
state = ClientState.PLAY;
|
state = ClientState.CONFIGURATION;
|
||||||
|
|
||||||
player = new Player(this, username, uuid, Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
player = new Player(this, username, uuid, Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
||||||
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
||||||
Limbo.getInstance().getUnsafe().a(player);
|
|
||||||
break;
|
break;
|
||||||
} else if (packetIn instanceof PacketLoginInPluginMessaging) {
|
} else if (packetIn instanceof PacketLoginInPluginMessaging) {
|
||||||
PacketLoginInPluginMessaging response = (PacketLoginInPluginMessaging) packetIn;
|
PacketLoginInPluginMessaging response = (PacketLoginInPluginMessaging) packetIn;
|
||||||
|
|
@ -539,12 +544,10 @@ public class ClientConnection extends Thread {
|
||||||
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(data.getUuid(), data.getUsername());
|
PacketLoginOutLoginSuccess success = new PacketLoginOutLoginSuccess(data.getUuid(), data.getUsername());
|
||||||
sendPacket(success);
|
sendPacket(success);
|
||||||
|
|
||||||
state = ClientState.PLAY;
|
state = ClientState.CONFIGURATION;
|
||||||
|
|
||||||
player = new Player(this, data.getUsername(), data.getUuid(), Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
player = new Player(this, data.getUsername(), data.getUuid(), Limbo.getInstance().getNextEntityId(), Limbo.getInstance().getServerProperties().getWorldSpawn(), new PlayerInteractManager());
|
||||||
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
player.setSkinLayers((byte) (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
|
||||||
Limbo.getInstance().getUnsafe().a(player);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -562,7 +565,20 @@ public class ClientConnection extends Thread {
|
||||||
state = ClientState.DISCONNECTED;
|
state = ClientState.DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == ClientState.PLAY) {
|
if (state == ClientState.CONFIGURATION) {
|
||||||
|
|
||||||
|
TimeUnit.MILLISECONDS.sleep(500);
|
||||||
|
|
||||||
|
ClientboundRegistryDataPacket registryDataPacket = new ClientboundRegistryDataPacket(Limbo.getInstance().getDimensionRegistry().getCodec());
|
||||||
|
sendPacket(registryDataPacket);
|
||||||
|
|
||||||
|
ClientboundFinishConfigurationPacket clientboundFinishConfigurationPacket = new ClientboundFinishConfigurationPacket();
|
||||||
|
sendPacket(clientboundFinishConfigurationPacket);
|
||||||
|
|
||||||
|
ServerboundFinishConfigurationPacket serverboundFinishConfigurationPacket = (ServerboundFinishConfigurationPacket) channel.readPacket();
|
||||||
|
|
||||||
|
state = ClientState.PLAY;
|
||||||
|
Limbo.getInstance().getUnsafe().a(player);
|
||||||
|
|
||||||
TimeUnit.MILLISECONDS.sleep(500);
|
TimeUnit.MILLISECONDS.sleep(500);
|
||||||
|
|
||||||
|
|
@ -573,7 +589,7 @@ public class ClientConnection extends Thread {
|
||||||
worldSpawn = spawnEvent.getSpawnLocation();
|
worldSpawn = spawnEvent.getSpawnLocation();
|
||||||
World world = worldSpawn.getWorld();
|
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, 0);
|
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, Limbo.getInstance().getWorlds(), (byte) properties.getMaxPlayers(), 8, 8, properties.isReducedDebugInfo(), true, false, world.getEnvironment(), world, 0, properties.getDefaultGamemode(), false, true, 0);
|
||||||
sendPacket(join);
|
sendPacket(join);
|
||||||
Limbo.getInstance().getUnsafe().a(player, properties.getDefaultGamemode());
|
Limbo.getInstance().getUnsafe().a(player, properties.getDefaultGamemode());
|
||||||
|
|
||||||
|
|
@ -877,6 +893,7 @@ public class ClientConnection extends Thread {
|
||||||
HANDSHAKE,
|
HANDSHAKE,
|
||||||
STATUS,
|
STATUS,
|
||||||
LOGIN,
|
LOGIN,
|
||||||
|
CONFIGURATION,
|
||||||
PLAY,
|
PLAY,
|
||||||
DISCONNECTED;
|
DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2022. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ClientboundChunkBatchFinishedPacket extends PacketOut {
|
||||||
|
|
||||||
|
private final int batchSize;
|
||||||
|
|
||||||
|
public ClientboundChunkBatchFinishedPacket(int batchSize) {
|
||||||
|
this.batchSize = batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBatchSize() {
|
||||||
|
return batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] serializePacket() throws IOException {
|
||||||
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
|
|
||||||
|
DataTypeIO.writeVarInt(output, batchSize);
|
||||||
|
|
||||||
|
return buffer.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2022. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ClientboundChunkBatchStartPacket extends PacketOut {
|
||||||
|
|
||||||
|
public ClientboundChunkBatchStartPacket() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] serializePacket() throws IOException {
|
||||||
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
|
|
||||||
|
return buffer.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2023. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ClientboundFinishConfigurationPacket extends PacketOut {
|
||||||
|
|
||||||
|
public ClientboundFinishConfigurationPacket() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] serializePacket() throws IOException {
|
||||||
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
|
output.writeByte(Packet.getConfigurationOut().get(getClass()));
|
||||||
|
|
||||||
|
return buffer.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -119,7 +119,7 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
|
||||||
|
|
||||||
output.writeInt(chunkX);
|
output.writeInt(chunkX);
|
||||||
output.writeInt(chunkZ);
|
output.writeInt(chunkZ);
|
||||||
DataTypeIO.writeCompoundTag(output, chunk.getHeightMaps());
|
DataTypeIO.writeTag(output, chunk.getHeightMaps());
|
||||||
|
|
||||||
ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream();
|
||||||
DataOutputStream dataOut = new DataOutputStream(dataBuffer);
|
DataOutputStream dataOut = new DataOutputStream(dataBuffer);
|
||||||
|
|
@ -222,13 +222,13 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
|
||||||
}
|
}
|
||||||
int biome;
|
int biome;
|
||||||
if (environment.equals(Environment.END)) {
|
if (environment.equals(Environment.END)) {
|
||||||
biome = 9; //the_end
|
biome = 55; //the_end
|
||||||
} else if (environment.equals(Environment.NETHER)) {
|
} else if (environment.equals(Environment.NETHER)) {
|
||||||
biome = 8; //nether_waste
|
biome = 34; //nether_waste
|
||||||
} else if (environment.equals(Environment.NORMAL)) {
|
} else if (environment.equals(Environment.NORMAL)) {
|
||||||
biome = 1; //plains
|
biome = 39; //plains
|
||||||
} else {
|
} else {
|
||||||
biome = 1; //plains
|
biome = 39; //plains
|
||||||
}
|
}
|
||||||
dataOut.writeByte(0);
|
dataOut.writeByte(0);
|
||||||
DataTypeIO.writeVarInt(dataOut, biome);
|
DataTypeIO.writeVarInt(dataOut, biome);
|
||||||
|
|
@ -249,7 +249,7 @@ public class ClientboundLevelChunkWithLightPacket extends PacketOut {
|
||||||
output.writeShort(y);
|
output.writeShort(y);
|
||||||
Integer id = Registry.BLOCK_ENTITY_TYPE.getId(Key.key(chunk.getBlockStateAt(x, y, z).getString("Name")));
|
Integer id = Registry.BLOCK_ENTITY_TYPE.getId(Key.key(chunk.getBlockStateAt(x, y, z).getString("Name")));
|
||||||
DataTypeIO.writeVarInt(output, id == null ? -1 : id);
|
DataTypeIO.writeVarInt(output, id == null ? -1 : id);
|
||||||
DataTypeIO.writeCompoundTag(output, each);
|
DataTypeIO.writeTag(output, each);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTypeIO.writeVarInt(output, skyLightBitMasks.length);
|
DataTypeIO.writeVarInt(output, skyLightBitMasks.length);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2023. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import com.loohp.limbo.utils.DataTypeIO;
|
||||||
|
import net.querz.nbt.tag.CompoundTag;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ClientboundRegistryDataPacket extends PacketOut {
|
||||||
|
|
||||||
|
private final CompoundTag dimensionCodec;
|
||||||
|
|
||||||
|
public ClientboundRegistryDataPacket(CompoundTag dimensionCodec) {
|
||||||
|
this.dimensionCodec = dimensionCodec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag getDimensionCodec() {
|
||||||
|
return dimensionCodec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] serializePacket() throws IOException {
|
||||||
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
DataOutputStream output = new DataOutputStream(buffer);
|
||||||
|
output.writeByte(Packet.getConfigurationOut().get(getClass()));
|
||||||
|
|
||||||
|
DataTypeIO.writeTag(output, dimensionCodec);
|
||||||
|
|
||||||
|
return buffer.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,9 +19,11 @@
|
||||||
|
|
||||||
package com.loohp.limbo.network.protocol.packets;
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import com.loohp.limbo.network.ClientConnection;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Packet {
|
public abstract class Packet {
|
||||||
|
|
||||||
private static Map<Integer, Class<? extends PacketIn>> handshakeIn;
|
private static Map<Integer, Class<? extends PacketIn>> handshakeIn;
|
||||||
|
|
||||||
|
|
@ -31,6 +33,9 @@ public class Packet {
|
||||||
private static Map<Integer, Class<? extends PacketIn>> loginIn;
|
private static Map<Integer, Class<? extends PacketIn>> loginIn;
|
||||||
private static Map<Class<? extends PacketOut>, Integer> loginOut;
|
private static Map<Class<? extends PacketOut>, Integer> loginOut;
|
||||||
|
|
||||||
|
private static Map<Integer, Class<? extends PacketIn>> configurationIn;
|
||||||
|
private static Map<Class<? extends PacketOut>, Integer> configurationOut;
|
||||||
|
|
||||||
private static Map<Integer, Class<? extends PacketIn>> playIn;
|
private static Map<Integer, Class<? extends PacketIn>> playIn;
|
||||||
private static Map<Class<? extends PacketOut>, Integer> playOut;
|
private static Map<Class<? extends PacketOut>, Integer> playOut;
|
||||||
|
|
||||||
|
|
@ -74,6 +79,22 @@ public class Packet {
|
||||||
Packet.loginOut = loginOut;
|
Packet.loginOut = loginOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, Class<? extends PacketIn>> getConfigurationIn() {
|
||||||
|
return configurationIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setConfigurationIn(Map<Integer, Class<? extends PacketIn>> configurationIn) {
|
||||||
|
Packet.configurationIn = configurationIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Class<? extends PacketOut>, Integer> getConfigurationOut() {
|
||||||
|
return configurationOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setConfigurationOut(Map<Class<? extends PacketOut>, Integer> configurationOut) {
|
||||||
|
Packet.configurationOut = configurationOut;
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<Integer, Class<? extends PacketIn>> getPlayIn() {
|
public static Map<Integer, Class<? extends PacketIn>> getPlayIn() {
|
||||||
return playIn;
|
return playIn;
|
||||||
}
|
}
|
||||||
|
|
@ -90,4 +111,19 @@ public class Packet {
|
||||||
Packet.playOut = playOut;
|
Packet.playOut = playOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientConnection.ClientState getPacketState() {
|
||||||
|
Class<? extends Packet> type = getClass();
|
||||||
|
if (handshakeIn.containsValue(type)) {
|
||||||
|
return ClientConnection.ClientState.HANDSHAKE;
|
||||||
|
} else if (loginIn.containsValue(type) || loginOut.containsKey(type)) {
|
||||||
|
return ClientConnection.ClientState.LOGIN;
|
||||||
|
} else if (configurationIn.containsValue(type) || configurationOut.containsKey(type)) {
|
||||||
|
return ClientConnection.ClientState.CONFIGURATION;
|
||||||
|
} else if (playIn.containsValue(type) || playOut.containsKey(type)) {
|
||||||
|
return ClientConnection.ClientState.PLAY;
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("This packet is not registered!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,36 +24,27 @@ import com.loohp.limbo.utils.DataTypeIO;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PacketLoginInLoginStart extends PacketIn {
|
public class PacketLoginInLoginStart extends PacketIn {
|
||||||
|
|
||||||
private String username;
|
private final String username;
|
||||||
private Optional<UUID> uuid;
|
private final UUID uuid;
|
||||||
|
|
||||||
public PacketLoginInLoginStart(String username) {
|
public PacketLoginInLoginStart(String username, UUID uuid) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketLoginInLoginStart(DataInputStream in) throws IOException {
|
public PacketLoginInLoginStart(DataInputStream in) throws IOException {
|
||||||
this.username = DataTypeIO.readString(in, StandardCharsets.UTF_8);
|
this(DataTypeIO.readString(in, StandardCharsets.UTF_8), DataTypeIO.readUUID(in));
|
||||||
if (in.readBoolean()) {
|
|
||||||
this.uuid = Optional.of(DataTypeIO.readUUID(in));
|
|
||||||
} else {
|
|
||||||
this.uuid = Optional.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasUniqueId() {
|
|
||||||
return uuid.isPresent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUniqueId() {
|
public UUID getUniqueId() {
|
||||||
return uuid.orElse(null);
|
return uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import com.loohp.limbo.utils.GameMode;
|
||||||
import com.loohp.limbo.world.Environment;
|
import com.loohp.limbo.world.Environment;
|
||||||
import com.loohp.limbo.world.World;
|
import com.loohp.limbo.world.World;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.querz.nbt.tag.CompoundTag;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|
@ -34,37 +33,37 @@ import java.util.List;
|
||||||
|
|
||||||
public class PacketPlayOutLogin extends PacketOut {
|
public class PacketPlayOutLogin extends PacketOut {
|
||||||
|
|
||||||
private int entityId;
|
private final int entityId;
|
||||||
private boolean isHardcore;
|
private final boolean isHardcore;
|
||||||
private GameMode gamemode;
|
private final List<World> worlds;
|
||||||
private List<World> worlds;
|
private final byte maxPlayers;
|
||||||
private CompoundTag dimensionCodec;
|
private final int viewDistance;
|
||||||
private Environment dimension;
|
private final int simulationDistance;
|
||||||
private World world;
|
private final boolean reducedDebugInfo;
|
||||||
private long hashedSeed;
|
private final boolean enableRespawnScreen;
|
||||||
private byte maxPlayers;
|
private final boolean doLimitedCrafting;
|
||||||
private int viewDistance;
|
private final Environment dimension;
|
||||||
private int simulationDistance;
|
private final World world;
|
||||||
private boolean reducedDebugInfo;
|
private final long hashedSeed;
|
||||||
private boolean enableRespawnScreen;
|
private final GameMode gamemode;
|
||||||
private boolean isDebug;
|
private final boolean isDebug;
|
||||||
private boolean isFlat;
|
private final boolean isFlat;
|
||||||
private int portalCooldown;
|
private final 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, int portalCooldown) {
|
public PacketPlayOutLogin(int entityId, boolean isHardcore, List<World> worlds, byte maxPlayers, int viewDistance, int simulationDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean doLimitedCrafting, Environment dimension, World world, long hashedSeed, GameMode gamemode, boolean isDebug, boolean isFlat, int portalCooldown) {
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
this.isHardcore = isHardcore;
|
this.isHardcore = isHardcore;
|
||||||
this.gamemode = gamemode;
|
|
||||||
this.worlds = worlds;
|
this.worlds = worlds;
|
||||||
this.dimensionCodec = dimensionCodec;
|
|
||||||
this.dimension = world.getEnvironment();
|
|
||||||
this.world = world;
|
|
||||||
this.hashedSeed = hashedSeed;
|
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
this.viewDistance = viewDistance;
|
this.viewDistance = viewDistance;
|
||||||
this.simulationDistance = simulationDistance;
|
this.simulationDistance = simulationDistance;
|
||||||
this.reducedDebugInfo = reducedDebugInfo;
|
this.reducedDebugInfo = reducedDebugInfo;
|
||||||
this.enableRespawnScreen = enableRespawnScreen;
|
this.enableRespawnScreen = enableRespawnScreen;
|
||||||
|
this.doLimitedCrafting = doLimitedCrafting;
|
||||||
|
this.dimension = dimension;
|
||||||
|
this.world = world;
|
||||||
|
this.hashedSeed = hashedSeed;
|
||||||
|
this.gamemode = gamemode;
|
||||||
this.isDebug = isDebug;
|
this.isDebug = isDebug;
|
||||||
this.isFlat = isFlat;
|
this.isFlat = isFlat;
|
||||||
this.portalCooldown = portalCooldown;
|
this.portalCooldown = portalCooldown;
|
||||||
|
|
@ -78,30 +77,10 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
return isHardcore;
|
return isHardcore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameMode getGamemode() {
|
public List<World> getWorlds() {
|
||||||
return gamemode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<World> getWorldsNames() {
|
|
||||||
return worlds;
|
return worlds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getDimensionCodec() {
|
|
||||||
return dimensionCodec;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Environment getDimension() {
|
|
||||||
return dimension;
|
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld() {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getHashedSeed() {
|
|
||||||
return hashedSeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getMaxPlayers() {
|
public byte getMaxPlayers() {
|
||||||
return maxPlayers;
|
return maxPlayers;
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +101,26 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
return enableRespawnScreen;
|
return enableRespawnScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDoLimitedCrafting() {
|
||||||
|
return doLimitedCrafting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Environment getDimension() {
|
||||||
|
return dimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public World getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getHashedSeed() {
|
||||||
|
return hashedSeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameMode getGamemode() {
|
||||||
|
return gamemode;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDebug() {
|
public boolean isDebug() {
|
||||||
return isDebug;
|
return isDebug;
|
||||||
}
|
}
|
||||||
|
|
@ -130,6 +129,10 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
return isFlat;
|
return isFlat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPortalCooldown() {
|
||||||
|
return portalCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] serializePacket() throws IOException {
|
public byte[] serializePacket() throws IOException {
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
@ -138,21 +141,21 @@ public class PacketPlayOutLogin extends PacketOut {
|
||||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||||
output.writeInt(entityId);
|
output.writeInt(entityId);
|
||||||
output.writeBoolean(isHardcore);
|
output.writeBoolean(isHardcore);
|
||||||
output.writeByte((byte) gamemode.getId());
|
|
||||||
output.writeByte(-1);
|
|
||||||
DataTypeIO.writeVarInt(output, worlds.size());
|
DataTypeIO.writeVarInt(output, worlds.size());
|
||||||
for (World world : worlds) {
|
for (World world : worlds) {
|
||||||
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
DataTypeIO.writeCompoundTag(output, dimensionCodec);
|
|
||||||
DataTypeIO.writeString(output, world.getEnvironment().getKey().toString(), StandardCharsets.UTF_8);
|
|
||||||
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
|
||||||
output.writeLong(hashedSeed);
|
|
||||||
DataTypeIO.writeVarInt(output, maxPlayers);
|
DataTypeIO.writeVarInt(output, maxPlayers);
|
||||||
DataTypeIO.writeVarInt(output, viewDistance);
|
DataTypeIO.writeVarInt(output, viewDistance);
|
||||||
DataTypeIO.writeVarInt(output, simulationDistance);
|
DataTypeIO.writeVarInt(output, simulationDistance);
|
||||||
output.writeBoolean(reducedDebugInfo);
|
output.writeBoolean(reducedDebugInfo);
|
||||||
output.writeBoolean(enableRespawnScreen);
|
output.writeBoolean(enableRespawnScreen);
|
||||||
|
output.writeBoolean(doLimitedCrafting);
|
||||||
|
DataTypeIO.writeString(output, world.getEnvironment().getKey().toString(), StandardCharsets.UTF_8);
|
||||||
|
DataTypeIO.writeString(output, Key.key(world.getName()).toString(), StandardCharsets.UTF_8);
|
||||||
|
output.writeLong(hashedSeed);
|
||||||
|
output.writeByte((byte) gamemode.getId());
|
||||||
|
output.writeByte(-1);
|
||||||
output.writeBoolean(isDebug);
|
output.writeBoolean(isDebug);
|
||||||
output.writeBoolean(isFlat);
|
output.writeBoolean(isFlat);
|
||||||
output.writeBoolean(false);
|
output.writeBoolean(false);
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ public class PacketPlayOutRespawn extends PacketOut {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataTypeIO.writeCompoundTag(output, tag != null ? tag : list.get(0));
|
DataTypeIO.writeTag(output, tag != null ? tag : list.get(0));
|
||||||
DataTypeIO.writeString(output, worldName, StandardCharsets.UTF_8);
|
DataTypeIO.writeString(output, worldName, StandardCharsets.UTF_8);
|
||||||
output.writeLong(hashedSeed);
|
output.writeLong(hashedSeed);
|
||||||
output.writeByte((byte) gamemode.getId());
|
output.writeByte((byte) gamemode.getId());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2023. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ServerboundFinishConfigurationPacket extends PacketIn {
|
||||||
|
|
||||||
|
public ServerboundFinishConfigurationPacket() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerboundFinishConfigurationPacket(DataInputStream in) throws IOException {
|
||||||
|
this();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Limbo.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com>
|
||||||
|
* Copyright (C) 2023. Contributors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.loohp.limbo.network.protocol.packets;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ServerboundLoginAcknowledgedPacket extends PacketIn {
|
||||||
|
|
||||||
|
public ServerboundLoginAcknowledgedPacket() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerboundLoginAcknowledgedPacket(DataInputStream in) throws IOException {
|
||||||
|
this();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,9 @@ package com.loohp.limbo.player;
|
||||||
import com.loohp.limbo.Limbo;
|
import com.loohp.limbo.Limbo;
|
||||||
import com.loohp.limbo.entity.Entity;
|
import com.loohp.limbo.entity.Entity;
|
||||||
import com.loohp.limbo.location.Location;
|
import com.loohp.limbo.location.Location;
|
||||||
|
import com.loohp.limbo.network.ClientConnection;
|
||||||
|
import com.loohp.limbo.network.protocol.packets.ClientboundChunkBatchFinishedPacket;
|
||||||
|
import com.loohp.limbo.network.protocol.packets.ClientboundChunkBatchStartPacket;
|
||||||
import com.loohp.limbo.network.protocol.packets.ClientboundLevelChunkWithLightPacket;
|
import com.loohp.limbo.network.protocol.packets.ClientboundLevelChunkWithLightPacket;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityDestroy;
|
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityDestroy;
|
||||||
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityMetadata;
|
import com.loohp.limbo.network.protocol.packets.PacketPlayOutEntityMetadata;
|
||||||
|
|
@ -68,6 +71,10 @@ public class PlayerInteractManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() throws IOException {
|
public void update() throws IOException {
|
||||||
|
if (player.clientConnection.getClientState() != ClientConnection.ClientState.PLAY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int viewDistanceChunks = Limbo.getInstance().getServerProperties().getViewDistance();
|
int viewDistanceChunks = Limbo.getInstance().getServerProperties().getViewDistance();
|
||||||
int viewDistanceBlocks = viewDistanceChunks << 4;
|
int viewDistanceBlocks = viewDistanceChunks << 4;
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
|
|
@ -119,6 +126,9 @@ public class PlayerInteractManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
ClientboundChunkBatchStartPacket chunkBatchStartPacket = new ClientboundChunkBatchStartPacket();
|
||||||
|
player.clientConnection.sendPacket(chunkBatchStartPacket);
|
||||||
for (Entry<ChunkPosition, Chunk> entry : chunksInRange.entrySet()) {
|
for (Entry<ChunkPosition, Chunk> entry : chunksInRange.entrySet()) {
|
||||||
ChunkPosition chunkPos = entry.getKey();
|
ChunkPosition chunkPos = entry.getKey();
|
||||||
if (!currentViewing.containsKey(chunkPos)) {
|
if (!currentViewing.containsKey(chunkPos)) {
|
||||||
|
|
@ -126,7 +136,7 @@ public class PlayerInteractManager {
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), entry.getValue(), world.getEnvironment(), Collections.emptyList(), Collections.emptyList());
|
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), entry.getValue(), world.getEnvironment(), Collections.emptyList(), Collections.emptyList());
|
||||||
player.clientConnection.sendPacket(chunkdata);
|
player.clientConnection.sendPacket(chunkdata);
|
||||||
} else {
|
} else {
|
||||||
List<Byte[]> blockChunk = world.getLightEngineBlock().getBlockLightBitMask(chunkPos.getChunkX(), chunkPos.getChunkZ());
|
List<Byte[]> blockChunk = world.getLightEngineBlock().getBlockLightBitMask(chunkPos.getChunkX(), chunkPos.getChunkZ());
|
||||||
if (blockChunk == null) {
|
if (blockChunk == null) {
|
||||||
blockChunk = new ArrayList<>();
|
blockChunk = new ArrayList<>();
|
||||||
|
|
@ -140,9 +150,12 @@ public class PlayerInteractManager {
|
||||||
}
|
}
|
||||||
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), chunk, world.getEnvironment(), skyChunk, blockChunk);
|
ClientboundLevelChunkWithLightPacket chunkdata = new ClientboundLevelChunkWithLightPacket(chunkPos.getChunkX(), chunkPos.getChunkZ(), chunk, world.getEnvironment(), skyChunk, blockChunk);
|
||||||
player.clientConnection.sendPacket(chunkdata);
|
player.clientConnection.sendPacket(chunkdata);
|
||||||
}
|
}
|
||||||
}
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ClientboundChunkBatchFinishedPacket chunkBatchFinishedPacket = new ClientboundChunkBatchFinishedPacket(counter);
|
||||||
|
player.clientConnection.sendPacket(chunkBatchFinishedPacket);
|
||||||
|
|
||||||
currentViewing = chunksInRange;
|
currentViewing = chunksInRange;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import net.kyori.adventure.key.Key;
|
||||||
import net.querz.nbt.io.NBTInputStream;
|
import net.querz.nbt.io.NBTInputStream;
|
||||||
import net.querz.nbt.io.NBTOutputStream;
|
import net.querz.nbt.io.NBTOutputStream;
|
||||||
import net.querz.nbt.tag.CompoundTag;
|
import net.querz.nbt.tag.CompoundTag;
|
||||||
|
import net.querz.nbt.tag.EndTag;
|
||||||
import net.querz.nbt.tag.Tag;
|
import net.querz.nbt.tag.Tag;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
@ -51,7 +52,7 @@ public class DataTypeIO {
|
||||||
out.writeBoolean(true);
|
out.writeBoolean(true);
|
||||||
writeVarInt(out, Registry.ITEM_REGISTRY.getId(itemstack.type()));
|
writeVarInt(out, Registry.ITEM_REGISTRY.getId(itemstack.type()));
|
||||||
out.writeByte(itemstack.amount());
|
out.writeByte(itemstack.amount());
|
||||||
writeCompoundTag(out, itemstack.nbt());
|
writeTag(out, itemstack.nbt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ public class DataTypeIO {
|
||||||
} else {
|
} else {
|
||||||
Key key = Registry.ITEM_REGISTRY.fromId(readVarInt(in));
|
Key key = Registry.ITEM_REGISTRY.fromId(readVarInt(in));
|
||||||
byte amount = in.readByte();
|
byte amount = in.readByte();
|
||||||
CompoundTag nbt = readCompoundTag(in);
|
CompoundTag nbt = readTag(in, CompoundTag.class);
|
||||||
return new ItemStack(key, amount, nbt);
|
return new ItemStack(key, amount, nbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,22 +153,25 @@ public class DataTypeIO {
|
||||||
return new UUID(in.readLong(), in.readLong());
|
return new UUID(in.readLong(), in.readLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeCompoundTag(DataOutputStream out, CompoundTag tag) throws IOException {
|
public static void writeTag(DataOutputStream out, Tag<?> tag) throws IOException {
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
out.writeByte(0);
|
tag = EndTag.INSTANCE;
|
||||||
} else {
|
}
|
||||||
new NBTOutputStream(out).writeTag(tag, Tag.DEFAULT_MAX_DEPTH);
|
out.writeByte(tag.getID());
|
||||||
|
if (tag.getID() != 0) {
|
||||||
|
new NBTOutputStream(out).writeRawTag(tag, Tag.DEFAULT_MAX_DEPTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompoundTag readCompoundTag(DataInputStream in) throws IOException {
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends Tag<?>> T readTag(DataInputStream in, Class<T> type) throws IOException {
|
||||||
byte b = in.readByte();
|
byte b = in.readByte();
|
||||||
if (b == 0) {
|
if (b == 0) {
|
||||||
return null;
|
return type.isInstance(EndTag.INSTANCE) ? (T) EndTag.INSTANCE : null;
|
||||||
}
|
}
|
||||||
PushbackInputStream buffered = new PushbackInputStream(in);
|
PushbackInputStream buffered = new PushbackInputStream(in);
|
||||||
buffered.unread(b);
|
buffered.unread(b);
|
||||||
return (CompoundTag) new NBTInputStream(buffered).readTag(Tag.DEFAULT_MAX_DEPTH).getTag();
|
return (T) new NBTInputStream(buffered).readRawTag(Tag.DEFAULT_MAX_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String readString(DataInputStream in, Charset charset) throws IOException {
|
public static String readString(DataInputStream in, Charset charset) throws IOException {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -457,6 +457,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:coast"
|
"value": "minecraft:coast"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -489,6 +493,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:dune"
|
"value": "minecraft:dune"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -521,6 +529,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:eye"
|
"value": "minecraft:eye"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -553,6 +565,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:host"
|
"value": "minecraft:host"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -585,6 +601,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:raiser"
|
"value": "minecraft:raiser"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -617,6 +637,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:rib"
|
"value": "minecraft:rib"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -649,6 +673,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:sentry"
|
"value": "minecraft:sentry"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -681,6 +709,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:shaper"
|
"value": "minecraft:shaper"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -713,6 +745,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:silence"
|
"value": "minecraft:silence"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -745,6 +781,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:snout"
|
"value": "minecraft:snout"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -777,6 +817,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:spire"
|
"value": "minecraft:spire"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -809,6 +853,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:tide"
|
"value": "minecraft:tide"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -841,6 +889,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:vex"
|
"value": "minecraft:vex"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -873,6 +925,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:ward"
|
"value": "minecraft:ward"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -905,6 +961,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:wayfinder"
|
"value": "minecraft:wayfinder"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -937,6 +997,10 @@
|
||||||
"asset_id": {
|
"asset_id": {
|
||||||
"type": "StringTag",
|
"type": "StringTag",
|
||||||
"value": "minecraft:wild"
|
"value": "minecraft:wild"
|
||||||
|
},
|
||||||
|
"decal": {
|
||||||
|
"type": "ByteTag",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,69 +4,79 @@
|
||||||
},
|
},
|
||||||
"LoginIn": {
|
"LoginIn": {
|
||||||
"0x00": "PacketLoginInLoginStart",
|
"0x00": "PacketLoginInLoginStart",
|
||||||
"0x02": "PacketLoginInPluginMessaging"
|
"0x02": "PacketLoginInPluginMessaging",
|
||||||
|
"0x03": "ServerboundLoginAcknowledgedPacket"
|
||||||
},
|
},
|
||||||
"LoginOut": {
|
"LoginOut": {
|
||||||
"PacketLoginOutLoginSuccess": "0x02",
|
"PacketLoginOutLoginSuccess": "0x02",
|
||||||
"PacketLoginOutDisconnect": "0x00",
|
"PacketLoginOutDisconnect": "0x00",
|
||||||
"PacketLoginOutPluginMessaging": "0x04"
|
"PacketLoginOutPluginMessaging": "0x04"
|
||||||
},
|
},
|
||||||
|
"ConfigurationIn": {
|
||||||
|
"0x02": "ServerboundFinishConfigurationPacket"
|
||||||
|
},
|
||||||
|
"ConfigurationOut": {
|
||||||
|
"ClientboundRegistryDataPacket": "0x05",
|
||||||
|
"ClientboundFinishConfigurationPacket": "0x02"
|
||||||
|
},
|
||||||
"PlayIn": {
|
"PlayIn": {
|
||||||
"0x12": "PacketPlayInKeepAlive",
|
"0x14": "PacketPlayInKeepAlive",
|
||||||
"0x04": "ServerboundChatCommandPacket",
|
"0x04": "ServerboundChatCommandPacket",
|
||||||
"0x05": "PacketPlayInChat",
|
"0x05": "PacketPlayInChat",
|
||||||
"0x15": "PacketPlayInPositionAndLook",
|
"0x16": "PacketPlayInPosition",
|
||||||
"0x14": "PacketPlayInPosition",
|
"0x17": "PacketPlayInPositionAndLook",
|
||||||
"0x16": "PacketPlayInRotation",
|
"0x18": "PacketPlayInRotation",
|
||||||
"0x0D": "PacketPlayInPluginMessaging",
|
"0x0F": "PacketPlayInPluginMessaging",
|
||||||
"0x09": "PacketPlayInTabComplete",
|
"0x0A": "PacketPlayInTabComplete",
|
||||||
"0x28": "PacketPlayInHeldItemChange",
|
"0x2B": "PacketPlayInHeldItemChange",
|
||||||
"0x24": "PacketPlayInResourcePackStatus",
|
"0x27": "PacketPlayInResourcePackStatus",
|
||||||
"0x32": "PacketPlayInBlockPlace",
|
"0x34": "PacketPlayInUseItem",
|
||||||
"0x31": "PacketPlayInUseItem",
|
"0x35": "PacketPlayInBlockPlace",
|
||||||
"0x2B": "PacketPlayInSetCreativeSlot",
|
"0x2E": "PacketPlayInSetCreativeSlot",
|
||||||
"0x0B": "PacketPlayInWindowClick",
|
"0x0D": "PacketPlayInWindowClick",
|
||||||
"0x0C": "PacketPlayInCloseWindow",
|
"0x0E": "PacketPlayInCloseWindow",
|
||||||
"0x1A": "PacketPlayInPickItem",
|
"0x1C": "PacketPlayInPickItem",
|
||||||
"0x1D": "PacketPlayInBlockDig",
|
"0x20": "PacketPlayInBlockDig",
|
||||||
"0x23": "PacketPlayInItemName"
|
"0x26": "PacketPlayInItemName"
|
||||||
},
|
},
|
||||||
"PlayOut": {
|
"PlayOut": {
|
||||||
"PacketPlayOutLogin": "0x28",
|
"PacketPlayOutLogin": "0x29",
|
||||||
"PacketPlayOutPositionAndLook": "0x3C",
|
"PacketPlayOutPositionAndLook": "0x3E",
|
||||||
"PacketPlayOutSpawnPosition": "0x50",
|
"PacketPlayOutSpawnPosition": "0x52",
|
||||||
"ClientboundSystemChatPacket": "0x64",
|
"ClientboundSystemChatPacket": "0x67",
|
||||||
"PacketPlayOutPlayerAbilities": "0x34",
|
"PacketPlayOutPlayerAbilities": "0x36",
|
||||||
"ClientboundLevelChunkWithLightPacket": "0x24",
|
"ClientboundLevelChunkWithLightPacket": "0x25",
|
||||||
"PacketPlayOutUnloadChunk": "0x1E",
|
"PacketPlayOutUnloadChunk": "0x1F",
|
||||||
"PacketPlayOutKeepAlive": "0x23",
|
"PacketPlayOutKeepAlive": "0x24",
|
||||||
"PacketPlayOutPlayerInfo": "0x3A",
|
"PacketPlayOutPlayerInfo": "0x3C",
|
||||||
"PacketPlayOutUpdateViewPosition": "0x4E",
|
"PacketPlayOutUpdateViewPosition": "0x50",
|
||||||
"PacketPlayOutDisconnect": "0x1A",
|
"PacketPlayOutDisconnect": "0x1B",
|
||||||
"PacketPlayOutPluginMessaging": "0x17",
|
"PacketPlayOutPluginMessaging": "0x18",
|
||||||
"PacketPlayOutTabComplete": "0x0F",
|
"PacketPlayOutTabComplete": "0x10",
|
||||||
"PacketPlayOutDeclareCommands": "0x10",
|
"PacketPlayOutDeclareCommands": "0x11",
|
||||||
"PacketPlayOutRespawn": "0x41",
|
"PacketPlayOutRespawn": "0x43",
|
||||||
"PacketPlayOutGameState": "0x1F",
|
"PacketPlayOutGameState": "0x20",
|
||||||
"PacketPlayOutEntityDestroy": "0x3E",
|
"PacketPlayOutEntityDestroy": "0x40",
|
||||||
"PacketPlayOutEntityMetadata": "0x52",
|
"PacketPlayOutEntityMetadata": "0x54",
|
||||||
"PacketPlayOutSpawnEntity": "0x01",
|
"PacketPlayOutSpawnEntity": "0x01",
|
||||||
"PacketPlayOutHeldItemChange": "0x4D",
|
"PacketPlayOutHeldItemChange": "0x4F",
|
||||||
"PacketPlayOutPlayerListHeaderFooter": "0x65",
|
"PacketPlayOutPlayerListHeaderFooter": "0x68",
|
||||||
"PacketPlayOutResourcePackSend": "0x40",
|
"PacketPlayOutResourcePackSend": "0x42",
|
||||||
"ClientboundSetTitlesAnimationPacket": "0x60",
|
"ClientboundSetTitlesAnimationPacket": "0x62",
|
||||||
"ClientboundSetTitleTextPacket": "0x5F",
|
"ClientboundSetTitleTextPacket": "0x61",
|
||||||
"ClientboundSetSubtitleTextPacket": "0x5D",
|
"ClientboundSetSubtitleTextPacket": "0x5F",
|
||||||
"ClientboundSetActionBarTextPacket": "0x46",
|
"ClientboundSetActionBarTextPacket": "0x48",
|
||||||
"ClientboundClearTitlesPacket": "0x0E",
|
"ClientboundClearTitlesPacket": "0x0F",
|
||||||
"PacketPlayOutBoss": "0x0B",
|
"PacketPlayOutBoss": "0x0A",
|
||||||
"PacketPlayOutNamedSoundEffect": "0x62",
|
"PacketPlayOutNamedSoundEffect": "0x64",
|
||||||
"PacketPlayOutStopSound": "0x63",
|
"PacketPlayOutStopSound": "0x66",
|
||||||
"PacketPlayOutWindowItems": "0x12",
|
"PacketPlayOutWindowItems": "0x13",
|
||||||
"PacketPlayOutSetSlot": "0x14",
|
"PacketPlayOutSetSlot": "0x15",
|
||||||
"PacketPlayOutOpenWindow": "0x30",
|
"PacketPlayOutOpenWindow": "0x31",
|
||||||
"PacketPlayOutCloseWindow": "0x11",
|
"PacketPlayOutCloseWindow": "0x12",
|
||||||
"PacketPlayOutWindowData": "0x13"
|
"PacketPlayOutWindowData": "0x14",
|
||||||
|
"ClientboundChunkBatchFinishedPacket": "0x0C",
|
||||||
|
"ClientboundChunkBatchStartPacket": "0x0D"
|
||||||
},
|
},
|
||||||
"StatusIn": {
|
"StatusIn": {
|
||||||
"0x01": "PacketStatusInPing",
|
"0x01": "PacketStatusInPing",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue