Update VV usage
This commit is contained in:
14 files changed
+21
-17
No files matched your search
@@ -80,7 +80,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public interface ViaBackwardsPlatform {
|
||||
|
||||
String MINIMUM_VV_VERSION = "5.8.1";
|
||||
String MINIMUM_VV_VERSION = "5.9.2";
|
||||
|
||||
default void init(final File configFile) {
|
||||
init(new ViaBackwardsConfig(configFile, getLogger()));
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ final class Protocol99_1To98_1 extends BackwardsProtocol<ClientboundPacket26_1,
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_21_11.PLAYER));
|
||||
addItemHasher(connection, new ItemHasherBase(this, connection));
|
||||
connection.addItemHasher(this.getClass(), new ItemHasherBase(this, connection));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -240,7 +240,7 @@ public final class Protocol1_21_11To1_21_9 extends BackwardsProtocol<Clientbound
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_21_11.PLAYER));
|
||||
addItemHasher(connection, new ItemHasherBase(this, connection));
|
||||
connection.addItemHasher(this.getClass(), new ItemHasherBase(this, connection));
|
||||
connection.put(new GameTimeStorage());
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -675,7 +675,10 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem
|
||||
if (deathProtection != null) {
|
||||
final List<Consumable1_21_2.ConsumeEffect<?>> effects = new ArrayList<>();
|
||||
for (int i = 0; i < deathProtection.size(); i++) {
|
||||
effects.add(convertConsumableEffect(deathProtection.get(i)));
|
||||
final Consumable1_21_2.ConsumeEffect<?> effect = convertConsumableEffect(deathProtection.get(i));
|
||||
if (effect != null) {
|
||||
effects.add(effect);
|
||||
}
|
||||
}
|
||||
data.set(StructuredDataKey.DEATH_PROTECTION, new DeathProtection(effects.toArray(Consumable1_21_2.ConsumeEffect[]::new)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ public final class Protocol1_21_5To1_21_4 extends BackwardsProtocol<ClientboundP
|
||||
@Override
|
||||
public void init(final UserConnection user) {
|
||||
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_21_4.PLAYER));
|
||||
user.put(new HashedItemConverterStorage(this));
|
||||
user.put(new HashedItemConverterStorage(this, user));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ public final class EntityPacketRewriter1_21_5 extends EntityRewriter<Clientbound
|
||||
|
||||
filter().dataType(mappedEntityDataTypes.frogVariantType).handler((event, data) -> {
|
||||
final int value = data.value();
|
||||
final String variantKey = protocol.getRegistryDataRewriter().getMappings("frog_variant").idToKey(value);
|
||||
final String variantKey = tracker(event.user()).registryKeys("frog_variant").idToKey(value);
|
||||
final int newValue = (variantKey == null) ? 0 : switch (variantKey) {
|
||||
case "cold" -> 2;
|
||||
case "temperate" -> 0;
|
||||
@@ -172,7 +172,7 @@ public final class EntityPacketRewriter1_21_5 extends EntityRewriter<Clientbound
|
||||
});
|
||||
filter().dataType(mappedEntityDataTypes.catVariantType).handler((event, data) -> {
|
||||
final int value = data.value();
|
||||
final String variantKey = protocol.getRegistryDataRewriter().getMappings("cat_variant").idToKey(value);
|
||||
final String variantKey = tracker(event.user()).registryKeys("cat_variant").idToKey(value);
|
||||
final int newValue = (variantKey == null) ? 1 : switch (variantKey) {
|
||||
case "all_black" -> 10;
|
||||
case "black" -> 1;
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@
|
||||
package com.viaversion.viabackwards.protocol.v1_21_5to1_21_4.storage;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.codec.CodecContext;
|
||||
import com.viaversion.viaversion.api.minecraft.codec.CodecContext.RegistryAccess;
|
||||
import com.viaversion.viaversion.api.minecraft.codec.hash.Hasher;
|
||||
@@ -30,8 +31,8 @@ public class HashedItemConverterStorage implements StorableObject {
|
||||
|
||||
private final Hasher hasher;
|
||||
|
||||
public HashedItemConverterStorage(final Protocol<?, ?, ?, ?> protocol) {
|
||||
final RegistryAccess registryAccess = RegistryAccess.of(protocol);
|
||||
public HashedItemConverterStorage(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection) {
|
||||
final RegistryAccess registryAccess = RegistryAccess.of(protocol, connection);
|
||||
final CodecContext context = new CodecRegistryContext(protocol, registryAccess, false);
|
||||
this.hasher = new HashOps(context, HashFunction.CRC32C);
|
||||
}
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ public final class Protocol1_21_6To1_21_5 extends BackwardsProtocol<ClientboundP
|
||||
@Override
|
||||
public void init(final UserConnection user) {
|
||||
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_21_6.PLAYER));
|
||||
addItemHasher(user, new ItemHasherBase(this, user));
|
||||
user.addItemHasher(this.getClass(), new ItemHasherBase(this, user));
|
||||
user.put(new RegistryAndTags());
|
||||
user.put(new ClickEvents());
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public final class Protocol1_21_7To1_21_6 extends BackwardsProtocol<ClientboundP
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_21_6.PLAYER));
|
||||
addItemHasher(connection, new ItemHasherBase(this, connection));
|
||||
connection.addItemHasher(this.getClass(), new ItemHasherBase(this, connection));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ public final class Protocol1_21_9To1_21_7 extends BackwardsProtocol<ClientboundP
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTracker1_21_9(connection, EntityTypes1_21_9.PLAYER));
|
||||
addItemHasher(connection, new ItemHasherBase(this, connection));
|
||||
connection.addItemHasher(this.getClass(), new ItemHasherBase(this, connection));
|
||||
connection.put(new PlayerRotationStorage());
|
||||
connection.put(new DimensionScaleStorage());
|
||||
connection.put(new BundleStateTracker());
|
||||
|
||||
+2
-2
@@ -130,7 +130,7 @@ public final class Protocol26_1To1_21_11 extends BackwardsProtocol<ClientboundPa
|
||||
final long totalTicks = wrapper.read(Types.VAR_LONG);
|
||||
wrapper.read(Types.FLOAT); // Partial tick
|
||||
final float tickRate = wrapper.read(Types.FLOAT);
|
||||
if (Key.equals(registryDataRewriter.getMappings("world_clock").idToKey(clockType), "overworld")) {
|
||||
if (Key.equals(entityRewriter.tracker(wrapper.user()).registryKeys("world_clock").idToKey(clockType), "overworld")) {
|
||||
dayTime = totalTicks;
|
||||
advanceTime = tickRate != 0;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public final class Protocol26_1To1_21_11 extends BackwardsProtocol<ClientboundPa
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_21_11.PLAYER));
|
||||
addItemHasher(connection, new ItemHasherBase(this, connection));
|
||||
connection.addItemHasher(this.getClass(), new ItemHasherBase(this, connection));
|
||||
connection.put(new DayTimeStorage());
|
||||
connection.put(new GameModeStorage());
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public final class BlockItemPacketRewriter26_1 extends BackwardsStructuredItemRe
|
||||
@Override
|
||||
protected void handleItemDataComponentsToServer(final UserConnection connection, final Item item, final StructuredDataContainer container) {
|
||||
super.handleItemDataComponentsToServer(connection, item, container);
|
||||
upgradeData(protocol, protocol.types().structuredDataKeys(), container);
|
||||
upgradeData(protocol, connection, protocol.types().structuredDataKeys(), container);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "5.9.1"
|
||||
viaver = "5.9.2-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
},
|
||||
{
|
||||
"id": "viaversion",
|
||||
"version": "[5.8.1-SNAPSHOT,)"
|
||||
"version": "[5.9.2-SNAPSHOT,)"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user