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

Prepare for 1.13.1 update

Dieser Commit ist enthalten in:
Myles 2018-08-22 17:05:24 +01:00
Ursprung 8945fc27d7
Commit a05ea7c1ce
14 geänderte Dateien mit 33 neuen und 35 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

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.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -55,9 +55,8 @@ public class ProtocolRegistry {
registerProtocol(new Protocol1_12_1TO1_12(), Collections.singletonList(ProtocolVersion.v1_12_1.getId()), ProtocolVersion.v1_12.getId());
registerProtocol(new Protocol1_12_2TO1_12_1(), Collections.singletonList(ProtocolVersion.v1_12_2.getId()), ProtocolVersion.v1_12_1.getId());
// 1.13 support in development! (:
registerProtocol(new Protocol1_13To1_12_2(), Collections.singletonList(ProtocolVersion.v1_13.getId()), ProtocolVersion.v1_12_2.getId());
registerProtocol(new Protocol13_1_PRE2TO1_13(), Arrays.asList(ProtocolVersion.v1_13_1_pre2.getId()), ProtocolVersion.v1_13.getId());
registerProtocol(new Protocol1_13_1To1_13(), Arrays.asList(ProtocolVersion.v1_13_1.getId()), ProtocolVersion.v1_13.getId());
}
/**

Datei anzeigen

@ -32,9 +32,8 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_12;
public static final ProtocolVersion v1_12_1;
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 v1_13_1_pre2;
public static final ProtocolVersion v1_13_1;
public static final ProtocolVersion unknown;
private final int id;
@ -64,7 +63,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(v1_13_1_pre2 = new ProtocolVersion(400, "1.13.1-pre2"));
register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13;
package us.myles.ViaVersion.protocols.protocol1_13_1to1_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.protocol1_13_1_pre2to1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_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(Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
metadata.setValue(Protocol1_13_1To1_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(Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
metadata.setValue(Protocol1_13_1To1_13.getNewBlockStateId(data));
}
if(type.is(EntityType.ITEM)){

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13;
package us.myles.ViaVersion.protocols.protocol1_13_1to1_13;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
@ -9,13 +9,13 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.remapper.ValueTransformer;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets.WorldPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.packets.InventoryPackets;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_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 Protocol13_1_PRE2TO1_13 extends Protocol {
public class Protocol1_13_1To1_13 extends Protocol {
@Override
protected void registerPackets() {

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets;
package us.myles.ViaVersion.protocols.protocol1_13_1to1_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.protocol1_13_1_pre2to1_13.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_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, Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
wrapper.set(Type.INT, 0, Protocol1_13_1To1_13.getNewBlockStateId(data));
}
}
// Register Type ID

Datei anzeigen

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

Datei anzeigen

@ -1,4 +1,4 @@
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets;
package us.myles.ViaVersion.protocols.protocol1_13_1to1_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.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_13;
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_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,
Protocol13_1_PRE2TO1_13.getNewBlockStateId(section.getPalette().get(i))
Protocol1_13_1To1_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, Protocol13_1_PRE2TO1_13.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
wrapper.set(Type.VAR_INT, 0, Protocol1_13_1To1_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, Protocol13_1_PRE2TO1_13.getNewBlockStateId(id));
wrapper.set(Type.VAR_INT, 0, Protocol1_13_1To1_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(Protocol13_1_PRE2TO1_13.getNewBlockStateId(id));
record.setBlockId(Protocol1_13_1To1_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 = Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
wrapper.set(Type.INT, 1, data = Protocol1_13_1To1_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, Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
wrapper.set(Type.VAR_INT, 0, Protocol1_13_1To1_13.getNewBlockStateId(data));
}
}
});

Datei anzeigen

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.4.2-1.13.1-pre1</version>
<version>1.5.0</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>1.4.2-1.13.1-pre1</version>
<version>1.5.0</version>
<packaging>pom</packaging>
<name>viaversion-parent</name>

Datei anzeigen

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

Datei anzeigen

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