add support for 1.13.1-pre1

This commit is contained in:
Marco Neuhaus 2018-08-16 22:38:22 +02:00
parent 9ec8e2daf7
commit 3b48f11f7b
14 changed files with 33 additions and 33 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -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.protocol18w32ato1_13.Protocol18w32aTO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.Protocol13_1_PRE1TO1_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 Protocol18w32aTO1_13(), Arrays.asList(ProtocolVersion.v18w32a.getId()), ProtocolVersion.v1_13.getId());
registerProtocol(new Protocol13_1_PRE1TO1_13(), Arrays.asList(ProtocolVersion.v1_13_1_pre1.getId()), ProtocolVersion.v1_13.getId());
}
/**

View File

@ -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 v18w32a;
public static final ProtocolVersion v1_13_1_pre1;
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(v18w32a = new ProtocolVersion(397, "18w32a"));
register(v1_13_1_pre1 = new ProtocolVersion(399, "1.13.1-pre1"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}

View File

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w32ato1_13;
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
@ -7,7 +7,7 @@ import us.myles.ViaVersion.api.entities.Entity1_13Types.EntityType;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets.InventoryPackets;
import java.util.ArrayList;
import java.util.List;
@ -23,13 +23,13 @@ public class MetadataRewriter {
} else if (metadata.getMetaType() == MetaType1_13.BlockID) {
// Convert to new block id
int data = (int) metadata.getValue();
metadata.setValue(Protocol18w32aTO1_13.getNewBlockStateId(data));
metadata.setValue(Protocol13_1_PRE1TO1_13.getNewBlockStateId(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(Protocol18w32aTO1_13.getNewBlockStateId(data));
metadata.setValue(Protocol13_1_PRE1TO1_13.getNewBlockStateId(data));
}
if(type.is(EntityType.ITEM)){

View File

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w32ato1_13;
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
@ -8,13 +8,13 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets.WorldPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets.WorldPackets;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
public class Protocol18w32aTO1_13 extends Protocol {
public class Protocol13_1_PRE1TO1_13 extends Protocol {
@Override
protected void registerPackets() {

View File

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets;
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
import com.google.common.base.Optional;
import us.myles.ViaVersion.api.PacketWrapper;
@ -10,9 +10,9 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_13;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.Protocol18w32aTO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.Protocol13_1_PRE1TO1_13;
public class EntityPackets {
@ -43,7 +43,7 @@ public class EntityPackets {
if (entType != null) {
if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) {
int data = wrapper.get(Type.INT, 0);
wrapper.set(Type.INT, 0, Protocol18w32aTO1_13.getNewBlockStateId(data));
wrapper.set(Type.INT, 0, Protocol13_1_PRE1TO1_13.getNewBlockStateId(data));
}
}
// Register Type ID

View File

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets;
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.item.Item;

View File

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol18w32ato1_13.packets;
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
@ -9,7 +9,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol18w32ato1_13.Protocol18w32aTO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.Protocol13_1_PRE1TO1_13;
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;
@ -31,7 +31,7 @@ public class WorldPackets {
for (int i = 0; i < section.getPalette().size(); i++) {
section.getPalette().set(
i,
Protocol18w32aTO1_13.getNewBlockStateId(section.getPalette().get(i))
Protocol13_1_PRE1TO1_13.getNewBlockStateId(section.getPalette().get(i))
);
}
}
@ -53,7 +53,7 @@ public class WorldPackets {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
wrapper.set(Type.VAR_INT, 0, Protocol18w32aTO1_13.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE1TO1_13.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
}
});
}
@ -70,7 +70,7 @@ public class WorldPackets {
public void handle(PacketWrapper wrapper) throws Exception {
int id = wrapper.get(Type.VAR_INT, 0);
wrapper.set(Type.VAR_INT, 0, Protocol18w32aTO1_13.getNewBlockStateId(id));
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE1TO1_13.getNewBlockStateId(id));
}
});
}
@ -89,7 +89,7 @@ public class WorldPackets {
// Convert ids
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
int id = record.getBlockId();
record.setBlockId(Protocol18w32aTO1_13.getNewBlockStateId(id));
record.setBlockId(Protocol13_1_PRE1TO1_13.getNewBlockStateId(id));
}
}
});
@ -111,7 +111,7 @@ public class WorldPackets {
if (id == 1010) { // Play record
wrapper.set(Type.INT, 1, data = InventoryPackets.getNewItemId(data));
} else if (id == 2001) { // Block break + block break sound
wrapper.set(Type.INT, 1, data = Protocol18w32aTO1_13.getNewBlockStateId(data));
wrapper.set(Type.INT, 1, data = Protocol13_1_PRE1TO1_13.getNewBlockStateId(data));
}
}
});
@ -174,7 +174,7 @@ public class WorldPackets {
int id = wrapper.get(Type.INT, 0);
if(id == 3 || id == 20){
int data = wrapper.passthrough(Type.VAR_INT);
wrapper.set(Type.VAR_INT, 0, Protocol18w32aTO1_13.getNewBlockStateId(data));
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE1TO1_13.getNewBlockStateId(data));
}
}
});

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name>

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
<packaging>pom</packaging>
<name>viaversion-parent</name>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-18w32a</version>
<version>1.4.2-1.13.1-pre1</version>
</parent>
<modelVersion>4.0.0</modelVersion>