3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Merge pull request #1235 from creeper123123321/gerry1.14

19w13b + chunk loading on join fixes
Dieser Commit ist enthalten in:
Myles 2019-03-30 14:07:06 +00:00 committet von GitHub
Commit 796a508af0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
15 geänderte Dateien mit 755 neuen und 699 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -67,7 +67,7 @@ public class ProtocolVersion {
register(v1_13 = new ProtocolVersion(393, "1.13"));
register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
register(v1_14 = new ProtocolVersion(467, "1.14"));
register(v1_14 = new ProtocolVersion(469, "1.14"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}

Datei anzeigen

@ -120,6 +120,13 @@ public class MetadataRewriter {
metadatas.remove(metadata); // TODO "Has target (aggressive state)", maybe moved to pos / entity status
}
}
// TODO Are witch and ravager also abstract illagers? They all inherit the new metadata 14 added in 19w13a
if (type.is(Entity1_14Types.EntityType.WITCH) || type.is(Entity1_14Types.EntityType.RAVAGER) || type.isOrHasParent(Entity1_14Types.EntityType.ABSTRACT_ILLAGER_BASE)) {
if (metadata.getId() >= 14) { // TODO 19w13 added a new boolean with id 14
metadata.setId(metadata.getId() + 1);
}
}
} catch (Exception e) {
metadatas.remove(metadata);
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {

Datei anzeigen

@ -34,7 +34,19 @@ public class Protocol1_14To1_13_2 extends Protocol {
registerOutgoing(State.PLAY, 0x2F, 0x30);
registerOutgoing(State.PLAY, 0x30, 0x31);
registerOutgoing(State.PLAY, 0x31, 0x32);
registerOutgoing(State.PLAY, 0x32, 0x33);
// Position and look
registerOutgoing(State.PLAY, 0x32, 0x33, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.setSentPosAndLook(true);
}
});
}
});
//TODO remove if packet ids stay unchanged in 1.14 release
registerOutgoing(State.PLAY, 0x34, 0x34);
@ -177,7 +189,7 @@ public class Protocol1_14To1_13_2 extends Protocol {
}
});
registerIncoming(State.PLAY, -1, 0x02); //Unknown packet added in 19w11a
registerIncoming(State.PLAY, -1, 0x02); //Set Difficulty packet added in 19w11a
registerIncoming(State.PLAY, 0x02, 0x03);
registerIncoming(State.PLAY, 0x03, 0x04);
registerIncoming(State.PLAY, 0x04, 0x05);
@ -190,7 +202,7 @@ public class Protocol1_14To1_13_2 extends Protocol {
registerIncoming(State.PLAY, 0x0C, 0x0D);
registerIncoming(State.PLAY, 0x0D, 0x0E);
registerIncoming(State.PLAY, -1, 0x0F); //Unknown packet added in 19w11a
registerIncoming(State.PLAY, -1, 0x0F); //Lock Difficulty packet added in 19w11a
registerIncoming(State.PLAY, 0x0E, 0x10);
registerIncoming(State.PLAY, 0x0F, 0x11);
registerIncoming(State.PLAY, 0x10, 0x12);
@ -214,10 +226,12 @@ public class Protocol1_14To1_13_2 extends Protocol {
registerIncoming(State.PLAY, 0x23, 0x25);
registerIncoming(State.PLAY, 0x27, 0x29);
registerIncoming(State.PLAY, 0x28, 0x2A);
registerIncoming(State.PLAY, -1, 0x27); //Unknown packet added in 19w13a
registerIncoming(State.PLAY, 0x2A, 0x2C);
registerIncoming(State.PLAY, 0x27, 0x2A);
registerIncoming(State.PLAY, 0x28, 0x2B);
registerIncoming(State.PLAY, 0x2A, 0x2D);
}
public static int getNewSoundId(int id) {

Datei anzeigen

@ -18,7 +18,7 @@ public class PlayerPackets {
public static void register(Protocol protocol) {
// Open Sign Editor
protocol.registerOutgoing(State.PLAY, 0x2C, 0x2D, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x2C, 0x2E, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
@ -110,7 +110,7 @@ public class PlayerPackets {
});
// Update Structure Block
protocol.registerIncoming(State.PLAY, 0x25, 0x27, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x25, 0x28, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
@ -118,7 +118,7 @@ public class PlayerPackets {
});
// Update Sign
protocol.registerIncoming(State.PLAY, 0x26, 0x28, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x26, 0x29, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
@ -126,7 +126,7 @@ public class PlayerPackets {
});
// Player Block Placement
protocol.registerIncoming(State.PLAY, 0x29, 0x2B, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x29, 0x2C, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

Datei anzeigen

@ -189,7 +189,25 @@ public class WorldPackets {
buf.release();
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
}
lightPacket.send(Protocol1_14To1_13_2.class);
double chunkBlockX = chunk.getX() << 4;
double chunkBlockZ = chunk.getZ() << 4;
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
if (!tracker.isSentPosAndLook()) { // Workaround for 1.13.2 not loading chunks near to world border on join
PacketWrapper fakePosLook = wrapper.create(0x33);
fakePosLook.write(Type.DOUBLE, chunkBlockX);
fakePosLook.write(Type.DOUBLE, 0d); // Y
fakePosLook.write(Type.DOUBLE, chunkBlockZ);
fakePosLook.write(Type.FLOAT, 0f); // Yaw
fakePosLook.write(Type.FLOAT, 0f); // Pitch
fakePosLook.write(Type.BYTE, (byte) 0); // All
fakePosLook.write(Type.VAR_INT, -1); // Confirmation id
fakePosLook.send(Protocol1_14To1_13_2.class, true, true);
tracker.setSentPosAndLook(true);
}
lightPacket.send(Protocol1_14To1_13_2.class, true, false);
}
});
}
@ -299,6 +317,11 @@ public class WorldPackets {
difficultyPacket.write(Type.UNSIGNED_BYTE, difficulty);
difficultyPacket.write(Type.BOOLEAN, false); // Unknown value added in 19w11a
difficultyPacket.send(protocol.getClass());
wrapper.passthrough(Type.UNSIGNED_BYTE); // Max Players
wrapper.passthrough(Type.STRING); // Level Type
wrapper.write(Type.VAR_INT, 64); // Serverside view distance, added in 19w13a
}
});
}

Datei anzeigen

@ -1,6 +1,8 @@
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage;
import com.google.common.base.Optional;
import lombok.Getter;
import lombok.Setter;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_14Types;
@ -11,6 +13,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class EntityTracker extends StoredObject {
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
@Getter
@Setter
private boolean sentPosAndLook;
public EntityTracker(UserConnection user) {
super(user);

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name>

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
<packaging>pom</packaging>
<name>viaversion-parent</name>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>2.0.0-19w12b</version>
<version>2.0.0-19w13b</version>
</parent>
<modelVersion>4.0.0</modelVersion>