Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
fixed 1.11 -> 1.10.2 potion data remapping
Dieser Commit ist enthalten in:
Ursprung
6a7a92a97b
Commit
0b17b81b63
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_11to1_10;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.Pair;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_11Types;
|
import us.myles.ViaVersion.api.entities.Entity1_11Types;
|
||||||
@ -15,6 +16,7 @@ import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
|||||||
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
import us.myles.ViaVersion.api.type.types.version.Types1_9;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_11to1_10.data.PotionColorMapping;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_11to1_10.metadata.MetadataRewriter1_11To1_10;
|
import us.myles.ViaVersion.protocols.protocol1_11to1_10.metadata.MetadataRewriter1_11To1_10;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_11to1_10.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_11to1_10.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_11to1_10.storage.EntityTracker1_11;
|
import us.myles.ViaVersion.protocols.protocol1_11to1_10.storage.EntityTracker1_11;
|
||||||
@ -260,6 +262,33 @@ public class Protocol1_11To1_10 extends Protocol<ClientboundPackets1_9_3, Client
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.registerOutgoing(ClientboundPackets1_9_3.EFFECT, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
this.map(Type.INT); //effectID
|
||||||
|
this.map(Type.POSITION); //pos
|
||||||
|
this.map(Type.INT); //effectData
|
||||||
|
this.map(Type.BOOLEAN); //serverwide / global
|
||||||
|
handler(packetWrapper -> {
|
||||||
|
final int effectID = packetWrapper.get(Type.INT, 0);
|
||||||
|
if (effectID == 2002) {
|
||||||
|
int data = packetWrapper.get(Type.INT, 1);
|
||||||
|
final Pair<Integer, Boolean> newData = PotionColorMapping.getNewData(data);
|
||||||
|
if (newData.getKey() == -1) {
|
||||||
|
Via.getPlatform().getLogger().warning("Received unknown 1.11 -> 1.10.2 potion data (" + data + ")");
|
||||||
|
data = 0;
|
||||||
|
} else {
|
||||||
|
data = newData.getKey();
|
||||||
|
}
|
||||||
|
if (newData.getValue()) {
|
||||||
|
packetWrapper.set(Type.INT, 0, 2007);
|
||||||
|
}
|
||||||
|
packetWrapper.set(Type.INT, 1, data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
INCOMING PACKETS
|
INCOMING PACKETS
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package us.myles.ViaVersion.protocols.protocol1_11to1_10.data;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
import us.myles.ViaVersion.api.Pair;
|
||||||
|
|
||||||
|
public class PotionColorMapping {
|
||||||
|
|
||||||
|
//<oldData> to <newData, isInstant> mapping
|
||||||
|
private static final Int2ObjectMap<Pair<Integer, Boolean>> POTIONS = new Int2ObjectOpenHashMap<>(17, 1.0F);
|
||||||
|
|
||||||
|
static {
|
||||||
|
addRewrite(0, 3694022, false);
|
||||||
|
addRewrite(1, 3694022, false);
|
||||||
|
addRewrite(2, 3694022, false);
|
||||||
|
addRewrite(3, 3694022, false);
|
||||||
|
addRewrite(4, 3694022, false);
|
||||||
|
addRewrite(5, 2039713, false);
|
||||||
|
addRewrite(6, 2039713, false);
|
||||||
|
addRewrite(7, 8356754, false);
|
||||||
|
addRewrite(8, 8356754, false);
|
||||||
|
addRewrite(9, 2293580, false);
|
||||||
|
addRewrite(10, 2293580, false);
|
||||||
|
addRewrite(11, 2293580, false);
|
||||||
|
addRewrite(12, 14981690, false);
|
||||||
|
addRewrite(13, 14981690, false);
|
||||||
|
addRewrite(14, 8171462, false);
|
||||||
|
addRewrite(15, 8171462, false);
|
||||||
|
addRewrite(16, 8171462, false);
|
||||||
|
addRewrite(17, 5926017, false);
|
||||||
|
addRewrite(18, 5926017, false);
|
||||||
|
addRewrite(19, 3035801, false);
|
||||||
|
addRewrite(20, 3035801, false);
|
||||||
|
addRewrite(21, 16262179, true);
|
||||||
|
addRewrite(22, 16262179, true);
|
||||||
|
addRewrite(23, 4393481, true);
|
||||||
|
addRewrite(24, 4393481, true);
|
||||||
|
addRewrite(25, 5149489, false);
|
||||||
|
addRewrite(26, 5149489, false);
|
||||||
|
addRewrite(27, 5149489, false);
|
||||||
|
addRewrite(28, 13458603, false);
|
||||||
|
addRewrite(29, 13458603, false);
|
||||||
|
addRewrite(30, 13458603, false);
|
||||||
|
addRewrite(31, 9643043, false);
|
||||||
|
addRewrite(32, 9643043, false);
|
||||||
|
addRewrite(33, 9643043, false);
|
||||||
|
addRewrite(34, 4738376, false);
|
||||||
|
addRewrite(35, 4738376, false);
|
||||||
|
addRewrite(36, 3381504, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Pair<Integer, Boolean> getNewData(final int oldData) {
|
||||||
|
return POTIONS.getOrDefault(oldData, new Pair<>(-1, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean contains(final int oldData) {
|
||||||
|
return POTIONS.containsKey(oldData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addRewrite(final int oldData, final int newData, final boolean isInstant) {
|
||||||
|
POTIONS.put(oldData, new Pair<>(newData, isInstant));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren