3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

add support for 18w32a

Dieser Commit ist enthalten in:
Marco Neuhaus 2018-08-08 18:58:25 +02:00
Ursprung 58b30341ee
Commit 6cfb21f660
4 geänderte Dateien mit 19 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -19,7 +19,7 @@ import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1TO1_9;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3TO1_9_1_2;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_9_1.Protocol1_9TO1_9_1;
import us.myles.ViaVersion.protocols.protocol18w31ato1_13.Protocol18w31aTO1_13;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.Protocol18w32aTO1_13;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -57,7 +57,7 @@ public class ProtocolRegistry {
// 1.13 support in development! (:
registerProtocol(new Protocol1_13To1_12_2(), Collections.singletonList(ProtocolVersion.v1_13.getId()), ProtocolVersion.v1_12_2.getId());
registerProtocol(new Protocol18w31aTO1_13(), Arrays.asList(ProtocolVersion.v18w31a.getId()), ProtocolVersion.v1_13.getId());
registerProtocol(new Protocol18w32aTO1_13(), Arrays.asList(ProtocolVersion.v18w32a.getId()), ProtocolVersion.v1_13.getId());
}
/**

Datei anzeigen

@ -34,7 +34,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_12_2;
// v1_13 as name for better ViaBackwards compatibility.
public static final ProtocolVersion v1_13;
public static final ProtocolVersion v18w31a;
public static final ProtocolVersion v18w32a;
public static final ProtocolVersion unknown;
private final int id;
@ -64,7 +64,7 @@ public class ProtocolVersion {
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
register(v1_13 = new ProtocolVersion(393, "1.13"));
register(v18w31a = new ProtocolVersion(396, "18w31a"));
register(v18w32a = new ProtocolVersion(397, "18w32a"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w31ato1_13;
package us.myles.ViaVersion.protocols.protocol18w32ato1_13;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
@ -17,13 +17,13 @@ public class MetadataRewriter {
if (metadata.getMetaType() == MetaType1_13.BlockID) {
// Convert to new block id
int data = (int) metadata.getValue();
metadata.setValue(Protocol18w31aTO1_13.getMapBlockId(data));
metadata.setValue(Protocol18w32aTO1_13.getMapBlockId(data));
}
if(type == null) continue;
if (type.isOrHasParent(Entity1_13Types.EntityType.MINECART_ABSTRACT) && metadata.getId() == 9) {
// New block format
int data = (int) metadata.getValue();
metadata.setValue(Protocol18w31aTO1_13.getMapBlockId(data));
metadata.setValue(Protocol18w32aTO1_13.getMapBlockId(data));
}
} catch (Exception e) {
metadatas.remove(metadata);

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w31ato1_13;
package us.myles.ViaVersion.protocols.protocol18w32ato1_13;
import com.google.common.base.Optional;
import us.myles.ViaVersion.api.PacketWrapper;
@ -18,7 +18,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
public class Protocol18w31aTO1_13 extends Protocol {
public class Protocol18w32aTO1_13 extends Protocol {
@Override
protected void registerPackets() {
@ -351,12 +351,17 @@ public class Protocol18w31aTO1_13 extends Protocol {
}
public static int getMapBlockId(int blockId){
if(blockId > 8573){
return blockId +2;
}else if(blockId > 1126){
return blockId +1;
public static int getMapBlockId(int blockId) {
if (blockId > 8573) {
blockId += 17;
} else if (blockId > 8463) {
blockId += 16;
} else if (blockId > 8458) {
blockId = 8470 + (blockId - 8459) * 2;
} else if (blockId > 1126) {
blockId += 1;
}
return blockId;
}
}