Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7824e1df5 | ||
|
|
2168145d58 | ||
|
|
ebb1323129 | ||
|
|
34ca6324c5 | ||
|
|
908931e174 | ||
|
|
1f15c9e8f1 |
No files matched your search
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -14,10 +14,12 @@ import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.Protocol1_11_1To1_12;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_12to1_12_1.Protocol1_12To1_12_1;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -33,6 +35,7 @@ public interface ViaBackwardsPlatform {
|
||||
ProtocolRegistry.registerProtocol(new Protocol1_10To1_11(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_11.getId());
|
||||
ProtocolRegistry.registerProtocol(new Protocol1_11To1_11_1(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_11_1.getId());
|
||||
ProtocolRegistry.registerProtocol(new Protocol1_11_1To1_12(), Collections.singletonList(ProtocolVersion.v1_11_1.getId()), ProtocolVersion.v1_12.getId());
|
||||
ProtocolRegistry.registerProtocol(new Protocol1_12To1_12_1(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_12_1.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,14 +48,16 @@ public interface ViaBackwardsPlatform {
|
||||
|
||||
// TODO remove or better implement later
|
||||
default boolean isOutdated() {
|
||||
Class<?> clazz = null;
|
||||
boolean upToDate = false;
|
||||
try {
|
||||
clazz = Class.forName("us.myles.ViaVersion.api.type.types.version.Types1_12");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Class<?> clazz = Class.forName("us.myles.ViaVersion.api.protocol.ProtocolVersion");
|
||||
Field v1_12_1 = clazz.getField("v1_12_1");
|
||||
|
||||
upToDate = (v1_12_1 != null);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException ignored) {
|
||||
}
|
||||
|
||||
if (clazz == null) {
|
||||
if (!upToDate) {
|
||||
getLogger().severe("================================");
|
||||
getLogger().severe("YOUR VIAVERSION IS OUTDATED");
|
||||
getLogger().severe("PLEASE USE THE LATEST VERSION");
|
||||
|
||||
@@ -13,6 +13,7 @@ package nl.matsv.viabackwards.api.entities.types;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -30,7 +31,8 @@ public class EntityType1_10 {
|
||||
type = EntityType.findById(typeID);
|
||||
|
||||
if (!type.isPresent()) {
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_10] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
if (!Via.getConfig().isSuppressMetadataErrors())
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_10] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package nl.matsv.viabackwards.api.entities.types;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -29,7 +30,8 @@ public class EntityType1_11 {
|
||||
type = EntityType.findById(typeID);
|
||||
|
||||
if (!type.isPresent()) {
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_11] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
if (!Via.getConfig().isSuppressMetadataErrors())
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_11] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package nl.matsv.viabackwards.api.entities.types;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -29,7 +30,8 @@ public class EntityType1_12 {
|
||||
type = EntityType.findById(typeID);
|
||||
|
||||
if (!type.isPresent()) {
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_12] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
if (!Via.getConfig().isSuppressMetadataErrors())
|
||||
ViaBackwards.getPlatform().getLogger().severe("[EntityType1_12] Could not find type id " + typeID + " isObject=" + isObject);
|
||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
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_9;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@@ -381,7 +380,7 @@ public class BlockItemPackets1_11 extends BlockItemRewriter<Protocol1_10To1_11>
|
||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||
Metadata data = e.getData();
|
||||
|
||||
if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item
|
||||
if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item
|
||||
data.setValue(handleItemToClient((Item) data.getValue()));
|
||||
|
||||
return data;
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@ import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
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_9;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@@ -154,7 +153,7 @@ public class ItemPackets1_11_1 extends BlockItemRewriter<Protocol1_11To1_11_1> {
|
||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||
Metadata data = e.getData();
|
||||
|
||||
if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item
|
||||
if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item
|
||||
data.setValue(handleItemToClient((Item) data.getValue()));
|
||||
|
||||
return data;
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ import nl.matsv.viabackwards.utils.Block;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
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_12;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@@ -246,7 +245,7 @@ public class BlockItemPackets1_12 extends BlockItemRewriter<Protocol1_11_1To1_12
|
||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||
Metadata data = e.getData();
|
||||
|
||||
if (data.getMetaType().equals(MetaType1_12.Slot)) // Is Item
|
||||
if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item
|
||||
data.setValue(handleItemToClient((Item) data.getValue()));
|
||||
|
||||
return data;
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Matsv
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
|
||||
|
||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
|
||||
public class Protocol1_12To1_12_1 extends BackwardsProtocol {
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerOutgoing(State.PLAY, 0x2b, -1, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // TODO
|
||||
registerOutgoing(State.PLAY, 0x2c, 0x2b);
|
||||
registerOutgoing(State.PLAY, 0x2d, 0x2c);
|
||||
registerOutgoing(State.PLAY, 0x2e, 0x2d);
|
||||
registerOutgoing(State.PLAY, 0x2f, 0x2e);
|
||||
registerOutgoing(State.PLAY, 0x30, 0x2f);
|
||||
registerOutgoing(State.PLAY, 0x31, 0x30);
|
||||
registerOutgoing(State.PLAY, 0x32, 0x31);
|
||||
registerOutgoing(State.PLAY, 0x33, 0x32);
|
||||
registerOutgoing(State.PLAY, 0x34, 0x33);
|
||||
registerOutgoing(State.PLAY, 0x35, 0x34);
|
||||
registerOutgoing(State.PLAY, 0x36, 0x35);
|
||||
registerOutgoing(State.PLAY, 0x37, 0x36);
|
||||
registerOutgoing(State.PLAY, 0x38, 0x37);
|
||||
registerOutgoing(State.PLAY, 0x39, 0x38);
|
||||
registerOutgoing(State.PLAY, 0x3a, 0x39);
|
||||
registerOutgoing(State.PLAY, 0x3b, 0x3a);
|
||||
registerOutgoing(State.PLAY, 0x3c, 0x3b);
|
||||
registerOutgoing(State.PLAY, 0x3d, 0x3c);
|
||||
registerOutgoing(State.PLAY, 0x3e, 0x3d);
|
||||
registerOutgoing(State.PLAY, 0x3f, 0x3e);
|
||||
registerOutgoing(State.PLAY, 0x40, 0x3f);
|
||||
registerOutgoing(State.PLAY, 0x41, 0x40);
|
||||
registerOutgoing(State.PLAY, 0x42, 0x41);
|
||||
registerOutgoing(State.PLAY, 0x43, 0x42);
|
||||
registerOutgoing(State.PLAY, 0x44, 0x43);
|
||||
registerOutgoing(State.PLAY, 0x45, 0x44);
|
||||
registerOutgoing(State.PLAY, 0x46, 0x45);
|
||||
registerOutgoing(State.PLAY, 0x47, 0x46);
|
||||
registerOutgoing(State.PLAY, 0x48, 0x47);
|
||||
registerOutgoing(State.PLAY, 0x49, 0x48);
|
||||
registerOutgoing(State.PLAY, 0x4a, 0x49);
|
||||
registerOutgoing(State.PLAY, 0x4b, 0x4a);
|
||||
registerOutgoing(State.PLAY, 0x4c, 0x4b);
|
||||
registerOutgoing(State.PLAY, 0x4d, 0x4c);
|
||||
registerOutgoing(State.PLAY, 0x4e, 0x4d);
|
||||
registerOutgoing(State.PLAY, 0x4f, 0x4e);
|
||||
|
||||
registerIncoming(State.PLAY, -1, 0x1, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // TODO
|
||||
registerIncoming(State.PLAY, 0x1, 0x2);
|
||||
registerIncoming(State.PLAY, 0x2, 0x3);
|
||||
registerIncoming(State.PLAY, 0x3, 0x4);
|
||||
registerIncoming(State.PLAY, 0x4, 0x5);
|
||||
registerIncoming(State.PLAY, 0x5, 0x6);
|
||||
registerIncoming(State.PLAY, 0x6, 0x7);
|
||||
registerIncoming(State.PLAY, 0x7, 0x8);
|
||||
registerIncoming(State.PLAY, 0x8, 0x9);
|
||||
registerIncoming(State.PLAY, 0x9, 0xa);
|
||||
registerIncoming(State.PLAY, 0xa, 0xb);
|
||||
registerIncoming(State.PLAY, 0xb, 0xc);
|
||||
registerIncoming(State.PLAY, 0xc, 0xd);
|
||||
registerIncoming(State.PLAY, 0xd, 0xe);
|
||||
registerIncoming(State.PLAY, 0xe, 0xf);
|
||||
registerIncoming(State.PLAY, 0xf, 0x10);
|
||||
registerIncoming(State.PLAY, 0x10, 0x11);
|
||||
registerIncoming(State.PLAY, 0x11, 0x12);
|
||||
registerIncoming(State.PLAY, 0x12, -1); // No sent by client, sad :(
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection userConnection) {
|
||||
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -16,7 +16,6 @@ import nl.matsv.viabackwards.utils.Block;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
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_9;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
@@ -219,11 +218,11 @@ public class BlockItemPackets1_10 extends BlockItemRewriter<Protocol1_9_4To1_10>
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Rewrite metadata items
|
||||
protocol.getEntityPackets().registerMetaHandler().handle(e -> {
|
||||
Metadata data = e.getData();
|
||||
|
||||
if (data.getMetaType().equals(MetaType1_9.Slot)) // Is Item
|
||||
if (data.getMetaType().getType().equals(Type.ITEM)) // Is Item
|
||||
data.setValue(handleItemToClient((Item) data.getValue()));
|
||||
|
||||
return data;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<groupId>nl.matsv</groupId>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>Allow newer clients to join older server versions.</description>
|
||||
@@ -65,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion</artifactId>
|
||||
<version>1.1.1-SNAPSHOT</version>
|
||||
<version>1.2.0-1_12_1-pre1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<artifactId>viabackwards-parent</artifactId>
|
||||
<groupId>nl.matsv</groupId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in new issue
Block a user