3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Expand the remapping stuff.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-30 20:49:43 -04:00
Ursprung 6b5cd703f0
Commit 515248fa99
3 geänderte Dateien mit 44 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -24,6 +24,6 @@ public interface EntityIdRemapper {
void setServerEntityId(int id); void setServerEntityId(int id);
static EntityIdRemapper getMapper(int eid, int protocolVersion) { static EntityIdRemapper getMapper(int eid, int protocolVersion) {
return DummyEntityIdRemapper.INSTANCE; return NoopEntityIdRemapper.INSTANCE;
} }
} }

Datei anzeigen

@ -0,0 +1,40 @@
package com.velocitypowered.proxy.protocol.remap;
import com.velocitypowered.proxy.protocol.ProtocolConstants;
import io.netty.buffer.ByteBuf;
public class Minecraft18EntityIdRemapper implements EntityIdRemapper {
private final int clientId;
private int serverId;
public Minecraft18EntityIdRemapper(int clientId, int serverId) {
this.clientId = clientId;
this.serverId = serverId;
}
@Override
public ByteBuf remap(ByteBuf original, ProtocolConstants.Direction direction) {
if (clientId == serverId) {
// If these are equal (i.e. first connection), no remapping is required.
return original.retain();
}
// TODO: Implement.
throw new UnsupportedOperationException("1.8 doesn't allow switching servers.");
}
@Override
public int getClientEntityId() {
return clientId;
}
@Override
public int getServerEntityId() {
return serverId;
}
@Override
public void setServerEntityId(int id) {
this.serverId = id;
}
}

Datei anzeigen

@ -3,10 +3,10 @@ package com.velocitypowered.proxy.protocol.remap;
import com.velocitypowered.proxy.protocol.ProtocolConstants; import com.velocitypowered.proxy.protocol.ProtocolConstants;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class DummyEntityIdRemapper implements EntityIdRemapper { public class NoopEntityIdRemapper implements EntityIdRemapper {
public static final DummyEntityIdRemapper INSTANCE = new DummyEntityIdRemapper(); public static final NoopEntityIdRemapper INSTANCE = new NoopEntityIdRemapper();
private DummyEntityIdRemapper() { private NoopEntityIdRemapper() {
} }