Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Commit
b5e7434c9a
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -48,7 +48,7 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a protocol to the current pipeline
|
* Add a protocol to the current pipeline
|
||||||
* This will call the .init method.
|
* This will call the Protocol#init method.
|
||||||
*
|
*
|
||||||
* @param protocol The protocol to add to the end
|
* @param protocol The protocol to add to the end
|
||||||
*/
|
*/
|
||||||
@ -56,6 +56,9 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
if (protocolList != null) {
|
if (protocolList != null) {
|
||||||
protocolList.add(protocol);
|
protocolList.add(protocol);
|
||||||
protocol.init(userConnection);
|
protocol.init(userConnection);
|
||||||
|
// Move BaseProtocol to end, so the login packets can be modified by other protocols
|
||||||
|
protocolList.remove(ProtocolRegistry.BASE_PROTOCOL);
|
||||||
|
protocolList.add(ProtocolRegistry.BASE_PROTOCOL);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Tried to add protocol to early");
|
throw new NullPointerException("Tried to add protocol to early");
|
||||||
}
|
}
|
||||||
@ -71,19 +74,21 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
|
|
||||||
// Apply protocols
|
// Apply protocols
|
||||||
packetWrapper.apply(direction, state, 0, protocols);
|
packetWrapper.apply(direction, state, 0, protocols);
|
||||||
|
|
||||||
super.transform(direction, state, packetWrapper);
|
super.transform(direction, state, packetWrapper);
|
||||||
|
|
||||||
if (Via.getManager().isDebug()) {
|
if (Via.getManager().isDebug()) {
|
||||||
// Debug packet
|
// Debug packet
|
||||||
String packet = "UNKNOWN";
|
String packet = "UNKNOWN";
|
||||||
|
|
||||||
// For 1.8/1.9 server version, eventually we'll probably get an API for this...
|
|
||||||
if (ProtocolRegistry.SERVER_PROTOCOL >= ProtocolVersion.v1_8.getId() &&
|
|
||||||
ProtocolRegistry.SERVER_PROTOCOL <= ProtocolVersion.v1_9_3.getId()) {
|
|
||||||
|
|
||||||
|
int serverProtocol = userConnection.get(ProtocolInfo.class).getServerProtocolVersion();
|
||||||
|
int clientProtocol = userConnection.get(ProtocolInfo.class).getProtocolVersion();
|
||||||
|
|
||||||
|
// For 1.8/1.9 server version, eventually we'll probably get an API for this...
|
||||||
|
if (serverProtocol >= ProtocolVersion.v1_8.getId() &&
|
||||||
|
serverProtocol <= ProtocolVersion.v1_9_3.getId()) {
|
||||||
PacketType type;
|
PacketType type;
|
||||||
if (ProtocolRegistry.SERVER_PROTOCOL <= ProtocolVersion.v1_8.getId()) {
|
if (serverProtocol <= ProtocolVersion.v1_8.getId()) {
|
||||||
if (direction == Direction.INCOMING) {
|
if (direction == Direction.INCOMING) {
|
||||||
type = PacketType.findNewPacket(state, direction, originalID);
|
type = PacketType.findNewPacket(state, direction, originalID);
|
||||||
} else {
|
} else {
|
||||||
@ -108,7 +113,7 @@ public class ProtocolPipeline extends Protocol {
|
|||||||
packet = type.name();
|
packet = type.name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String name = packet + "[" + userConnection.get(ProtocolInfo.class).getProtocolVersion() + "]";
|
String name = packet + "[" + clientProtocol + "]";
|
||||||
ViaPlatform platform = Via.getPlatform();
|
ViaPlatform platform = Via.getPlatform();
|
||||||
|
|
||||||
String actualUsername = packetWrapper.user().get(ProtocolInfo.class).getUsername();
|
String actualUsername = packetWrapper.user().get(ProtocolInfo.class).getUsername();
|
||||||
|
@ -62,7 +62,7 @@ public class ProtocolVersion {
|
|||||||
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
||||||
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
||||||
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
||||||
register(v1_13 = new ProtocolVersion(383, "1.13-pre1"));
|
register(v1_13 = new ProtocolVersion(387, "1.13-pre5"));
|
||||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
|
|||||||
/* Variable Types */
|
/* Variable Types */
|
||||||
public static final Type<Integer> VAR_INT = new VarIntType();
|
public static final Type<Integer> VAR_INT = new VarIntType();
|
||||||
public static final Type<Integer[]> VAR_INT_ARRAY = new ArrayType<>(Type.VAR_INT);
|
public static final Type<Integer[]> VAR_INT_ARRAY = new ArrayType<>(Type.VAR_INT);
|
||||||
|
public static final Type<Long> VAR_LONG = new VarLongType();
|
||||||
|
public static final Type<Long[]> VAR_LONG_ARRAY = new ArrayType<>(Type.VAR_LONG);
|
||||||
/* Special Types */
|
/* Special Types */
|
||||||
public static final Type<Void> NOTHING = new VoidType(); // This is purely used for remapping.
|
public static final Type<Void> NOTHING = new VoidType(); // This is purely used for remapping.
|
||||||
/* MC Types */
|
/* MC Types */
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
package us.myles.ViaVersion.api.type.types;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.TypeConverter;
|
||||||
|
|
||||||
|
public class VarLongType extends Type<Long> implements TypeConverter<Long> {
|
||||||
|
|
||||||
|
public VarLongType() {
|
||||||
|
super("VarLong", Long.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buffer, Long object) {
|
||||||
|
int part;
|
||||||
|
while (true) {
|
||||||
|
part = (int) (object & 0x7F);
|
||||||
|
|
||||||
|
object >>>= 7;
|
||||||
|
if (object != 0) {
|
||||||
|
part |= 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.writeByte(part);
|
||||||
|
|
||||||
|
if (object == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long read(ByteBuf buffer) {
|
||||||
|
long out = 0;
|
||||||
|
int bytes = 0;
|
||||||
|
byte in;
|
||||||
|
while (true) {
|
||||||
|
in = buffer.readByte();
|
||||||
|
|
||||||
|
out |= (in & 0x7F) << (bytes++ * 7);
|
||||||
|
|
||||||
|
if (bytes > 10) { // 10 is maxBytes
|
||||||
|
throw new RuntimeException("VarLong too big");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((in & 0x80) != 0x80) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long from(Object o) {
|
||||||
|
if (o instanceof Number) {
|
||||||
|
return ((Number) o).longValue();
|
||||||
|
}
|
||||||
|
if (o instanceof Boolean) {
|
||||||
|
return ((Boolean) o) ? 1L : 0L;
|
||||||
|
}
|
||||||
|
return (Long) o;
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
// TODO Make it work on 1.13 servers
|
||||||
public class BaseProtocol extends Protocol {
|
public class BaseProtocol extends Protocol {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -177,6 +178,7 @@ public class BaseProtocol extends Protocol {
|
|||||||
}
|
}
|
||||||
// Choose the pipe
|
// Choose the pipe
|
||||||
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
||||||
|
info.setServerProtocolVersion(protocol);
|
||||||
List<Pair<Integer, Protocol>> protocols = null;
|
List<Pair<Integer, Protocol>> protocols = null;
|
||||||
|
|
||||||
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
|
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
|
||||||
@ -259,7 +261,7 @@ public class BaseProtocol extends Protocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String addDashes(String trimmedUUID) {
|
public static String addDashes(String trimmedUUID) {
|
||||||
StringBuffer idBuff = new StringBuffer(trimmedUUID);
|
StringBuilder idBuff = new StringBuilder(trimmedUUID);
|
||||||
idBuff.insert(20, '-');
|
idBuff.insert(20, '-');
|
||||||
idBuff.insert(16, '-');
|
idBuff.insert(16, '-');
|
||||||
idBuff.insert(12, '-');
|
idBuff.insert(12, '-');
|
||||||
|
@ -14,6 +14,7 @@ import java.util.UUID;
|
|||||||
public class ProtocolInfo extends StoredObject {
|
public class ProtocolInfo extends StoredObject {
|
||||||
private State state = State.HANDSHAKE;
|
private State state = State.HANDSHAKE;
|
||||||
private int protocolVersion = -1;
|
private int protocolVersion = -1;
|
||||||
|
private int serverProtocolVersion = -1;
|
||||||
private String username;
|
private String username;
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private ProtocolPipeline pipeline;
|
private ProtocolPipeline pipeline;
|
||||||
|
@ -5,6 +5,8 @@ import net.md_5.bungee.chat.ComponentSerializer;
|
|||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_13Types;
|
import us.myles.ViaVersion.api.entities.Entity1_13Types;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.platform.providers.ViaProviders;
|
import us.myles.ViaVersion.api.platform.providers.ViaProviders;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
@ -23,7 +25,7 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.Painting
|
|||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.EntityTracker;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.EntityTracker;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.TabCompleteTracker;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.TabCompleteTracker;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.type.Particle1_13Type;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.types.Particle1_13Type;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -37,6 +39,16 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final PacketHandler POS_TO_3_INT = new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
Position position = wrapper.read(Type.POSITION);
|
||||||
|
wrapper.write(Type.INT, position.getX().intValue());
|
||||||
|
wrapper.write(Type.INT, position.getY().intValue());
|
||||||
|
wrapper.write(Type.INT, position.getZ().intValue());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MappingData.init();
|
MappingData.init();
|
||||||
}
|
}
|
||||||
@ -54,6 +66,12 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
|
|
||||||
// Outgoing packets
|
// Outgoing packets
|
||||||
|
|
||||||
|
// New packet 0x0 - Login Plugin Message
|
||||||
|
registerOutgoing(State.LOGIN, 0x0, 0x1);
|
||||||
|
registerOutgoing(State.LOGIN, 0x1, 0x2);
|
||||||
|
registerOutgoing(State.LOGIN, 0x2, 0x3);
|
||||||
|
registerOutgoing(State.LOGIN, 0x3, 0x4);
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
registerOutgoing(State.PLAY, 0x07, 0x07, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x07, 0x07, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
@ -406,6 +424,22 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
// New packet 0x53 - Tags
|
// New packet 0x53 - Tags
|
||||||
|
|
||||||
// Incoming packets
|
// Incoming packets
|
||||||
|
|
||||||
|
// New packet 0x0 - Login Plugin Message
|
||||||
|
registerIncoming(State.LOGIN, -1, 0x0, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registerIncoming(State.LOGIN, 0x0, 0x1);
|
||||||
|
registerIncoming(State.LOGIN, 0x1, 0x2);
|
||||||
|
|
||||||
registerIncoming(State.PLAY, 0x2, 0x1);
|
registerIncoming(State.PLAY, 0x2, 0x1);
|
||||||
registerIncoming(State.PLAY, 0x3, 0x2);
|
registerIncoming(State.PLAY, 0x3, 0x2);
|
||||||
registerIncoming(State.PLAY, 0x4, 0x3);
|
registerIncoming(State.PLAY, 0x4, 0x3);
|
||||||
@ -441,8 +475,47 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// New 0x0A - Edit book -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x0a, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
Item item = wrapper.read(Type.FLAT_ITEM);
|
||||||
|
boolean isSigning = wrapper.read(Type.BOOLEAN);
|
||||||
|
|
||||||
|
InventoryPackets.toServer(item);
|
||||||
|
|
||||||
|
wrapper.write(Type.STRING, isSigning ? "MC|BSign" : "MC|BEdit"); // Channel
|
||||||
|
wrapper.write(Type.ITEM, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registerIncoming(State.PLAY, 0x0b, 0x0c);
|
||||||
|
registerIncoming(State.PLAY, 0x0A, 0x0B);
|
||||||
|
registerIncoming(State.PLAY, 0x0c, 0x0d);
|
||||||
|
registerIncoming(State.PLAY, 0x0d, 0x0e);
|
||||||
|
registerIncoming(State.PLAY, 0x0e, 0x0f);
|
||||||
|
registerIncoming(State.PLAY, 0x0f, 0x10);
|
||||||
|
registerIncoming(State.PLAY, 0x10, 0x11);
|
||||||
|
registerIncoming(State.PLAY, 0x11, 0x12);
|
||||||
|
// New 0x13 - Pick Item -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x13, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|PickItem"); // Channel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Craft recipe request
|
// Craft recipe request
|
||||||
registerIncoming(State.PLAY, 0x12, 0x12, new PacketRemapper() {
|
registerIncoming(State.PLAY, 0x12, 0x14, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@ -455,8 +528,12 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerIncoming(State.PLAY, 0x13, 0x15);
|
||||||
|
registerIncoming(State.PLAY, 0x14, 0x16);
|
||||||
|
registerIncoming(State.PLAY, 0x15, 0x17);
|
||||||
|
registerIncoming(State.PLAY, 0x16, 0x18);
|
||||||
// Recipe Book Data
|
// Recipe Book Data
|
||||||
registerIncoming(State.PLAY, 0x17, 0x17, new PacketRemapper() {
|
registerIncoming(State.PLAY, 0x17, 0x19, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Type
|
map(Type.VAR_INT); // 0 - Type
|
||||||
@ -476,6 +553,173 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// New 0x1A - Name Item -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x1A, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|ItemName"); // Channel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerIncoming(State.PLAY, 0x18, 0x1B);
|
||||||
|
registerIncoming(State.PLAY, 0x19, 0x1C);
|
||||||
|
|
||||||
|
// New 0x1D - Select Trade -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x1D, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|TrSel"); // Channel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.VAR_INT, Type.INT); // Slot
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// New 0x1E - Set Beacon Effect -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x1E, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|Beacon"); // Channel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.VAR_INT, Type.INT); // Primary Effect
|
||||||
|
map(Type.VAR_INT, Type.INT); // Secondary Effect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerIncoming(State.PLAY, 0x1A, 0x1F);
|
||||||
|
|
||||||
|
// New 0x20 - Update Command Block -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x20, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|AutoCmd");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
handler(POS_TO_3_INT);
|
||||||
|
map(Type.STRING); // Command
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
int mode = wrapper.read(Type.VAR_INT);
|
||||||
|
byte flags = wrapper.read(Type.BYTE);
|
||||||
|
|
||||||
|
String stringMode = mode == 0 ? "SEQUENCE"
|
||||||
|
: mode == 1 ? "AUTO"
|
||||||
|
: "REDSTONE";
|
||||||
|
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x1) != 0); // Track output
|
||||||
|
wrapper.write(Type.STRING, stringMode);
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x2) != 0); // Is conditional
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x4) != 0); // Automatic
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// New 0x21 - Update Command Block Minecart -> Plugin Message
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x21, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|AdvCmd");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.VAR_INT, Type.INT); // Entity Id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 0x1B -> 0x22 in InventoryPackets
|
||||||
|
|
||||||
|
// New 0x23 - Update Structure Block -> Message Channel
|
||||||
|
registerIncoming(State.PLAY, 0x09, 0x23, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
create(new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.STRING, "MC|Struct"); // Channel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
handler(POS_TO_3_INT);
|
||||||
|
map(Type.VAR_INT, new ValueTransformer<Integer, Byte>(Type.BYTE) { // Action
|
||||||
|
@Override
|
||||||
|
public Byte transform(PacketWrapper wrapper, Integer action) throws Exception {
|
||||||
|
return (byte) (action + 1);
|
||||||
|
}
|
||||||
|
}); // Action
|
||||||
|
map(Type.VAR_INT, new ValueTransformer<Integer, String>(Type.STRING) {
|
||||||
|
@Override
|
||||||
|
public String transform(PacketWrapper wrapper, Integer mode) throws Exception {
|
||||||
|
return mode == 0 ? "SAVE"
|
||||||
|
: mode == 1 ? "LOAD"
|
||||||
|
: mode == 2 ? "CORNER"
|
||||||
|
: "DATA";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.STRING); // Name
|
||||||
|
map(Type.BYTE, Type.INT); // Offset X
|
||||||
|
map(Type.BYTE, Type.INT); // Offset Y
|
||||||
|
map(Type.BYTE, Type.INT); // Offset Z
|
||||||
|
map(Type.BYTE, Type.INT); // Size X
|
||||||
|
map(Type.BYTE, Type.INT); // Size Y
|
||||||
|
map(Type.BYTE, Type.INT); // Size Z
|
||||||
|
map(Type.VAR_INT, new ValueTransformer<Integer, String>(Type.STRING) { // Mirror
|
||||||
|
@Override
|
||||||
|
public String transform(PacketWrapper wrapper, Integer mirror) throws Exception {
|
||||||
|
return mirror == 0 ? "NONE"
|
||||||
|
: mirror == 1 ? "LEFT_RIGHT"
|
||||||
|
: "FRONT_BACK";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.VAR_INT, new ValueTransformer<Integer, String>(Type.STRING) { // Rotation
|
||||||
|
@Override
|
||||||
|
public String transform(PacketWrapper wrapper, Integer rotation) throws Exception {
|
||||||
|
return rotation == 0 ? "NONE"
|
||||||
|
: rotation == 1 ? "CLOCKWISE_90"
|
||||||
|
: rotation == 2 ? "CLOCKWISE_180"
|
||||||
|
: "COUNTERCLOCKWISE_90";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map(Type.STRING);
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
float integrity = wrapper.read(Type.FLOAT);
|
||||||
|
long seed = wrapper.read(Type.VAR_LONG);
|
||||||
|
byte flags = wrapper.read(Type.BYTE);
|
||||||
|
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x1) != 0); // Ignore Entities
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x2) != 0); // Show air
|
||||||
|
wrapper.write(Type.BOOLEAN, (flags & 0x4) != 0); // Show bounding box
|
||||||
|
wrapper.write(Type.FLOAT, integrity);
|
||||||
|
wrapper.write(Type.VAR_LONG, seed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerIncoming(State.PLAY, 0x1C, 0x24);
|
||||||
|
registerIncoming(State.PLAY, 0x1D, 0x25);
|
||||||
|
registerIncoming(State.PLAY, 0x1E, 0x26);
|
||||||
|
registerIncoming(State.PLAY, 0x1F, 0x27);
|
||||||
|
registerIncoming(State.PLAY, 0x20, 0x28);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets;
|
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.*;
|
import com.github.steveice10.opennbt.tag.builtin.*;
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
@ -14,7 +15,9 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.MappingData;
|
|||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.SoundSource;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.SoundSource;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.SpawnEggRewriter;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.SpawnEggRewriter;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InventoryPackets {
|
public class InventoryPackets {
|
||||||
private static String NBT_TAG_NAME;
|
private static String NBT_TAG_NAME;
|
||||||
@ -100,35 +103,54 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wrapper.set(Type.BYTE, 0, flags); // Update flags
|
wrapper.set(Type.BYTE, 0, flags); // Update flags
|
||||||
}
|
return;
|
||||||
if (channel.equalsIgnoreCase("MC|TrList")) {
|
} else if (channel.equalsIgnoreCase("MC|TrList")) {
|
||||||
|
channel = "minecraft:trader_list";
|
||||||
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
wrapper.passthrough(Type.INT); // Passthrough Window ID
|
||||||
|
|
||||||
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
// Input Item
|
// Input Item
|
||||||
Item input = wrapper.read(Type.ITEM);
|
Item input = wrapper.passthrough(Type.ITEM);
|
||||||
toClient(input);
|
InventoryPackets.toClient(input);
|
||||||
wrapper.write(Type.ITEM, input);
|
|
||||||
// Output Item
|
// Output Item
|
||||||
Item output = wrapper.read(Type.ITEM);
|
Item output = wrapper.passthrough(Type.ITEM);
|
||||||
toClient(output);
|
InventoryPackets.toClient(output);
|
||||||
wrapper.write(Type.ITEM, output);
|
|
||||||
|
|
||||||
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
boolean secondItem = wrapper.passthrough(Type.BOOLEAN); // Has second item
|
||||||
if (secondItem) {
|
if (secondItem) {
|
||||||
// Second Item
|
// Second Item
|
||||||
Item second = wrapper.read(Type.ITEM);
|
Item second = wrapper.passthrough(Type.ITEM);
|
||||||
toClient(second);
|
InventoryPackets.toClient(second);
|
||||||
wrapper.write(Type.ITEM, second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||||
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
wrapper.passthrough(Type.INT); // Maximum number of trade uses
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
String originalChannel = channel;
|
||||||
|
channel = getNewPluginChannelId(channel).orNull();
|
||||||
|
if (channel == null) {
|
||||||
|
System.out.println("Plugin message cancelled " + originalChannel); // TODO remove this debug
|
||||||
|
wrapper.cancel();
|
||||||
|
return;
|
||||||
|
} else if (channel.equals("minecraft:register") || channel.equals("minecraft:unregister")) {
|
||||||
|
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
||||||
|
List<String> rewrittenChannels = new ArrayList<>();
|
||||||
|
for (int i = 0; i < channels.length; i++) {
|
||||||
|
String rewritten = getNewPluginChannelId(channels[i]).orNull();
|
||||||
|
if (rewritten != null)
|
||||||
|
rewrittenChannels.add(rewritten);
|
||||||
|
else
|
||||||
|
System.out.println("Ignoring plugin channel in REGISTER: " + channels[i]);
|
||||||
|
}
|
||||||
|
wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
wrapper.set(Type.STRING, 0, channel);
|
||||||
}
|
}
|
||||||
|
// TODO Fix trading GUI
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -179,7 +201,7 @@ public class InventoryPackets {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Creative Inventory Action
|
// Creative Inventory Action
|
||||||
protocol.registerIncoming(State.PLAY, 0x1B, 0x1B, new PacketRemapper() {
|
protocol.registerIncoming(State.PLAY, 0x1B, 0x22, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.SHORT); // 0 - Slot
|
map(Type.SHORT); // 0 - Slot
|
||||||
@ -198,6 +220,7 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO CLEANUP / SMARTER REWRITE SYSTEM
|
// TODO CLEANUP / SMARTER REWRITE SYSTEM
|
||||||
|
// TODO Rewrite identifiers
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
|
|
||||||
@ -420,4 +443,22 @@ public class InventoryPackets {
|
|||||||
|| id == 442 // shield
|
|| id == 442 // shield
|
||||||
|| id == 443; // elytra
|
|| id == 443; // elytra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Optional<String> getNewPluginChannelId(String old) {
|
||||||
|
if (old.equalsIgnoreCase("MC|TrList"))
|
||||||
|
return Optional.of("minecraft:trader_list");
|
||||||
|
if (old.equalsIgnoreCase("MC|Brand"))
|
||||||
|
return Optional.of("minecraft:brand");
|
||||||
|
if (old.equalsIgnoreCase("MC|BOpen"))
|
||||||
|
return Optional.of("minecraft:book_open");
|
||||||
|
if (old.equalsIgnoreCase("MC|DebugPath"))
|
||||||
|
return Optional.of("minecraft:debug/paths");
|
||||||
|
if (old.equalsIgnoreCase("MC|DebugNeighborsUpdate"))
|
||||||
|
return Optional.of("minecraft:debug/neighbors_update");
|
||||||
|
if (old.equalsIgnoreCase("REGISTER"))
|
||||||
|
return Optional.of("minecraft:register");
|
||||||
|
if (old.equalsIgnoreCase("UNREGISTER"))
|
||||||
|
return Optional.of("minecraft:unregister");
|
||||||
|
return Optional.absent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.ParticleRewri
|
|||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEntityProvider;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEntityProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.PaintingProvider;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.PaintingProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.type.Chunk1_13Type;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.types.Chunk1_13Type;
|
||||||
|
|
||||||
public class WorldPackets {
|
public class WorldPackets {
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
@ -8,11 +8,11 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEnt
|
|||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||||
|
|
||||||
public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
|
public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||||
private final int WALL_BANNER_START = 7092; // 4 each
|
private final int WALL_BANNER_START = 7110; // 4 each
|
||||||
private final int WALL_BANNER_STOP = 7155;
|
private final int WALL_BANNER_STOP = 7173;
|
||||||
|
|
||||||
private final int BANNER_START = 6836; // 16 each
|
private final int BANNER_START = 6854; // 16 each
|
||||||
private final int BANNER_STOP = 7091;
|
private final int BANNER_STOP = 7109;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int transform(UserConnection user, CompoundTag tag) {
|
public int transform(UserConnection user, CompoundTag tag) {
|
||||||
|
@ -20,7 +20,7 @@ public class BedHandler implements BlockEntityProvider.BlockEntityHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RED_BED + FIRST_BED
|
// RED_BED + FIRST_BED
|
||||||
int blockId = storage.get(position).getOriginal() - 954 + 730;
|
int blockId = storage.get(position).getOriginal() - 972 + 748;
|
||||||
|
|
||||||
int color = (int) tag.get("color").getValue();
|
int color = (int) tag.get("color").getValue();
|
||||||
blockId += (color * 16);
|
blockId += (color * 16);
|
||||||
|
@ -12,28 +12,28 @@ public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler
|
|||||||
private static final Map<Pair<String, Integer>, Integer> flowers = new ConcurrentHashMap<>();
|
private static final Map<Pair<String, Integer>, Integer> flowers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
register("minecraft:air", 0, 5247);
|
register("minecraft:air", 0, 5265);
|
||||||
register("minecraft:sapling", 0, 5248);
|
register("minecraft:sapling", 0, 5266);
|
||||||
register("minecraft:sapling", 1, 5249);
|
register("minecraft:sapling", 1, 5267);
|
||||||
register("minecraft:sapling", 2, 5250);
|
register("minecraft:sapling", 2, 5268);
|
||||||
register("minecraft:sapling", 3, 5251);
|
register("minecraft:sapling", 3, 5269);
|
||||||
register("minecraft:sapling", 4, 5252);
|
register("minecraft:sapling", 4, 5270);
|
||||||
register("minecraft:sapling", 5, 5253);
|
register("minecraft:sapling", 5, 5271);
|
||||||
register("minecraft:tallgrass", 2, 5254);
|
register("minecraft:tallgrass", 2, 5272);
|
||||||
register("minecraft:yellow_flower", 0, 5255);
|
register("minecraft:yellow_flower", 0, 5273);
|
||||||
register("minecraft:red_flower", 0, 5256);
|
register("minecraft:red_flower", 0, 5274);
|
||||||
register("minecraft:red_flower", 1, 5257);
|
register("minecraft:red_flower", 1, 5275);
|
||||||
register("minecraft:red_flower", 2, 5258);
|
register("minecraft:red_flower", 2, 5276);
|
||||||
register("minecraft:red_flower", 3, 5259);
|
register("minecraft:red_flower", 3, 5277);
|
||||||
register("minecraft:red_flower", 4, 5260);
|
register("minecraft:red_flower", 4, 5278);
|
||||||
register("minecraft:red_flower", 5, 5261);
|
register("minecraft:red_flower", 5, 5279);
|
||||||
register("minecraft:red_flower", 6, 5262);
|
register("minecraft:red_flower", 6, 5280);
|
||||||
register("minecraft:red_flower", 7, 5263);
|
register("minecraft:red_flower", 7, 5281);
|
||||||
register("minecraft:red_flower", 8, 5264);
|
register("minecraft:red_flower", 8, 5282);
|
||||||
register("minecraft:red_mushroom", 0, 5265);
|
register("minecraft:red_mushroom", 0, 5283);
|
||||||
register("minecraft:brown_mushroom", 0, 5266);
|
register("minecraft:brown_mushroom", 0, 5284);
|
||||||
register("minecraft:deadbush", 0, 5267);
|
register("minecraft:deadbush", 0, 5285);
|
||||||
register("minecraft:cactus", 0, 5268);
|
register("minecraft:cactus", 0, 5286);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEnt
|
|||||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||||
|
|
||||||
public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
|
public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||||
private final int SKULL_WALL_START = 5429;
|
private final int SKULL_WALL_START = 5447;
|
||||||
private final int SKULL_END = 5548;
|
private final int SKULL_END = 5566;
|
||||||
@Override
|
@Override
|
||||||
public int transform(UserConnection user, CompoundTag tag) {
|
public int transform(UserConnection user, CompoundTag tag) {
|
||||||
BlockStorage storage = user.get(BlockStorage.class);
|
BlockStorage storage = user.get(BlockStorage.class);
|
||||||
|
@ -17,24 +17,24 @@ public class BlockStorage extends StoredObject {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
// Flower pots
|
// Flower pots
|
||||||
whitelist.add(5247);
|
whitelist.add(5266);
|
||||||
|
|
||||||
// Add those red beds
|
// Add those red beds
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
whitelist.add(954 + i);
|
whitelist.add(972 + i);
|
||||||
|
|
||||||
// Add the white banners
|
// Add the white banners
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
whitelist.add(6836 + i);
|
whitelist.add(6854 + i);
|
||||||
|
|
||||||
// Add the white wall banners
|
// Add the white wall banners
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
whitelist.add(7092 + i);
|
whitelist.add(7110 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skeleton skulls
|
// Skeleton skulls
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
whitelist.add(5429 + i);
|
whitelist.add(5447 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Position, ReplacementData> blocks = new ConcurrentHashMap<>();
|
private Map<Position, ReplacementData> blocks = new ConcurrentHashMap<>();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.type;
|
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.types;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -19,6 +19,7 @@ import java.util.Arrays;
|
|||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// todo 1.13-pre2 direct pallete changes
|
||||||
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
||||||
public Chunk1_13Type(ClientWorld param) {
|
public Chunk1_13Type(ClientWorld param) {
|
||||||
super(param, Chunk.class);
|
super(param, Chunk.class);
|
||||||
@ -57,6 +58,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
byte[] biomeData = groundUp ? new byte[256] : null;
|
byte[] biomeData = groundUp ? new byte[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
for (int i = 0; i < 256; i++){
|
for (int i = 0; i < 256; i++){
|
||||||
|
// todo use int in Chunk?
|
||||||
biomeData[i] = (byte) input.readInt();
|
biomeData[i] = (byte) input.readInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.type;
|
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.types;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>viaversion-jar</name>
|
<name>viaversion-jar</name>
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>viaversion-parent</name>
|
<name>viaversion-parent</name>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre1</version>
|
<version>1.4.0-1.13-pre5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class SpongeCommandHandler extends ViaCommandHandler implements CommandCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSuggestions(CommandSource source, String arguments) throws CommandException {
|
public List<String> getSuggestions(CommandSource source, String arguments) throws CommandException {
|
||||||
String[] args = arguments.length() > 0 ? arguments.split(" ") : new String[0];
|
String[] args = arguments.split(" "); // ViaCommandHandler handles empty String in array
|
||||||
return onTabComplete(new SpongeCommandSender(source), args);
|
return onTabComplete(new SpongeCommandSender(source), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren