Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +01:00
Merge pull request #985 from ForceUpdate1/dev
Add support for 1.13.1-pre2
Dieser Commit ist enthalten in:
Commit
41ab131a4d
@ -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_pre1to1_13.Protocol13_1_PRE1TO1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_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 Protocol13_1_PRE1TO1_13(), Arrays.asList(ProtocolVersion.v1_13_1_pre1.getId()), ProtocolVersion.v1_13.getId());
|
||||
registerProtocol(new Protocol13_1_PRE2TO1_13(), Arrays.asList(ProtocolVersion.v1_13_1_pre2.getId()), ProtocolVersion.v1_13.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 v1_13_1_pre1;
|
||||
public static final ProtocolVersion v1_13_1_pre2;
|
||||
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(v1_13_1_pre1 = new ProtocolVersion(399, "1.13.1-pre1"));
|
||||
register(v1_13_1_pre2 = new ProtocolVersion(400, "1.13.1-pre2"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13;
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_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_pre1to1_13.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_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_PRE1TO1_13.getNewBlockStateId(data));
|
||||
metadata.setValue(Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(data));
|
||||
metadata.setValue(Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
|
||||
}
|
||||
if(type.is(EntityType.ITEM)){
|
||||
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13;
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_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.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_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_13to1_12_2.storage.EntityTracker;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class Protocol13_1_PRE1TO1_13 extends Protocol {
|
||||
public class Protocol13_1_PRE2TO1_13 extends Protocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_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_pre1to1_13.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.Protocol13_1_PRE1TO1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(data));
|
||||
wrapper.set(Type.INT, 0, Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
|
||||
}
|
||||
}
|
||||
// Register Type ID
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.packets;
|
||||
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
@ -1,4 +1,4 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre1to1_13.packets;
|
||||
package us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_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_pre1to1_13.Protocol13_1_PRE1TO1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1_pre2to1_13.Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(section.getPalette().get(i))
|
||||
Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
|
||||
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(id));
|
||||
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(id));
|
||||
record.setBlockId(Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(data));
|
||||
wrapper.set(Type.INT, 1, data = Protocol13_1_PRE2TO1_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_PRE1TO1_13.getNewBlockStateId(data));
|
||||
wrapper.set(Type.VAR_INT, 0, Protocol13_1_PRE2TO1_13.getNewBlockStateId(data));
|
||||
}
|
||||
}
|
||||
});
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren