3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Rename outgoing->clientbound, incoming->serverbound

Via can both be used on servers and clients, making a direction like "incoming" ambiguous
Dieser Commit ist enthalten in:
KennyTV 2021-04-28 12:59:37 +02:00
Ursprung a2b3906c9e
Commit cad358322d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
85 geänderte Dateien mit 529 neuen und 496 gelöschten Zeilen

Datei anzeigen

@ -118,6 +118,9 @@ public interface ViaAPI<T> {
/**
* Returns legacy api only applicable on/to legacy versions.
* <p>
* These methods are safe to use and are unlikely to be removed,
* but it is important to be aware of their limited use.
*
* @return legacy api only applicable on/to legacy versions
*/

Datei anzeigen

@ -47,7 +47,9 @@ public interface ConnectionManager {
*
* @return true if the user is a frontend connection
*/
boolean isFrontEnd(UserConnection connection);
default boolean isFrontEnd(UserConnection connection) {
return !connection.isClientSide();
}
/**
* Returns the frontend UserConnection from the player connected to this proxy server

Datei anzeigen

@ -121,42 +121,55 @@ public interface UserConnection {
void sendRawPacketToServer(ByteBuf packet);
/**
* Monitors incoming packets
* Monitors serverbound packets and returns whether a packet can/should be processed.
*
* @return false if this packet should be cancelled
*/
boolean checkIncomingPacket();
boolean checkServerboundPacket();
/**
* Monitors outgoing packets
* Monitors clientbound packets and returns whether a packet can/should be processed.
*
* @return false if this packet should be cancelled
*/
boolean checkOutgoingPacket();
boolean checkClientboundPacket();
/**
* @see #checkClientboundPacket()
* @see #checkServerboundPacket()
*/
default boolean checkIncomingPacket() {
return isClientSide() ? checkClientboundPacket() : checkServerboundPacket();
}
/**
* @see #checkClientboundPacket()
* @see #checkServerboundPacket()
*/
default boolean checkOutgoingPacket() {
return isClientSide() ? checkServerboundPacket() : checkClientboundPacket();
}
/**
* Checks if packets needs transforming.
*
* @return if packets should be passed through
* @return whether packets should be passed through
*/
boolean shouldTransformPacket();
/**
* Transforms the outgoing packet contained in ByteBuf. When clientSide is true, this packet is considered
* serverbound.
* Transforms the clientbound packet contained in ByteBuf.
*
* @param buf ByteBuf with packet id and packet contents
* @param cancelSupplier Function called with original CancelException for generating the Exception used when
* packet is cancelled
* @param cancelSupplier function called with original CancelException for generating the Exception when the packet is cancelled
* @throws CancelException if the packet should be cancelled
* @throws InformativeException if packet transforming failed
* @throws Exception if any other processing outside of transforming fails
*/
void transformOutgoing(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception;
void transformClientbound(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception;
/**
* Transforms the incoming packet contained in ByteBuf. When clientSide is true, this packet is considered
* clientbound
* Transforms the serverbound packet contained in ByteBuf.
*
* @param buf ByteBuf with packet id and packet contents
* @param cancelSupplier Function called with original CancelException for generating the Exception used when
@ -165,7 +178,35 @@ public interface UserConnection {
* @throws InformativeException if packet transforming failed
* @throws Exception if any other processing outside of transforming fails
*/
void transformIncoming(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception;
void transformServerbound(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception;
/**
* Transforms the packet depending on whether the connection is clientside or not.
*
* @see #transformClientbound(ByteBuf, Function)
* @see #transformServerbound(ByteBuf, Function)
*/
default void transformOutgoing(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
if (isClientSide()) {
transformServerbound(buf, cancelSupplier);
} else {
transformClientbound(buf, cancelSupplier);
}
}
/**
* Transforms the packet depending on whether the connection is clientside or not.
*
* @see #transformClientbound(ByteBuf, Function)
* @see #transformServerbound(ByteBuf, Function)
*/
default void transformIncoming(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
if (isClientSide()) {
transformClientbound(buf, cancelSupplier);
} else {
transformServerbound(buf, cancelSupplier);
}
}
/**
* Returns the internal id incremented for each new connection.

Datei anzeigen

@ -37,6 +37,7 @@ public interface MappingData {
*
* @param id unmapped block state id
* @return mapped block state id, or -1 if unmapped
* @throws NullPointerException if this mappingdata does not hold block state mappings
*/
int getNewBlockStateId(int id);
@ -45,6 +46,7 @@ public interface MappingData {
*
* @param id unmapped block id
* @return mapped block id, or -1 if unmapped
* @throws NullPointerException if this mappingdata does not hold block mappings
*/
int getNewBlockId(int id);
@ -53,6 +55,7 @@ public interface MappingData {
*
* @param id unmapped item id
* @return mapped item id, or -1 if unmapped
* @throws NullPointerException if this mappingdata does not hold item mappings
*/
int getNewItemId(int id);
@ -61,6 +64,7 @@ public interface MappingData {
*
* @param id mapped item id
* @return backwards mapped item id, or -1 if unmapped
* @throws NullPointerException if this mappingdata does not hold item mappings
*/
int getOldItemId(int id);
@ -69,6 +73,7 @@ public interface MappingData {
*
* @param id unmapped particle id
* @return mapped particle id, or -1 if unmapped
* @throws NullPointerException if this mappingdata does not hold particle mappings
*/
int getNewParticleId(int id);

Datei anzeigen

@ -42,8 +42,8 @@ import java.util.logging.Level;
public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 extends ClientboundPacketType, S1 extends ServerboundPacketType, S2 extends ServerboundPacketType>
implements Protocol<C1, C2, S1, S2> {
private final Map<Packet, ProtocolPacket> incoming = new HashMap<>();
private final Map<Packet, ProtocolPacket> outgoing = new HashMap<>();
private final Map<Packet, ProtocolPacket> serverbound = new HashMap<>();
private final Map<Packet, ProtocolPacket> clientbound = new HashMap<>();
private final Map<Class, Object> storedObjects = new HashMap<>(); // currently only used for MetadataRewriters
protected final Class<C1> oldClientboundPacketEnum;
protected final Class<C2> newClientboundPacketEnum;
@ -68,15 +68,15 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
// Register the rest of the ids with no handlers if necessary
if (oldClientboundPacketEnum != null && clientboundPacketEnum != null
&& oldClientboundPacketEnum != clientboundPacketEnum) {
registerOutgoingChannelIdChanges();
registerClientboundChannelIdChanges();
}
if (oldServerboundPacketEnum != null && serverboundPacketEnum != null
&& oldServerboundPacketEnum != serverboundPacketEnum) {
registerIncomingChannelIdChanges();
registerServerboundChannelIdChanges();
}
}
protected void registerOutgoingChannelIdChanges() {
protected void registerClientboundChannelIdChanges() {
ClientboundPacketType[] newConstants = newClientboundPacketEnum.getEnumConstants();
Map<String, ClientboundPacketType> newClientboundPackets = new HashMap<>(newConstants.length);
for (ClientboundPacketType newConstant : newConstants) {
@ -88,19 +88,19 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
int oldId = packet.ordinal();
if (mappedPacket == null) {
// Packet doesn't exist on new client
Preconditions.checkArgument(hasRegisteredOutgoing(State.PLAY, oldId),
Preconditions.checkArgument(hasRegisteredClientbound(State.PLAY, oldId),
"Packet " + packet + " in " + getClass().getSimpleName() + " has no mapping - it needs to be manually cancelled or remapped!");
continue;
}
int newId = mappedPacket.ordinal();
if (!hasRegisteredOutgoing(State.PLAY, oldId)) {
registerOutgoing(State.PLAY, oldId, newId);
if (!hasRegisteredClientbound(State.PLAY, oldId)) {
registerClientbound(State.PLAY, oldId, newId);
}
}
}
protected void registerIncomingChannelIdChanges() {
protected void registerServerboundChannelIdChanges() {
ServerboundPacketType[] oldConstants = oldServerboundPacketEnum.getEnumConstants();
Map<String, ServerboundPacketType> oldServerboundConstants = new HashMap<>(oldConstants.length);
for (ServerboundPacketType oldConstant : oldConstants) {
@ -112,14 +112,14 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
int newId = packet.ordinal();
if (mappedPacket == null) {
// Packet doesn't exist on old server
Preconditions.checkArgument(hasRegisteredIncoming(State.PLAY, newId),
Preconditions.checkArgument(hasRegisteredServerbound(State.PLAY, newId),
"Packet " + packet + " in " + getClass().getSimpleName() + " has no mapping - it needs to be manually cancelled or remapped!");
continue;
}
int oldId = mappedPacket.ordinal();
if (!hasRegisteredIncoming(State.PLAY, newId)) {
registerIncoming(State.PLAY, oldId, newId);
if (!hasRegisteredServerbound(State.PLAY, newId)) {
registerServerbound(State.PLAY, oldId, newId);
}
}
}
@ -145,19 +145,19 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
}
@Override
public void registerIncoming(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
public void registerServerbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
ProtocolPacket protocolPacket = new ProtocolPacket(state, oldPacketID, newPacketID, packetRemapper);
Packet packet = new Packet(state, newPacketID);
if (!override && incoming.containsKey(packet)) {
if (!override && serverbound.containsKey(packet)) {
Via.getPlatform().getLogger().log(Level.WARNING, packet + " already registered!" +
" If this override is intentional, set override to true. Stacktrace: ", new Exception());
}
incoming.put(packet, protocolPacket);
serverbound.put(packet, protocolPacket);
}
@Override
public void cancelIncoming(State state, int oldPacketID, int newPacketID) {
registerIncoming(state, oldPacketID, newPacketID, new PacketRemapper() {
public void cancelServerbound(State state, int oldPacketID, int newPacketID) {
registerServerbound(state, oldPacketID, newPacketID, new PacketRemapper() {
@Override
public void registerMap() {
handler(PacketWrapper::cancel);
@ -166,8 +166,8 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
}
@Override
public void cancelOutgoing(State state, int oldPacketID, int newPacketID) {
registerOutgoing(state, oldPacketID, newPacketID, new PacketRemapper() {
public void cancelClientbound(State state, int oldPacketID, int newPacketID) {
registerClientbound(state, oldPacketID, newPacketID, new PacketRemapper() {
@Override
public void registerMap() {
handler(PacketWrapper::cancel);
@ -176,19 +176,19 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
}
@Override
public void registerOutgoing(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
public void registerClientbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
ProtocolPacket protocolPacket = new ProtocolPacket(state, oldPacketID, newPacketID, packetRemapper);
Packet packet = new Packet(state, oldPacketID);
if (!override && outgoing.containsKey(packet)) {
if (!override && clientbound.containsKey(packet)) {
Via.getPlatform().getLogger().log(Level.WARNING, packet + " already registered!" +
" If override is intentional, set override to true. Stacktrace: ", new Exception());
}
outgoing.put(packet, protocolPacket);
clientbound.put(packet, protocolPacket);
}
@Override
public void registerOutgoing(C1 packetType, @Nullable PacketRemapper packetRemapper) {
public void registerClientbound(C1 packetType, @Nullable PacketRemapper packetRemapper) {
checkPacketType(packetType, packetType.getClass() == oldClientboundPacketEnum);
ClientboundPacketType mappedPacket = oldClientboundPacketEnum == newClientboundPacketEnum ? packetType
@ -197,24 +197,24 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
int oldId = packetType.ordinal();
int newId = mappedPacket.ordinal();
registerOutgoing(State.PLAY, oldId, newId, packetRemapper);
registerClientbound(State.PLAY, oldId, newId, packetRemapper);
}
@Override
public void registerOutgoing(C1 packetType, @Nullable C2 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
public void registerClientbound(C1 packetType, @Nullable C2 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
checkPacketType(packetType, packetType.getClass() == oldClientboundPacketEnum);
checkPacketType(mappedPacketType, mappedPacketType == null || mappedPacketType.getClass() == newClientboundPacketEnum);
registerOutgoing(State.PLAY, packetType.ordinal(), mappedPacketType != null ? mappedPacketType.ordinal() : -1, packetRemapper);
registerClientbound(State.PLAY, packetType.ordinal(), mappedPacketType != null ? mappedPacketType.ordinal() : -1, packetRemapper);
}
@Override
public void cancelOutgoing(C1 packetType) {
cancelOutgoing(State.PLAY, packetType.ordinal(), packetType.ordinal());
public void cancelClientbound(C1 packetType) {
cancelClientbound(State.PLAY, packetType.ordinal(), packetType.ordinal());
}
@Override
public void registerIncoming(S2 packetType, @Nullable PacketRemapper packetRemapper) {
public void registerServerbound(S2 packetType, @Nullable PacketRemapper packetRemapper) {
checkPacketType(packetType, packetType.getClass() == newServerboundPacketEnum);
ServerboundPacketType mappedPacket = oldServerboundPacketEnum == newServerboundPacketEnum ? packetType
@ -223,40 +223,40 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
int oldId = mappedPacket.ordinal();
int newId = packetType.ordinal();
registerIncoming(State.PLAY, oldId, newId, packetRemapper);
registerServerbound(State.PLAY, oldId, newId, packetRemapper);
}
@Override
public void registerIncoming(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
public void registerServerbound(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper) {
checkPacketType(packetType, packetType.getClass() == newServerboundPacketEnum);
checkPacketType(mappedPacketType, mappedPacketType == null || mappedPacketType.getClass() == oldServerboundPacketEnum);
registerIncoming(State.PLAY, mappedPacketType != null ? mappedPacketType.ordinal() : -1, packetType.ordinal(), packetRemapper);
registerServerbound(State.PLAY, mappedPacketType != null ? mappedPacketType.ordinal() : -1, packetType.ordinal(), packetRemapper);
}
@Override
public void cancelIncoming(S2 packetType) {
public void cancelServerbound(S2 packetType) {
Preconditions.checkArgument(packetType.getClass() == newServerboundPacketEnum);
cancelIncoming(State.PLAY, -1, packetType.ordinal());
cancelServerbound(State.PLAY, -1, packetType.ordinal());
}
@Override
public boolean hasRegisteredOutgoing(State state, int oldPacketID) {
public boolean hasRegisteredClientbound(State state, int oldPacketID) {
Packet packet = new Packet(state, oldPacketID);
return outgoing.containsKey(packet);
return clientbound.containsKey(packet);
}
@Override
public boolean hasRegisteredIncoming(State state, int newPacketId) {
public boolean hasRegisteredServerbound(State state, int newPacketId) {
Packet packet = new Packet(state, newPacketId);
return incoming.containsKey(packet);
return serverbound.containsKey(packet);
}
@Override
public void transform(Direction direction, State state, PacketWrapper packetWrapper) throws Exception {
Packet statePacket = new Packet(state, packetWrapper.getId());
Map<Packet, ProtocolPacket> packetMap = (direction == Direction.OUTGOING ? outgoing : incoming);
Map<Packet, ProtocolPacket> packetMap = (direction == Direction.CLIENTBOUND ? clientbound : serverbound);
ProtocolPacket protocolPacket = packetMap.get(statePacket);
if (protocolPacket == null) {
return;
@ -264,7 +264,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
// Write packet id
int oldId = packetWrapper.getId();
int newId = direction == Direction.OUTGOING ? protocolPacket.getNewID() : protocolPacket.getOldID();
int newId = direction == Direction.CLIENTBOUND ? protocolPacket.getNewID() : protocolPacket.getOldID();
packetWrapper.setId(newId);
PacketRemapper remapper = protocolPacket.getRemapper();
@ -288,7 +288,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
throw e;
}
Class<? extends PacketType> packetTypeClass = state == State.PLAY ? (direction == Direction.OUTGOING ? oldClientboundPacketEnum : newServerboundPacketEnum) : null;
Class<? extends PacketType> packetTypeClass = state == State.PLAY ? (direction == Direction.CLIENTBOUND ? oldClientboundPacketEnum : newServerboundPacketEnum) : null;
if (packetTypeClass != null) {
PacketType[] enumConstants = packetTypeClass.getEnumConstants();
PacketType packetType = oldId < enumConstants.length && oldId >= 0 ? enumConstants[oldId] : null;

Datei anzeigen

@ -46,83 +46,83 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public interface Protocol<C1 extends ClientboundPacketType, C2 extends ClientboundPacketType, S1 extends ServerboundPacketType, S2 extends ServerboundPacketType> {
/**
* Register an incoming packet, with simple id transformation.
* Register a serverbound packet, with simple id transformation.
*
* @param state The state which the packet is sent in.
* @param oldPacketID The old packet ID
* @param newPacketID The new packet ID
*/
default void registerIncoming(State state, int oldPacketID, int newPacketID) {
registerIncoming(state, oldPacketID, newPacketID, null);
default void registerServerbound(State state, int oldPacketID, int newPacketID) {
registerServerbound(state, oldPacketID, newPacketID, null);
}
/**
* Register an incoming packet, with id transformation and remapper.
* Register a serverbound packet, with id transformation and remapper.
*
* @param state The state which the packet is sent in.
* @param oldPacketID The old packet ID
* @param newPacketID The new packet ID
* @param packetRemapper The remapper to use for the packet
*/
default void registerIncoming(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
registerIncoming(state, oldPacketID, newPacketID, packetRemapper, false);
default void registerServerbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
registerServerbound(state, oldPacketID, newPacketID, packetRemapper, false);
}
void registerIncoming(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override);
void registerServerbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override);
void cancelIncoming(State state, int oldPacketID, int newPacketID);
void cancelServerbound(State state, int oldPacketID, int newPacketID);
default void cancelIncoming(State state, int newPacketID) {
cancelIncoming(state, -1, newPacketID);
default void cancelServerbound(State state, int newPacketID) {
cancelServerbound(state, -1, newPacketID);
}
/**
* Register an outgoing packet, with simple id transformation.
* Register a clientbound packet, with simple id transformation.
*
* @param state The state which the packet is sent in.
* @param oldPacketID The old packet ID
* @param newPacketID The new packet ID
*/
default void registerOutgoing(State state, int oldPacketID, int newPacketID) {
registerOutgoing(state, oldPacketID, newPacketID, null);
default void registerClientbound(State state, int oldPacketID, int newPacketID) {
registerClientbound(state, oldPacketID, newPacketID, null);
}
/**
* Register an outgoing packet, with id transformation and remapper.
* Register a clientbound packet, with id transformation and remapper.
*
* @param state The state which the packet is sent in.
* @param oldPacketID The old packet ID
* @param newPacketID The new packet ID
* @param packetRemapper The remapper to use for the packet
*/
default void registerOutgoing(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
registerOutgoing(state, oldPacketID, newPacketID, packetRemapper, false);
default void registerClientbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
registerClientbound(state, oldPacketID, newPacketID, packetRemapper, false);
}
void cancelOutgoing(State state, int oldPacketID, int newPacketID);
void cancelClientbound(State state, int oldPacketID, int newPacketID);
default void cancelOutgoing(State state, int oldPacketID) {
cancelOutgoing(state, oldPacketID, -1);
default void cancelClientbound(State state, int oldPacketID) {
cancelClientbound(state, oldPacketID, -1);
}
void registerOutgoing(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override);
void registerClientbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override);
/**
* Registers an outgoing protocol and automatically maps it to the new id.
* Registers a clientbound protocol and automatically maps it to the new id.
*
* @param packetType clientbound packet type the server sends
* @param packetRemapper remapper
*/
void registerOutgoing(C1 packetType, @Nullable PacketRemapper packetRemapper);
void registerClientbound(C1 packetType, @Nullable PacketRemapper packetRemapper);
/**
* Registers an outgoing protocol.
* Registers a clientbound protocol.
*
* @param packetType clientbound packet type the server initially sends
* @param mappedPacketType clientbound packet type after transforming for the client
* @param packetRemapper remapper
*/
void registerOutgoing(C1 packetType, C2 mappedPacketType, @Nullable PacketRemapper packetRemapper);
void registerClientbound(C1 packetType, C2 mappedPacketType, @Nullable PacketRemapper packetRemapper);
/**
* Maps a packet type to another packet type without a packet handler.
@ -131,8 +131,8 @@ public interface Protocol<C1 extends ClientboundPacketType, C2 extends Clientbou
* @param packetType clientbound packet type the server initially sends
* @param mappedPacketType clientbound packet type after transforming for the client
*/
default void registerOutgoing(C1 packetType, @Nullable C2 mappedPacketType) {
registerOutgoing(packetType, mappedPacketType, null);
default void registerClientbound(C1 packetType, @Nullable C2 mappedPacketType) {
registerClientbound(packetType, mappedPacketType, null);
}
/**
@ -140,49 +140,49 @@ public interface Protocol<C1 extends ClientboundPacketType, C2 extends Clientbou
*
* @param packetType clientbound packet type to cancel
*/
void cancelOutgoing(C1 packetType);
void cancelClientbound(C1 packetType);
/**
* Registers an incoming protocol and automatically maps it to the server's id.
* Registers a serverbound protocol and automatically maps it to the server's id.
*
* @param packetType serverbound packet type the client sends
* @param packetRemapper remapper
*/
void registerIncoming(S2 packetType, @Nullable PacketRemapper packetRemapper);
void registerServerbound(S2 packetType, @Nullable PacketRemapper packetRemapper);
/**
* Registers an incoming protocol.
* Registers a serverbound protocol.
*
* @param packetType serverbound packet type initially sent by the client
* @param mappedPacketType serverbound packet type after transforming for the server
* @param packetRemapper remapper
*/
void registerIncoming(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper);
void registerServerbound(S2 packetType, @Nullable S1 mappedPacketType, @Nullable PacketRemapper packetRemapper);
/**
* Cancels any serverbound packets from the given type.
*
* @param packetType serverbound packet type to cancel
*/
void cancelIncoming(S2 packetType);
void cancelServerbound(S2 packetType);
/**
* Checks if an outgoing packet has already been registered.
* Checks if a clientbound packet has already been registered.
*
* @param state state which the packet is sent in
* @param oldPacketID old packet ID
* @return true if already registered
*/
boolean hasRegisteredOutgoing(State state, int oldPacketID);
boolean hasRegisteredClientbound(State state, int oldPacketID);
/**
* Checks if an incoming packet has already been registered.
* Checks if a serverbound packet has already been registered.
*
* @param state state which the packet is sent in
* @param newPacketId packet ID
* @return true if already registered
*/
boolean hasRegisteredIncoming(State state, int newPacketId);
boolean hasRegisteredServerbound(State state, int newPacketId);
/**
* Transform a packet using this protocol

Datei anzeigen

@ -54,7 +54,7 @@ public interface ProtocolManager {
@Nullable <T extends Protocol> T getProtocol(Class<T> protocolClass);
/**
* Returns the base protocol handling incoming handshake packets.
* Returns the base protocol handling serverbound handshake packets.
*
* @return base protocol
*/
@ -66,6 +66,7 @@ public interface ProtocolManager {
*
* @param serverVersion server protocol version
* @return base protocol for the given server protocol version
* @throws IllegalStateException if no base protocol could be found
*/
Protocol getBaseProtocol(int serverVersion);
@ -76,7 +77,9 @@ public interface ProtocolManager {
* @return whether the protocol is a base protocol
* @see Protocol#isBaseProtocol()
*/
boolean isBaseProtocol(Protocol protocol);
default boolean isBaseProtocol(Protocol protocol) {
return protocol.isBaseProtocol();
}
/**
* Register a protocol.
@ -107,11 +110,12 @@ public interface ProtocolManager {
void registerBaseProtocol(Protocol baseProtocol, Range<Integer> supportedProtocols);
/**
* Calculates a path from a client version to server version.
* Calculates and returns the protocol path from a client version to server version.
* Returns null if no path could be found or the path length exceeds the value given by {@link #getMaxProtocolPathSize()}.
*
* @param clientVersion input client version
* @param serverVersion desired output server version
* @return path it generated, null if not supported
* @return path generated, or null if not supported or the length exceeds {@link #getMaxProtocolPathSize()}
*/
@Nullable List<ProtocolPathEntry> getProtocolPath(int clientVersion, int serverVersion);

Datei anzeigen

@ -25,6 +25,7 @@ package com.viaversion.viaversion.api.protocol;
import com.viaversion.viaversion.api.connection.UserConnection;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.List;
public interface ProtocolPipeline extends SimpleProtocol {
@ -38,12 +39,14 @@ public interface ProtocolPipeline extends SimpleProtocol {
void add(Protocol protocol);
/**
* Adds a list of protocols to the current pipeline.
* Adds a collection of protocols to the current pipeline.
* This will call the {@link Protocol#init(UserConnection)} method.
* <p>
* Callers of this method should make sure the collection is correctly sorted.
*
* @param protocols protocols to add to the end
* @param protocols correctly sorted protocols to add to the end
*/
void add(List<Protocol> protocols);
void add(Collection<Protocol> protocols);
/**
* Returns whether the protocol is in this pipeline.

Datei anzeigen

@ -27,9 +27,9 @@ public enum Direction {
/**
* Clientbound packets sent by the server.
*/
OUTGOING,
CLIENTBOUND,
/**
* Serverbound packets sent by the client.
*/
INCOMING
SERVERBOUND
}

Datei anzeigen

@ -43,7 +43,7 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> list) throws Exception {
if (!info.checkIncomingPacket()) {
if (!info.checkServerboundPacket()) {
bytebuf.clear(); // Don't accumulate
throw CancelDecoderException.generate(null);
}
@ -52,7 +52,7 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
try {
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
info.transformServerbound(transformedBuf, CancelDecoderException::generate);
}
try {

Datei anzeigen

@ -80,9 +80,9 @@ public class BukkitEncodeHandler extends MessageToByteEncoder implements ViaCode
@Override
public void transform(ByteBuf bytebuf) throws Exception {
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
if (!info.checkClientboundPacket()) throw CancelEncoderException.generate(null);
if (!info.shouldTransformPacket()) return;
info.transformOutgoing(bytebuf, CancelEncoderException::generate);
info.transformClientbound(bytebuf, CancelEncoderException::generate);
}
@Override

Datei anzeigen

@ -41,7 +41,7 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
throw CancelDecoderException.generate(null);
}
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null);
if (!info.checkServerboundPacket()) throw CancelDecoderException.generate(null);
if (!info.shouldTransformPacket()) {
out.add(bytebuf.retain());
return;
@ -49,7 +49,7 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
ByteBuf transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
try {
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
info.transformServerbound(transformedBuf, CancelDecoderException::generate);
out.add(transformedBuf.retain());
} finally {
transformedBuf.release();

Datei anzeigen

@ -43,7 +43,7 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
throw CancelEncoderException.generate(null);
}
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
if (!info.checkClientboundPacket()) throw CancelEncoderException.generate(null);
if (!info.shouldTransformPacket()) {
out.add(bytebuf.retain());
return;
@ -52,7 +52,7 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
ByteBuf transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
try {
boolean needsCompress = handleCompressionOrder(ctx, transformedBuf);
info.transformOutgoing(transformedBuf, CancelEncoderException::generate);
info.transformClientbound(transformedBuf, CancelEncoderException::generate);
if (needsCompress) {
recompress(ctx, transformedBuf);

Datei anzeigen

@ -67,11 +67,6 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
@Override
public boolean isFrontEnd(UserConnection connection) {
return !connection.isClientSide();
}
@Override
public Map<UUID, UserConnection> getConnectedClients() {
return Collections.unmodifiableMap(clients);

Datei anzeigen

@ -231,20 +231,7 @@ public class UserConnectionImpl implements UserConnection {
}
@Override
public boolean checkIncomingPacket() {
if (clientSide) {
return checkClientbound();
} else {
return checkServerbound();
}
}
private boolean checkClientbound() {
packetTracker.incrementSent();
return true;
}
private boolean checkServerbound() {
public boolean checkServerboundPacket() {
// Ignore if pending disconnect
if (pendingDisconnect) return false;
// Increment received + Check PPS
@ -252,12 +239,9 @@ public class UserConnectionImpl implements UserConnection {
}
@Override
public boolean checkOutgoingPacket() {
if (clientSide) {
return checkServerbound();
} else {
return checkClientbound();
}
public boolean checkClientboundPacket() {
packetTracker.incrementSent();
return true;
}
@Override
@ -266,18 +250,18 @@ public class UserConnectionImpl implements UserConnection {
}
@Override
public void transformOutgoing(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
if (!buf.isReadable()) return;
transform(buf, clientSide ? Direction.INCOMING : Direction.OUTGOING, cancelSupplier);
public void transformClientbound(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
transform(buf, Direction.CLIENTBOUND, cancelSupplier);
}
@Override
public void transformIncoming(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
if (!buf.isReadable()) return;
transform(buf, clientSide ? Direction.OUTGOING : Direction.INCOMING, cancelSupplier);
public void transformServerbound(ByteBuf buf, Function<Throwable, Exception> cancelSupplier) throws Exception {
transform(buf, Direction.SERVERBOUND, cancelSupplier);
}
private void transform(ByteBuf buf, Direction direction, Function<Throwable, Exception> cancelSupplier) throws Exception {
if (!buf.isReadable()) return;
int id = Type.VAR_INT.readPrimitive(buf);
if (id == PacketWrapper.PASSTHROUGH_ID) {
if (!passthroughTokens.remove(Type.UUID.read(buf))) {

Datei anzeigen

@ -24,10 +24,10 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.protocol.ProtocolManager;
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
import com.viaversion.viaversion.api.protocol.ProtocolPathKey;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion;
@ -307,11 +307,6 @@ public class ProtocolManagerImpl implements ProtocolManager {
throw new IllegalStateException("No Base Protocol for " + serverVersion);
}
@Override
public boolean isBaseProtocol(Protocol protocol) {
return protocol.isBaseProtocol();
}
@Override
public ServerProtocolVersion getServerProtocolVersion() {
return serverProtocolVersion;

Datei anzeigen

@ -27,14 +27,15 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
import com.viaversion.viaversion.api.protocol.ProtocolPipeline;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.protocol.ProtocolPipeline;
import com.viaversion.viaversion.api.protocol.packet.Direction;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@ -83,7 +84,7 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot
}
@Override
public void add(List<Protocol> protocols) {
public void add(Collection<Protocol> protocols) {
protocolList.addAll(protocols);
for (Protocol protocol : protocols) {
protocol.init(userConnection);
@ -117,7 +118,7 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot
int originalID = packetWrapper.getId();
// Apply protocols
packetWrapper.apply(direction, state, 0, protocolList, direction == Direction.OUTGOING);
packetWrapper.apply(direction, state, 0, protocolList, direction == Direction.CLIENTBOUND);
super.transform(direction, state, packetWrapper);
if (Via.getManager().isDebug()) {

Datei anzeigen

@ -248,7 +248,7 @@ public class PacketWrapperImpl implements PacketWrapper {
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
if (!isCancelled()) {
try {
ByteBuf output = constructPacket(packetProtocol, skipCurrentPipeline, Direction.OUTGOING);
ByteBuf output = constructPacket(packetProtocol, skipCurrentPipeline, Direction.CLIENTBOUND);
user().sendRawPacket(output, currentThread);
} catch (Exception e) {
if (!PipelineUtil.containsCause(e, CancelException.class)) {
@ -269,7 +269,7 @@ public class PacketWrapperImpl implements PacketWrapper {
private ByteBuf constructPacket(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, Direction direction) throws Exception {
// Apply current pipeline - for outgoing protocol, the collection will be reversed in the apply method
Protocol[] protocols = user().getProtocolInfo().getPipeline().pipes().toArray(PROTOCOL_ARRAY);
boolean reverse = direction == Direction.OUTGOING;
boolean reverse = direction == Direction.CLIENTBOUND;
int index = -1;
for (int i = 0; i < protocols.length; i++) {
if (protocols[i].getClass() == packetProtocol) {
@ -304,7 +304,7 @@ public class PacketWrapperImpl implements PacketWrapper {
@Override
public ChannelFuture sendFuture(Class<? extends Protocol> packetProtocol) throws Exception {
if (!isCancelled()) {
ByteBuf output = constructPacket(packetProtocol, true, Direction.OUTGOING);
ByteBuf output = constructPacket(packetProtocol, true, Direction.CLIENTBOUND);
return user().sendRawPacketFuture(output);
}
return user().getChannel().newFailedFuture(new Exception("Cancelled packet"));
@ -412,7 +412,7 @@ public class PacketWrapperImpl implements PacketWrapper {
public void sendToServer(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception {
if (!isCancelled()) {
try {
ByteBuf output = constructPacket(packetProtocol, skipCurrentPipeline, Direction.INCOMING);
ByteBuf output = constructPacket(packetProtocol, skipCurrentPipeline, Direction.SERVERBOUND);
user().sendRawPacketToServer(output, currentThread);
} catch (Exception e) {
if (!PipelineUtil.containsCause(e, CancelException.class)) {

Datei anzeigen

@ -43,7 +43,7 @@ public class BaseProtocol extends AbstractSimpleProtocol {
/* Incoming Packets */
// Handshake Packet
registerIncoming(State.HANDSHAKE, 0x00, 0x00, new PacketRemapper() {
registerServerbound(State.HANDSHAKE, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -121,7 +121,7 @@ public class BaseProtocol extends AbstractSimpleProtocol {
@Override
public void transform(Direction direction, State state, PacketWrapper packetWrapper) throws Exception {
super.transform(direction, state, packetWrapper);
if (direction == Direction.INCOMING && state == State.HANDSHAKE) {
if (direction == Direction.SERVERBOUND && state == State.HANDSHAKE) {
// Disable if it isn't a handshake packet.
if (packetWrapper.getId() != 0) {
packetWrapper.user().setActive(false);

Datei anzeigen

@ -50,7 +50,7 @@ public class BaseProtocol1_7 extends AbstractSimpleProtocol {
/* Outgoing Packets */
// Status Response Packet
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() { // Status Response Packet
registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() { // Status Response Packet
@Override
public void registerMap() {
map(Type.STRING);
@ -124,13 +124,13 @@ public class BaseProtocol1_7 extends AbstractSimpleProtocol {
}
});
registerOutgoing(State.STATUS, 0x01, 0x01); // Status Pong Packet
registerClientbound(State.STATUS, 0x01, 0x01); // Status Pong Packet
registerOutgoing(State.LOGIN, 0x00, 0x00); // Login Disconnect Packet
registerOutgoing(State.LOGIN, 0x01, 0x01); // Encryption Request Packet
registerClientbound(State.LOGIN, 0x00, 0x00); // Login Disconnect Packet
registerClientbound(State.LOGIN, 0x01, 0x01); // Encryption Request Packet
// Login Success Packet
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
registerClientbound(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -165,16 +165,16 @@ public class BaseProtocol1_7 extends AbstractSimpleProtocol {
}
});
registerOutgoing(State.LOGIN, 0x03, 0x03); // Login Set Compression Packet
registerIncoming(State.LOGIN, 0x04, 0x04); // Plugin Request (1.13)
registerClientbound(State.LOGIN, 0x03, 0x03); // Login Set Compression Packet
registerServerbound(State.LOGIN, 0x04, 0x04); // Plugin Request (1.13)
/* Incoming Packets */
registerIncoming(State.STATUS, 0x00, 0x00); // Status Request Packet
registerIncoming(State.STATUS, 0x01, 0x01); // Status Ping Packet
registerServerbound(State.STATUS, 0x00, 0x00); // Status Request Packet
registerServerbound(State.STATUS, 0x01, 0x01); // Status Ping Packet
// Login Start Packet
registerIncoming(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
registerServerbound(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -197,8 +197,8 @@ public class BaseProtocol1_7 extends AbstractSimpleProtocol {
});
}
}); // Login Start Packet
registerIncoming(State.LOGIN, 0x01, 0x01); // Encryption Response Packet
registerIncoming(State.LOGIN, 0x02, 0x02); // Plugin Response (1.13)
registerServerbound(State.LOGIN, 0x01, 0x01); // Encryption Response Packet
registerServerbound(State.LOGIN, 0x02, 0x02); // Plugin Response (1.13)
}
@Override

Datei anzeigen

@ -65,7 +65,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
InventoryPackets.register(this);
// Named sound effect
registerOutgoing(State.PLAY, 0x19, 0x19, new PacketRemapper() {
registerClientbound(State.PLAY, 0x19, 0x19, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Sound name
@ -79,7 +79,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Sound effect
registerOutgoing(State.PLAY, 0x46, 0x46, new PacketRemapper() {
registerClientbound(State.PLAY, 0x46, 0x46, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound name
@ -101,7 +101,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Metadata packet
registerOutgoing(State.PLAY, 0x39, 0x39, new PacketRemapper() {
registerClientbound(State.PLAY, 0x39, 0x39, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -110,7 +110,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Spawn Mob
registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
registerClientbound(State.PLAY, 0x03, 0x03, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -130,7 +130,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Spawn Player
registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
registerClientbound(State.PLAY, 0x05, 0x05, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -145,7 +145,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Packet Send ResourcePack
registerOutgoing(State.PLAY, 0x32, 0x32, new PacketRemapper() {
registerClientbound(State.PLAY, 0x32, 0x32, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - URL
@ -162,7 +162,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
// Packet ResourcePack status
registerIncoming(State.PLAY, 0x16, 0x16, new PacketRemapper() {
registerServerbound(State.PLAY, 0x16, 0x16, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -61,7 +61,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
InventoryPackets.register(this);
registerOutgoing(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -73,7 +73,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerOutgoing(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -112,7 +112,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
new SoundRewriter(this, this::getNewSoundId).registerSound(ClientboundPackets1_9_3.SOUND);
registerOutgoing(ClientboundPackets1_9_3.COLLECT_ITEM, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.COLLECT_ITEM, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Collected entity id
@ -129,7 +129,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_9_3.ENTITY_METADATA, Types1_9.METADATA_LIST);
registerOutgoing(ClientboundPackets1_9_3.ENTITY_TELEPORT, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.ENTITY_TELEPORT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -159,7 +159,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
metadataRewriter.registerEntityDestroy(ClientboundPackets1_9_3.DESTROY_ENTITIES);
registerOutgoing(ClientboundPackets1_9_3.TITLE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.TITLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Action
@ -178,7 +178,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerOutgoing(ClientboundPackets1_9_3.BLOCK_ACTION, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.BLOCK_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Position
@ -201,7 +201,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerOutgoing(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Position
@ -224,7 +224,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerOutgoing(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -255,7 +255,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerOutgoing(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -268,7 +268,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
});
}
});
registerOutgoing(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT);
@ -280,7 +280,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
this.registerOutgoing(ClientboundPackets1_9_3.EFFECT, new PacketRemapper() {
this.registerClientbound(ClientboundPackets1_9_3.EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
this.map(Type.INT); //effectID
@ -313,7 +313,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
INCOMING PACKETS
*/
registerIncoming(ServerboundPackets1_9_3.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
registerServerbound(ServerboundPackets1_9_3.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Location
@ -326,7 +326,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
}
});
registerIncoming(ServerboundPackets1_9_3.CHAT_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_9_3.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Message

Datei anzeigen

@ -38,7 +38,7 @@ public class InventoryPackets {
itemRewriter.registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM);
// Plugin message Packet -> Trading
protocol.registerOutgoing(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel

Datei anzeigen

@ -29,6 +29,6 @@ public class Protocol1_12_1To1_12 extends AbstractProtocol<ClientboundPackets1_1
@Override
protected void registerPackets() {
cancelIncoming(ServerboundPackets1_12_1.CRAFT_RECIPE_REQUEST);
cancelServerbound(ServerboundPackets1_12_1.CRAFT_RECIPE_REQUEST);
}
}

Datei anzeigen

@ -31,14 +31,14 @@ public class Protocol1_12_2To1_12_1 extends AbstractProtocol<ClientboundPackets1
@Override
protected void registerPackets() {
registerOutgoing(ClientboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT, Type.LONG);
}
});
registerIncoming(ServerboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_12_1.KEEP_ALIVE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.LONG, Type.VAR_INT);

Datei anzeigen

@ -56,7 +56,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
InventoryPackets.register(this);
registerOutgoing(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -68,7 +68,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
}
});
registerOutgoing(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -90,7 +90,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
}
});
registerOutgoing(ClientboundPackets1_9_3.CHAT_MESSAGE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -110,7 +110,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
}
});
registerOutgoing(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -156,7 +156,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
metadataRewriter.registerEntityDestroy(ClientboundPackets1_9_3.DESTROY_ENTITIES);
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_9_3.ENTITY_METADATA, Types1_12.METADATA_LIST);
registerOutgoing(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT);
@ -169,7 +169,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
});
}
});
registerOutgoing(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT);
@ -185,10 +185,10 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
// New packet at 0x01
cancelIncoming(ServerboundPackets1_12.PREPARE_CRAFTING_GRID);
cancelServerbound(ServerboundPackets1_12.PREPARE_CRAFTING_GRID);
// Client Settings (max length changed)
registerIncoming(ServerboundPackets1_12.CLIENT_SETTINGS, new PacketRemapper() {
registerServerbound(ServerboundPackets1_12.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Locale
@ -219,10 +219,10 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
});
// New packet at 0x17
cancelIncoming(ServerboundPackets1_12.RECIPE_BOOK_DATA);
cancelServerbound(ServerboundPackets1_12.RECIPE_BOOK_DATA);
// New packet 0x19
cancelIncoming(ServerboundPackets1_12.ADVANCEMENT_TAB);
cancelServerbound(ServerboundPackets1_12.ADVANCEMENT_TAB);
}
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.

Datei anzeigen

@ -40,7 +40,7 @@ public class InventoryPackets {
itemRewriter.registerEntityEquipment(ClientboundPackets1_9_3.ENTITY_EQUIPMENT, Type.ITEM);
// Plugin message Packet -> Trading
protocol.registerOutgoing(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_9_3.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel
@ -72,7 +72,7 @@ public class InventoryPackets {
});
protocol.registerIncoming(ServerboundPackets1_12.CLICK_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_12.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID

Datei anzeigen

@ -55,7 +55,7 @@ public class Protocol1_13_1To1_13 extends AbstractProtocol<ClientboundPackets1_1
InventoryPackets.register(this);
WorldPackets.register(this);
registerIncoming(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -69,7 +69,7 @@ public class Protocol1_13_1To1_13 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerIncoming(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLAT_ITEM);
@ -93,7 +93,7 @@ public class Protocol1_13_1To1_13 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Transaction id
@ -119,7 +119,7 @@ public class Protocol1_13_1To1_13 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_13.BOSSBAR, new PacketRemapper() {
registerClientbound(ClientboundPackets1_13.BOSSBAR, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UUID);

Datei anzeigen

@ -33,7 +33,7 @@ public class EntityPackets {
public static void register(Protocol1_13_1To1_13 protocol) {
MetadataRewriter1_13_1To1_13 metadataRewriter = protocol.get(MetadataRewriter1_13_1To1_13.class);
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -67,7 +67,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -88,7 +88,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -38,7 +38,7 @@ public class InventoryPackets {
itemRewriter.registerAdvancements(ClientboundPackets1_13.ADVANCEMENTS, Type.FLAT_ITEM);
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN);
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Channel
@ -75,7 +75,7 @@ public class InventoryPackets {
itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_ITEM);
RecipeRewriter recipeRewriter = new RecipeRewriter1_13_2(protocol, InventoryPackets::toClient);
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -34,7 +34,7 @@ public class WorldPackets {
public static void register(Protocol protocol) {
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION);
protocol.registerOutgoing(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -59,7 +59,7 @@ public class WorldPackets {
blockRewriter.registerMultiBlockChange(ClientboundPackets1_13.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_13.EFFECT, 1010, 2001);
protocol.registerOutgoing(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -78,7 +78,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID

Datei anzeigen

@ -41,14 +41,14 @@ public class Protocol1_13_2To1_13_1 extends AbstractProtocol<ClientboundPackets1
WorldPackets.register(this);
EntityPackets.register(this);
registerIncoming(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM);
}
});
registerOutgoing(ClientboundPackets1_13.ADVANCEMENTS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_13.ADVANCEMENTS, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -36,7 +36,7 @@ public class EntityPackets {
}
};
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -57,7 +57,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -73,7 +73,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_METADATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.ENTITY_METADATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPacke
public class InventoryPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SET_SLOT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
@ -36,7 +36,7 @@ public class InventoryPackets {
map(Type.FLAT_ITEM, Type.FLAT_VAR_INT_ITEM); // 2 - Slot Value
}
});
protocol.registerOutgoing(ClientboundPackets1_13.WINDOW_ITEMS, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.WINDOW_ITEMS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -44,7 +44,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Channel
@ -77,7 +77,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_EQUIPMENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.ENTITY_EQUIPMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -86,7 +86,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -125,7 +125,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_13.CLICK_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_13.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -136,7 +136,7 @@ public class InventoryPackets {
map(Type.FLAT_VAR_INT_ITEM, Type.FLAT_ITEM); // 5 - Clicked Item
}
});
protocol.registerIncoming(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.SHORT); // 0 - Slot

Datei anzeigen

@ -27,7 +27,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke
public class WorldPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PARTICLE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_PARTICLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Particle ID

Datei anzeigen

@ -169,14 +169,14 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
WorldPackets.register(this);
InventoryPackets.register(this);
registerOutgoing(State.LOGIN, 0x0, 0x0, new PacketRemapper() {
registerClientbound(State.LOGIN, 0x0, 0x0, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> ChatRewriter.processTranslate(wrapper.passthrough(Type.COMPONENT)));
}
});
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() {
registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING);
@ -201,7 +201,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
// New packet 0x04 - Login Plugin Message
// Statistics
registerOutgoing(ClientboundPackets1_12_1.STATISTICS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.STATISTICS, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -269,7 +269,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.BOSSBAR, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.BOSSBAR, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UUID);
@ -285,13 +285,13 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
}
});
registerOutgoing(ClientboundPackets1_12_1.CHAT_MESSAGE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> ChatRewriter.processTranslate(wrapper.passthrough(Type.COMPONENT)));
}
});
registerOutgoing(ClientboundPackets1_12_1.TAB_COMPLETE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.TAB_COMPLETE, new PacketRemapper() {
@Override
public void registerMap() {
create(new ValueCreator() {
@ -332,7 +332,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.OPEN_WINDOW, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.OPEN_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // Id
@ -341,7 +341,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.COOLDOWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.COOLDOWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -380,14 +380,14 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.DISCONNECT, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.DISCONNECT, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> ChatRewriter.processTranslate(wrapper.passthrough(Type.COMPONENT)));
}
});
registerOutgoing(ClientboundPackets1_12_1.EFFECT, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Effect Id
@ -410,7 +410,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -434,14 +434,14 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
registerOutgoing(ClientboundPackets1_12_1.CRAFT_RECIPE_RESPONSE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.CRAFT_RECIPE_RESPONSE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE);
handler(wrapper -> wrapper.write(Type.STRING, "viaversion:legacy/" + wrapper.read(Type.VAR_INT)));
}
});
registerOutgoing(ClientboundPackets1_12_1.COMBAT_EVENT, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.COMBAT_EVENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Event
@ -457,7 +457,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
}
});
registerOutgoing(ClientboundPackets1_12_1.MAP_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Map id
@ -481,7 +481,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
}
});
registerOutgoing(ClientboundPackets1_12_1.UNLOCK_RECIPES, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.UNLOCK_RECIPES, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // action
@ -567,7 +567,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.RESPAWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID
@ -587,7 +587,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.SCOREBOARD_OBJECTIVE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.SCOREBOARD_OBJECTIVE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Objective name
@ -610,7 +610,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.TEAMS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.TEAMS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Team Name
@ -663,7 +663,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.UPDATE_SCORE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.UPDATE_SCORE, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -684,7 +684,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.TITLE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.TITLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Action
@ -703,7 +703,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
new SoundRewriter(this).registerSound(ClientboundPackets1_12_1.SOUND);
registerOutgoing(ClientboundPackets1_12_1.TAB_LIST, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.TAB_LIST, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -716,7 +716,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_12_1.ADVANCEMENTS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_12_1.ADVANCEMENTS, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -763,13 +763,13 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
// Incoming packets
// New packet 0x02 - Login Plugin Message
cancelIncoming(State.LOGIN, 0x02);
cancelServerbound(State.LOGIN, 0x02);
// New 0x01 - Query Block NBT
cancelIncoming(ServerboundPackets1_13.QUERY_BLOCK_NBT);
cancelServerbound(ServerboundPackets1_13.QUERY_BLOCK_NBT);
// Tab-Complete
registerIncoming(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -810,7 +810,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x0A - Edit book -> Plugin Message
registerIncoming(ServerboundPackets1_13.EDIT_BOOK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.EDIT_BOOK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -829,10 +829,10 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x0C - Query Entity NBT
cancelIncoming(ServerboundPackets1_13.ENTITY_NBT_REQUEST);
cancelServerbound(ServerboundPackets1_13.ENTITY_NBT_REQUEST);
// New 0x15 - Pick Item -> Plugin Message
registerIncoming(ServerboundPackets1_13.PICK_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.PICK_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(new ValueCreator() {
@ -844,7 +844,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerIncoming(ServerboundPackets1_13.CRAFT_RECIPE_REQUEST, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.CRAFT_RECIPE_REQUEST, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // Window id
@ -862,7 +862,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerIncoming(ServerboundPackets1_13.RECIPE_BOOK_DATA, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.RECIPE_BOOK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Type
@ -895,7 +895,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x1C - Name Item -> Plugin Message
registerIncoming(ServerboundPackets1_13.RENAME_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.RENAME_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(wrapper -> {
@ -905,7 +905,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x1F - Select Trade -> Plugin Message
registerIncoming(ServerboundPackets1_13.SELECT_TRADE, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.SELECT_TRADE, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(wrapper -> {
@ -916,7 +916,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x20 - Set Beacon Effect -> Plugin Message
registerIncoming(ServerboundPackets1_13.SET_BEACON_EFFECT, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.SET_BEACON_EFFECT, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(wrapper -> {
@ -928,7 +928,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x22 - Update Command Block -> Plugin Message
registerIncoming(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(wrapper -> wrapper.write(Type.STRING, "MC|AutoCmd"));
@ -954,7 +954,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
});
// New 0x23 - Update Command Block Minecart -> Plugin Message
registerIncoming(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK_MINECART, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK_MINECART, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(new ValueCreator() {
@ -971,7 +971,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
// 0x1B -> 0x24 in InventoryPackets
// New 0x25 - Update Structure Block -> Message Channel
registerIncoming(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
create(wrapper -> {

Datei anzeigen

@ -34,7 +34,7 @@ public class EntityPackets {
public static void register(Protocol1_13To1_12_2 protocol) {
MetadataRewriter1_13To1_12_2 metadataRewriter = protocol.get(MetadataRewriter1_13To1_12_2.class);
protocol.registerOutgoing(ClientboundPackets1_12_1.SPAWN_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -93,7 +93,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -114,7 +114,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -55,7 +55,7 @@ public class InventoryPackets {
public static void register(Protocol1_13To1_12_2 protocol) {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
protocol.registerOutgoing(ClientboundPackets1_12_1.SET_SLOT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SET_SLOT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
@ -65,7 +65,7 @@ public class InventoryPackets {
handler(itemRewriter.itemToClientHandler(Type.FLAT_ITEM));
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.WINDOW_ITEMS, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.WINDOW_ITEMS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -74,7 +74,7 @@ public class InventoryPackets {
handler(itemRewriter.itemArrayHandler(Type.FLAT_ITEM_ARRAY));
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.WINDOW_PROPERTY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.WINDOW_PROPERTY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // Window id
@ -94,7 +94,7 @@ public class InventoryPackets {
});
// Plugin message Packet -> Trading
protocol.registerOutgoing(ClientboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel
@ -196,7 +196,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.ENTITY_EQUIPMENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.ENTITY_EQUIPMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -208,7 +208,7 @@ public class InventoryPackets {
});
protocol.registerIncoming(ServerboundPackets1_13.CLICK_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_13.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -222,7 +222,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Channel
@ -257,7 +257,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_13.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.SHORT); // 0 - Slot

Datei anzeigen

@ -74,7 +74,7 @@ public class WorldPackets {
public static void register(Protocol protocol) {
// Outgoing packets
protocol.registerOutgoing(ClientboundPackets1_12_1.SPAWN_PAINTING, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PAINTING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -97,7 +97,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.BLOCK_ENTITY_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Location
@ -129,7 +129,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.BLOCK_ACTION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // Location
@ -177,7 +177,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.BLOCK_CHANGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION);
@ -207,7 +207,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.MULTI_BLOCK_CHANGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.MULTI_BLOCK_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Chunk X
@ -267,7 +267,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.EXPLOSION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.EXPLOSION, new PacketRemapper() {
@Override
public void registerMap() {
if (!Via.getConfig().isServersideBlockConnections())
@ -312,7 +312,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.UNLOAD_CHUNK, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.UNLOAD_CHUNK, new PacketRemapper() {
@Override
public void registerMap() {
if (Via.getConfig().isServersideBlockConnections()) {
@ -328,7 +328,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.NAMED_SOUND, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.NAMED_SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING);
@ -343,7 +343,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -476,7 +476,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_12_1.SPAWN_PARTICLE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PARTICLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Particle ID

Datei anzeigen

@ -30,7 +30,7 @@ public class EntityPackets {
public static void register(Protocol1_14_1To1_14 protocol) {
MetadataRewriter1_14_1To1_14 metadataRewriter = protocol.get(MetadataRewriter1_14_1To1_14.class);
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -53,7 +53,7 @@ public class EntityPackets {
metadataRewriter.registerEntityDestroy(ClientboundPackets1_14.DESTROY_ENTITIES);
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -33,7 +33,7 @@ public class Protocol1_14_3To1_14_2 extends AbstractProtocol<ClientboundPackets1
@Override
protected void registerPackets() {
registerOutgoing(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
registerClientbound(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -33,7 +33,7 @@ public class Protocol1_14_4To1_14_3 extends AbstractProtocol<ClientboundPackets1
@Override
protected void registerPackets() {
registerOutgoing(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
registerClientbound(ClientboundPackets1_14.TRADE_LIST, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -66,7 +66,7 @@ public class Protocol1_14To1_13_2 extends AbstractProtocol<ClientboundPackets1_1
CommandRewriter1_14 commandRewriter = new CommandRewriter1_14(this);
commandRewriter.registerDeclareCommands(ClientboundPackets1_13.DECLARE_COMMANDS);
registerOutgoing(ClientboundPackets1_13.TAGS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_13.TAGS, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -130,11 +130,11 @@ public class Protocol1_14To1_13_2 extends AbstractProtocol<ClientboundPackets1_1
});
// Set Difficulty packet added in 19w11a
cancelIncoming(ServerboundPackets1_14.SET_DIFFICULTY);
cancelServerbound(ServerboundPackets1_14.SET_DIFFICULTY);
// Lock Difficulty packet added in 19w11a
cancelIncoming(ServerboundPackets1_14.LOCK_DIFFICULTY);
cancelServerbound(ServerboundPackets1_14.LOCK_DIFFICULTY);
// Unknown packet added in 19w13a
cancelIncoming(ServerboundPackets1_14.UPDATE_JIGSAW_BLOCK);
cancelServerbound(ServerboundPackets1_14.UPDATE_JIGSAW_BLOCK);
}
@Override

Datei anzeigen

@ -43,7 +43,7 @@ public class EntityPackets {
public static void register(Protocol1_14To1_13_2 protocol) {
MetadataRewriter1_14To1_13_2 metadataRewriter = protocol.get(MetadataRewriter1_14To1_13_2.class);
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -120,7 +120,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -141,7 +141,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PAINTING, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_PAINTING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -152,7 +152,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -168,7 +168,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.ENTITY_ANIMATION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.ENTITY_ANIMATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -196,7 +196,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.USE_BED, ClientboundPackets1_14.ENTITY_METADATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.USE_BED, ClientboundPackets1_14.ENTITY_METADATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);

Datei anzeigen

@ -65,7 +65,7 @@ public class InventoryPackets {
itemRewriter.registerSetCooldown(ClientboundPackets1_13.COOLDOWN);
itemRewriter.registerAdvancements(ClientboundPackets1_13.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_13.OPEN_WINDOW, null, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.OPEN_WINDOW, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -144,7 +144,7 @@ public class InventoryPackets {
itemRewriter.registerWindowItems(ClientboundPackets1_13.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
itemRewriter.registerSetSlot(ClientboundPackets1_13.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Channel
@ -199,7 +199,7 @@ public class InventoryPackets {
itemRewriter.registerEntityEquipment(ClientboundPackets1_13.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
RecipeRewriter recipeRewriter = new RecipeRewriter1_13_2(protocol, InventoryPackets::toClient);
protocol.registerOutgoing(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.DECLARE_RECIPES, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -225,7 +225,7 @@ public class InventoryPackets {
itemRewriter.registerClickWindow(ServerboundPackets1_14.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_14.SELECT_TRADE, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.SELECT_TRADE, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -34,14 +34,14 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPacke
public class PlayerPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_13.OPEN_SIGN_EDITOR, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.OPEN_SIGN_EDITOR, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
}
});
protocol.registerIncoming(ServerboundPackets1_14.QUERY_BLOCK_NBT, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.QUERY_BLOCK_NBT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -49,7 +49,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -77,7 +77,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_14.PLAYER_DIGGING, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.PLAYER_DIGGING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -86,7 +86,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_14.RECIPE_BOOK_DATA, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.RECIPE_BOOK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -113,26 +113,26 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_14.UPDATE_COMMAND_BLOCK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_COMMAND_BLOCK, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
}
});
protocol.registerIncoming(ServerboundPackets1_14.UPDATE_STRUCTURE_BLOCK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_STRUCTURE_BLOCK, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
}
});
protocol.registerIncoming(ServerboundPackets1_14.UPDATE_SIGN, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_SIGN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
}
});
protocol.registerIncoming(ServerboundPackets1_14.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_14.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -55,7 +55,7 @@ public class WorldPackets {
public static void register(Protocol1_14To1_13_2 protocol) {
BlockRewriter blockRewriter = new BlockRewriter(protocol, null);
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_BREAK_ANIMATION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_BREAK_ANIMATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -63,13 +63,13 @@ public class WorldPackets {
map(Type.BYTE);
}
});
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
}
});
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_ACTION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14); // Location
@ -84,7 +84,7 @@ public class WorldPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_13.BLOCK_CHANGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
@ -100,7 +100,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SERVER_DIFFICULTY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SERVER_DIFFICULTY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE);
@ -115,7 +115,7 @@ public class WorldPackets {
blockRewriter.registerMultiBlockChange(ClientboundPackets1_13.MULTI_BLOCK_CHANGE);
protocol.registerOutgoing(ClientboundPackets1_13.EXPLOSION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.EXPLOSION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLOAT); // X
@ -138,7 +138,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -267,7 +267,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.EFFECT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Effect Id
@ -288,7 +288,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -331,7 +331,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.MAP_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -346,7 +346,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID
@ -374,7 +374,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_13.SPAWN_POSITION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);

Datei anzeigen

@ -60,7 +60,7 @@ public class Protocol1_15To1_14_4 extends AbstractProtocol<ClientboundPackets1_1
new StatisticsRewriter(this, metadataRewriter::getNewEntityId).register(ClientboundPackets1_14.STATISTICS);
registerIncoming(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
registerServerbound(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));

Datei anzeigen

@ -37,7 +37,7 @@ public class EntityPackets {
metadataRewriter.registerSpawnTrackerWithData(ClientboundPackets1_14.SPAWN_ENTITY, Entity1_15Types.FALLING_BLOCK);
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -66,7 +66,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.storage.EntityTr
public class PlayerPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_14.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT);
@ -36,7 +36,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_14.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID

Datei anzeigen

@ -39,7 +39,7 @@ public class WorldPackets {
blockRewriter.registerMultiBlockChange(ClientboundPackets1_14.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_14.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_14.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -85,7 +85,7 @@ public class WorldPackets {
});
blockRewriter.registerEffect(ClientboundPackets1_14.EFFECT, 1010, 2001);
protocol.registerOutgoing(ClientboundPackets1_14.SPAWN_PARTICLE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_14.SPAWN_PARTICLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Particle ID

Datei anzeigen

@ -62,7 +62,7 @@ public class Protocol1_16_2To1_16_1 extends AbstractProtocol<ClientboundPackets1
soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
// Recipe book data has been split into 2 separate packets
registerIncoming(ServerboundPackets1_16_2.RECIPE_BOOK_DATA, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16_2.RECIPE_BOOK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -81,7 +81,7 @@ public class Protocol1_16_2To1_16_1 extends AbstractProtocol<ClientboundPackets1
});
}
});
registerIncoming(ServerboundPackets1_16_2.SEEN_RECIPE, ServerboundPackets1_16.RECIPE_BOOK_DATA, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16_2.SEEN_RECIPE, ServerboundPackets1_16.RECIPE_BOOK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -38,7 +38,7 @@ public class EntityPackets {
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST);
metadataRewriter.registerEntityDestroy(ClientboundPackets1_16.DESTROY_ENTITIES);
protocol.registerOutgoing(ClientboundPackets1_16.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
@ -70,7 +70,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -38,7 +38,7 @@ public class InventoryPackets {
itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerAdvancements(ClientboundPackets1_16.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_16.UNLOCK_RECIPES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16.UNLOCK_RECIPES, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -60,7 +60,7 @@ public class InventoryPackets {
itemRewriter.registerClickWindow(ServerboundPackets1_16_2.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));

Datei anzeigen

@ -46,7 +46,7 @@ public class WorldPackets {
blockRewriter.registerBlockChange(ClientboundPackets1_16.BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_16.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -65,7 +65,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16.MULTI_BLOCK_CHANGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16.MULTI_BLOCK_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -31,7 +31,7 @@ public class Protocol1_16_4To1_16_3 extends AbstractProtocol<ClientboundPackets1
@Override
protected void registerPackets() {
registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLAT_VAR_INT_ITEM);

Datei anzeigen

@ -74,7 +74,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
new StatisticsRewriter(this, metadataRewriter::getNewEntityId).register(ClientboundPackets1_15.STATISTICS);
// Login Success
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
registerClientbound(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -86,7 +86,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
});
// Motd Status - line breaks are no longer allowed for player samples
registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() {
registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -127,7 +127,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
ComponentRewriter componentRewriter = new TranslationMappings(this);
// Handle (relevant) component cases for translatable and score changes
registerOutgoing(ClientboundPackets1_15.CHAT_MESSAGE, new PacketRemapper() {
registerClientbound(ClientboundPackets1_15.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.COMPONENT);
@ -146,7 +146,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
soundRewriter.registerSound(ClientboundPackets1_15.SOUND);
soundRewriter.registerSound(ClientboundPackets1_15.ENTITY_SOUND);
registerIncoming(ServerboundPackets1_16.INTERACT_ENTITY, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16.INTERACT_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -170,7 +170,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
});
if (Via.getConfig().isIgnoreLong1_16ChannelNames()) {
registerIncoming(ServerboundPackets1_16.PLUGIN_MESSAGE, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -207,7 +207,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
});
}
registerIncoming(ServerboundPackets1_16.PLAYER_ABILITIES, new PacketRemapper() {
registerServerbound(ServerboundPackets1_16.PLAYER_ABILITIES, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -219,8 +219,8 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
}
});
cancelIncoming(ServerboundPackets1_16.GENERATE_JIGSAW);
cancelIncoming(ServerboundPackets1_16.UPDATE_JIGSAW_BLOCK);
cancelServerbound(ServerboundPackets1_16.GENERATE_JIGSAW);
cancelServerbound(ServerboundPackets1_16.UPDATE_JIGSAW_BLOCK);
}
@Override

Datei anzeigen

@ -147,7 +147,7 @@ public class EntityPackets {
MetadataRewriter1_16To1_15_2 metadataRewriter = protocol.get(MetadataRewriter1_16To1_15_2.class);
// Spawn lightning -> Spawn entity
protocol.registerOutgoing(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, ClientboundPackets1_16.SPAWN_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, ClientboundPackets1_16.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -178,7 +178,7 @@ public class EntityPackets {
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_15.ENTITY_METADATA, Types1_14.METADATA_LIST);
metadataRewriter.registerEntityDestroy(ClientboundPackets1_15.DESTROY_ENTITIES);
protocol.registerOutgoing(ClientboundPackets1_15.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(DIMENSION_HANDLER);
@ -195,7 +195,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
@ -222,7 +222,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.ENTITY_PROPERTIES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.ENTITY_PROPERTIES, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -268,7 +268,7 @@ public class EntityPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_16.ANIMATION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_16.ANIMATION, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -42,7 +42,7 @@ public class InventoryPackets {
public static void register(Protocol1_16To1_15_2 protocol) {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
protocol.registerOutgoing(ClientboundPackets1_15.OPEN_WINDOW, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.OPEN_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Window Id
@ -61,7 +61,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.CLOSE_WINDOW, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.CLOSE_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE);
@ -73,7 +73,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.WINDOW_PROPERTY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.WINDOW_PROPERTY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // Window Id
@ -98,7 +98,7 @@ public class InventoryPackets {
itemRewriter.registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
protocol.registerOutgoing(ClientboundPackets1_15.ENTITY_EQUIPMENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.ENTITY_EQUIPMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -116,7 +116,7 @@ public class InventoryPackets {
itemRewriter.registerClickWindow(ServerboundPackets1_16.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16.CLOSE_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_16.CLOSE_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE);
@ -128,7 +128,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_16.EDIT_BOOK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_16.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));

Datei anzeigen

@ -48,7 +48,7 @@ public class WorldPackets {
blockRewriter.registerMultiBlockChange(ClientboundPackets1_15.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_15.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_15.UPDATE_LIGHT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.UPDATE_LIGHT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // x
@ -57,7 +57,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -91,7 +91,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_15.BLOCK_ENTITY_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_15.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -58,7 +58,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
WorldPackets.register(this);
tagRewriter = new TagRewriter(this, null);
registerOutgoing(ClientboundPackets1_16_2.TAGS, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.TAGS, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -94,7 +94,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
registerOutgoing(ClientboundPackets1_16_2.RESOURCE_PACK, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.RESOURCE_PACK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -106,7 +106,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_16_2.MAP_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -127,7 +127,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_16_2.TITLE, null, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.TITLE, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -164,7 +164,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_16_2.EXPLOSION, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.EXPLOSION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLOAT); // X
@ -178,7 +178,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerOutgoing(ClientboundPackets1_16_2.SPAWN_POSITION, new PacketRemapper() {
registerClientbound(ClientboundPackets1_16_2.SPAWN_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14);
@ -189,7 +189,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
}
});
registerIncoming(ServerboundPackets1_17.CLIENT_SETTINGS, new PacketRemapper() {
registerServerbound(ServerboundPackets1_17.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Locale

Datei anzeigen

@ -38,7 +38,7 @@ public class EntityPackets {
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_17.METADATA_LIST);
metadataRewriter.registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
protocol.registerOutgoing(ClientboundPackets1_16_2.ENTITY_PROPERTIES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.ENTITY_PROPERTIES, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Entity id
@ -49,7 +49,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.PLAYER_POSITION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.PLAYER_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.DOUBLE);
@ -66,7 +66,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.COMBAT_EVENT, null, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.COMBAT_EVENT, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -93,6 +93,6 @@ public class EntityPackets {
});
// The parent class of the other entity move packets that is never actually used has finally been removed from the id list
protocol.cancelOutgoing(ClientboundPackets1_16_2.ENTITY_MOVEMENT);
protocol.cancelClientbound(ClientboundPackets1_16_2.ENTITY_MOVEMENT);
}
}

Datei anzeigen

@ -45,7 +45,7 @@ public class InventoryPackets {
itemRewriter.registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
@ -53,7 +53,7 @@ public class InventoryPackets {
});
// This will cause desync issues to clients with a high latency
protocol.registerIncoming(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // Window Id
@ -87,7 +87,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.WINDOW_CONFIRMATION, null, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.WINDOW_CONFIRMATION, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -53,7 +53,7 @@ public class WorldPackets {
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16_2.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_16_2.WORLD_BORDER, null, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.WORLD_BORDER, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -88,7 +88,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.UPDATE_LIGHT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.UPDATE_LIGHT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // x
@ -132,7 +132,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -168,7 +168,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
@ -200,7 +200,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -218,7 +218,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.UNLOAD_CHUNK, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_16_2.UNLOAD_CHUNK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -44,7 +44,7 @@ public class Protocol1_9_1_2To1_9_3_4 extends AbstractProtocol<ClientboundPacket
@Override
protected void registerPackets() {
registerOutgoing(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); //Position
@ -71,7 +71,7 @@ public class Protocol1_9_1_2To1_9_3_4 extends AbstractProtocol<ClientboundPacket
}
});
registerOutgoing(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -90,7 +90,7 @@ public class Protocol1_9_1_2To1_9_3_4 extends AbstractProtocol<ClientboundPacket
}
});
registerOutgoing(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -109,7 +109,7 @@ public class Protocol1_9_1_2To1_9_3_4 extends AbstractProtocol<ClientboundPacket
}
});
registerOutgoing(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9_3.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID

Datei anzeigen

@ -35,7 +35,7 @@ public class Protocol1_9_1To1_9 extends AbstractProtocol<ClientboundPackets1_9,
protected void registerPackets() {
// Currently supports 1.9.1 and 1.9.2
registerOutgoing(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Player ID
@ -49,7 +49,7 @@ public class Protocol1_9_1To1_9 extends AbstractProtocol<ClientboundPackets1_9,
}
});
registerOutgoing(ClientboundPackets1_9.SOUND, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound ID

Datei anzeigen

@ -55,7 +55,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
@Override
protected void registerPackets() {
// Sign update packet
registerOutgoing(ClientboundPackets1_9.UPDATE_SIGN, null, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.UPDATE_SIGN, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -91,7 +91,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
}
});
registerOutgoing(ClientboundPackets1_9.CHUNK_DATA, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -127,7 +127,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
}
});
registerOutgoing(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Entity ID
@ -145,7 +145,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
}
});
registerOutgoing(ClientboundPackets1_9.RESPAWN, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID
@ -161,7 +161,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
});
// Sound effect
registerOutgoing(ClientboundPackets1_9.SOUND, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound name

Datei anzeigen

@ -114,7 +114,7 @@ public class Protocol1_9To1_8 extends AbstractProtocol<ClientboundPackets1_8, Cl
MetadataRewriter metadataRewriter = new MetadataRewriter1_9To1_8(this);
// Disconnect workaround (JSON!)
registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
registerClientbound(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -53,7 +53,7 @@ public class EntityPackets {
public static void register(Protocol1_9To1_8 protocol) {
// Attach Entity Packet
protocol.registerOutgoing(ClientboundPackets1_8.ATTACH_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ATTACH_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
@ -89,7 +89,7 @@ public class EntityPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_TELEPORT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_TELEPORT, new PacketRemapper() {
@Override
public void registerMap() {
@ -121,7 +121,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_POSITION_AND_ROTATION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_POSITION_AND_ROTATION, new PacketRemapper() {
@Override
public void registerMap() {
@ -136,7 +136,7 @@ public class EntityPackets {
map(Type.BOOLEAN); // 6 - On Ground
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_POSITION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
@ -148,7 +148,7 @@ public class EntityPackets {
map(Type.BOOLEAN); // 4 - On Ground
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_EQUIPMENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_EQUIPMENT, new PacketRemapper() {
@Override
public void registerMap() {
@ -196,7 +196,7 @@ public class EntityPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_METADATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_METADATA, new PacketRemapper() {
@Override
public void registerMap() {
@ -242,7 +242,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_EFFECT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -261,9 +261,9 @@ public class EntityPackets {
}
});
protocol.cancelOutgoing(ClientboundPackets1_8.UPDATE_ENTITY_NBT);
protocol.cancelClientbound(ClientboundPackets1_8.UPDATE_ENTITY_NBT);
protocol.registerOutgoing(ClientboundPackets1_8.COMBAT_EVENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.COMBAT_EVENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); //Event id
@ -280,7 +280,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_PROPERTIES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_PROPERTIES, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -335,7 +335,7 @@ public class EntityPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.ENTITY_ANIMATION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_ANIMATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -353,7 +353,7 @@ public class EntityPackets {
/* Incoming Packets */
protocol.registerIncoming(ServerboundPackets1_9.ENTITY_ACTION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.ENTITY_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
@ -374,7 +374,7 @@ public class EntityPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.INTERACT_ENTITY, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.INTERACT_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {

Datei anzeigen

@ -35,7 +35,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.InventoryTra
public class InventoryPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_8.WINDOW_PROPERTY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.WINDOW_PROPERTY, new PacketRemapper() {
@Override
public void registerMap() {
@ -74,7 +74,7 @@ public class InventoryPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.OPEN_WINDOW, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.OPEN_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
@ -104,7 +104,7 @@ public class InventoryPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SET_SLOT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SET_SLOT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
@ -154,7 +154,7 @@ public class InventoryPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.WINDOW_ITEMS, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.WINDOW_ITEMS, new PacketRemapper() {
@Override
public void registerMap() {
@ -215,7 +215,7 @@ public class InventoryPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_8.CLOSE_WINDOW, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.CLOSE_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
@ -232,7 +232,7 @@ public class InventoryPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.MAP_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
@ -250,7 +250,7 @@ public class InventoryPackets {
/* Incoming Packets */
protocol.registerIncoming(ServerboundPackets1_9.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
@ -303,7 +303,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.CLICK_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.CLICK_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
@ -371,7 +371,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.CLOSE_WINDOW, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.CLOSE_WINDOW, new PacketRemapper() {
@Override
public void registerMap() {
@ -389,7 +389,7 @@ public class InventoryPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.HELD_ITEM_CHANGE, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.HELD_ITEM_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.SHORT); // 0 - Slot id

Datei anzeigen

@ -40,7 +40,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracke
public class PlayerPackets {
public static void register(Protocol1_9To1_8 protocol) {
protocol.registerOutgoing(ClientboundPackets1_8.CHAT_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 0 - Chat Message (json)
@ -60,7 +60,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.TAB_LIST, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.TAB_LIST, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 0 - Header
@ -68,14 +68,14 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.DISCONNECT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.DISCONNECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 0 - Reason
}
});
protocol.registerOutgoing(ClientboundPackets1_8.TITLE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.TITLE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Action
@ -93,7 +93,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.PLAYER_POSITION, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.PLAYER_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.DOUBLE); // 0 - Player X
@ -114,7 +114,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.TEAMS, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.TEAMS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Team Name
@ -178,7 +178,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.JOIN_GAME, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Player ID
@ -237,7 +237,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.PLAYER_INFO, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.PLAYER_INFO, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Action
@ -289,7 +289,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel Name
@ -331,7 +331,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.UPDATE_HEALTH, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.UPDATE_HEALTH, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLOAT); // 0 - Health
@ -350,7 +350,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.RESPAWN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension
@ -383,7 +383,7 @@ public class PlayerPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.GAME_EVENT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.GAME_EVENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); //0 - Reason
@ -402,11 +402,11 @@ public class PlayerPackets {
});
/* Removed packets */
protocol.cancelOutgoing(ClientboundPackets1_8.SET_COMPRESSION);
protocol.cancelClientbound(ClientboundPackets1_8.SET_COMPRESSION);
/* Incoming Packets */
protocol.registerIncoming(ServerboundPackets1_9.TAB_COMPLETE, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.TAB_COMPLETE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Requested Command
@ -414,7 +414,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.CLIENT_SETTINGS, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - locale
@ -442,18 +442,18 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.ANIMATION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.ANIMATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT, Type.NOTHING); // 0 - Hand
}
});
protocol.cancelIncoming(ServerboundPackets1_9.TELEPORT_CONFIRM);
protocol.cancelIncoming(ServerboundPackets1_9.VEHICLE_MOVE);
protocol.cancelIncoming(ServerboundPackets1_9.STEER_BOAT);
protocol.cancelServerbound(ServerboundPackets1_9.TELEPORT_CONFIRM);
protocol.cancelServerbound(ServerboundPackets1_9.VEHICLE_MOVE);
protocol.cancelServerbound(ServerboundPackets1_9.STEER_BOAT);
protocol.registerIncoming(ServerboundPackets1_9.PLUGIN_MESSAGE, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLUGIN_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Channel Name
@ -486,7 +486,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.CLIENT_STATUS, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.CLIENT_STATUS, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Action ID
@ -509,7 +509,7 @@ public class PlayerPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_POSITION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.DOUBLE); // 0 - X
@ -519,7 +519,7 @@ public class PlayerPackets {
handler(new PlayerMovementMapper());
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_POSITION_AND_ROTATION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_POSITION_AND_ROTATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.DOUBLE); // 0 - X
@ -531,7 +531,7 @@ public class PlayerPackets {
handler(new PlayerMovementMapper());
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_ROTATION, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_ROTATION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLOAT); // 0 - Yaw
@ -540,7 +540,7 @@ public class PlayerPackets {
handler(new PlayerMovementMapper());
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_MOVEMENT, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_MOVEMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BOOLEAN); // 0 - Ground

Datei anzeigen

@ -48,7 +48,7 @@ public class SpawnPackets {
};
public static void register(Protocol1_9To1_8 protocol) {
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -133,7 +133,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_EXPERIENCE_ORB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_EXPERIENCE_ORB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -157,7 +157,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_GLOBAL_ENTITY, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_GLOBAL_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -180,7 +180,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_MOB, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_MOB, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -247,7 +247,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_PAINTING, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_PAINTING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -277,7 +277,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.SPAWN_PLAYER, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.SPAWN_PLAYER, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -349,7 +349,7 @@ public class SpawnPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.DESTROY_ENTITIES, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.DESTROY_ENTITIES, new PacketRemapper() {
@Override
public void registerMap() {

Datei anzeigen

@ -48,7 +48,7 @@ import java.util.Optional;
public class WorldPackets {
public static void register(Protocol protocol) {
protocol.registerOutgoing(ClientboundPackets1_8.UPDATE_SIGN, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.UPDATE_SIGN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Sign Position
@ -59,7 +59,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.EFFECT, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Effect ID
@ -91,7 +91,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.NAMED_SOUND, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.NAMED_SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // 0 - Sound Name
@ -126,7 +126,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.CHUNK_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -153,7 +153,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.MAP_BULK_CHUNK, null, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.MAP_BULK_CHUNK, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -187,7 +187,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.BLOCK_ENTITY_DATA, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.BLOCK_ENTITY_DATA, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Block Position
@ -224,7 +224,7 @@ public class WorldPackets {
}
});
protocol.registerOutgoing(ClientboundPackets1_8.BLOCK_CHANGE, new PacketRemapper() {
protocol.registerClientbound(ClientboundPackets1_8.BLOCK_CHANGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION);
@ -234,7 +234,7 @@ public class WorldPackets {
/* Incoming Packets */
protocol.registerIncoming(ServerboundPackets1_9.UPDATE_SIGN, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.UPDATE_SIGN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Sign Position
@ -245,7 +245,7 @@ public class WorldPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_DIGGING, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_DIGGING, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT, Type.UNSIGNED_BYTE); // 0 - Status
@ -278,7 +278,7 @@ public class WorldPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.USE_ITEM, null, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.USE_ITEM, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -345,7 +345,7 @@ public class WorldPackets {
}
});
protocol.registerIncoming(ServerboundPackets1_9.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Position

Datei anzeigen

@ -35,7 +35,7 @@ public class Protocol1_9To1_9_1 extends AbstractProtocol<ClientboundPackets1_9,
protected void registerPackets() {
// Currently supports 1.9.1 and 1.9.2
registerOutgoing(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Player ID
@ -49,7 +49,7 @@ public class Protocol1_9To1_9_1 extends AbstractProtocol<ClientboundPackets1_9,
}
});
registerOutgoing(ClientboundPackets1_9.SOUND, new PacketRemapper() {
registerClientbound(ClientboundPackets1_9.SOUND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound ID

Datei anzeigen

@ -35,7 +35,7 @@ public class BlockRewriter {
}
public void registerBlockAction(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(positionType); // Location
@ -58,7 +58,7 @@ public class BlockRewriter {
}
public void registerBlockChange(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(positionType);
@ -69,7 +69,7 @@ public class BlockRewriter {
}
public void registerMultiBlockChange(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Chunk X
@ -84,7 +84,7 @@ public class BlockRewriter {
}
public void registerVarLongMultiBlockChange(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.LONG); // Chunk position
@ -104,7 +104,7 @@ public class BlockRewriter {
}
public void registerEffect(ClientboundPacketType packetType, int playRecordId, int blockBreakId) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Effect Id

Datei anzeigen

@ -77,7 +77,7 @@ public abstract class CommandRewriter {
}
public void registerDeclareCommands(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -53,7 +53,7 @@ public class ComponentRewriter {
* @param packetType clientbound packet type
*/
public void registerComponentPacket(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> processText(wrapper.passthrough(Type.COMPONENT)));
@ -66,7 +66,7 @@ public class ComponentRewriter {
}
public void registerBossBar(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UUID);
@ -85,7 +85,7 @@ public class ComponentRewriter {
* Handles sub 1.17 combat event components.
*/
public void registerCombatEvent(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -103,7 +103,7 @@ public class ComponentRewriter {
* Handles sub 1.17 title components.
*/
public void registerTitle(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -39,7 +39,7 @@ public class ItemRewriter {
}
public void registerWindowItems(ClientboundPacketType packetType, Type<Item[]> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -51,7 +51,7 @@ public class ItemRewriter {
}
public void registerSetSlot(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
@ -65,7 +65,7 @@ public class ItemRewriter {
// Sub 1.16
public void registerEntityEquipment(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -79,7 +79,7 @@ public class ItemRewriter {
// 1.16+
public void registerEntityEquipmentArray(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -97,7 +97,7 @@ public class ItemRewriter {
}
public void registerCreativeInvAction(ServerboundPacketType packetType, Type<Item> type) {
protocol.registerIncoming(packetType, new PacketRemapper() {
protocol.registerServerbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.SHORT); // 0 - Slot
@ -109,7 +109,7 @@ public class ItemRewriter {
}
public void registerClickWindow(ServerboundPacketType packetType, Type<Item> type) {
protocol.registerIncoming(packetType, new PacketRemapper() {
protocol.registerServerbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -125,7 +125,7 @@ public class ItemRewriter {
}
public void registerClickWindow1_17(ServerboundPacketType packetType, Type<Item> type) {
protocol.registerIncoming(packetType, new PacketRemapper() {
protocol.registerServerbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // Window Id
@ -149,7 +149,7 @@ public class ItemRewriter {
}
public void registerSetCooldown(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -162,7 +162,7 @@ public class ItemRewriter {
// 1.14.4+
public void registerTradeList(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -192,7 +192,7 @@ public class ItemRewriter {
}
public void registerAdvancements(ClientboundPacketType packetType, Type<Item> type) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -233,7 +233,7 @@ public class ItemRewriter {
// Not the very best place for this, but has to stay here until *everything* is abstracted
public void registerSpawnParticle(ClientboundPacketType packetType, Type<Item> itemType, Type<?> coordType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Particle ID

Datei anzeigen

@ -86,7 +86,7 @@ public abstract class MetadataRewriter {
//TODO add respawn/join once they stop changing too much
public void registerTracker(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -98,7 +98,7 @@ public abstract class MetadataRewriter {
}
public void registerSpawnTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity id
@ -123,7 +123,7 @@ public abstract class MetadataRewriter {
}
public void registerTracker(ClientboundPacketType packetType, EntityType entityType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -136,7 +136,7 @@ public abstract class MetadataRewriter {
}
public void registerEntityDestroy(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT_ARRAY_PRIMITIVE); // 0 - Entity ids
@ -151,7 +151,7 @@ public abstract class MetadataRewriter {
}
public void registerMetadataRewriter(ClientboundPacketType packetType, @Nullable Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID

Datei anzeigen

@ -45,7 +45,7 @@ public abstract class RecipeRewriter {
}
public void registerDefaultHandler(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -39,7 +39,7 @@ public class SoundRewriter {
// The same for entity sound
public void registerSound(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Sound Id

Datei anzeigen

@ -34,7 +34,7 @@ public class StatisticsRewriter {
}
public void register(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {

Datei anzeigen

@ -75,7 +75,7 @@ public class TagRewriter {
* @param readUntilType read and process the types until (including) the given registry type
*/
public void register(ClientboundPacketType packetType, @Nullable RegistryType readUntilType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(getHandler(readUntilType));
@ -89,7 +89,7 @@ public class TagRewriter {
* @param packetType packet type
*/
public void registerGeneric(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
protocol.registerClientbound(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(getGenericHandler());

Datei anzeigen

@ -40,7 +40,7 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> list) throws Exception {
if (!info.checkIncomingPacket()) {
if (!info.checkServerboundPacket()) {
bytebuf.clear(); // Don't accumulate
throw CancelDecoderException.generate(null);
}
@ -49,7 +49,7 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
try {
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
info.transformServerbound(transformedBuf, CancelDecoderException::generate);
}
try {

Datei anzeigen

@ -60,9 +60,9 @@ public class SpongeEncodeHandler extends MessageToByteEncoder<Object> implements
@Override
public void transform(ByteBuf bytebuf) throws Exception {
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
if (!info.checkClientboundPacket()) throw CancelEncoderException.generate(null);
if (!info.shouldTransformPacket()) return;
info.transformOutgoing(bytebuf, CancelEncoderException::generate);
info.transformClientbound(bytebuf, CancelEncoderException::generate);
}
@Override