Renamed JoinGameDataTracker

This commit is contained in:
FlorianMichael 2023-12-27 22:17:59 +01:00
parent 8cfbb50a9d
commit 180ce79ca7
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 14 additions and 14 deletions

View File

@ -22,13 +22,13 @@ package de.florianmichael.viafabricplus.fixes.tracker;
import com.viaversion.viaversion.api.connection.StoredObject;
import com.viaversion.viaversion.api.connection.UserConnection;
public class JoinGameTracker extends StoredObject {
public class JoinGameDataTracker extends StoredObject {
private long seed;
private String levelId;
private long enchantmentSeed;
public JoinGameTracker(UserConnection user) {
public JoinGameDataTracker(UserConnection user) {
super(user);
}

View File

@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.ProtocolInfo;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameTracker;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin;
import de.florianmichael.viafabricplus.injection.access.IBlobCache;
import de.florianmichael.viafabricplus.injection.access.IChunkTracker;
@ -107,8 +107,8 @@ public abstract class MixinDebugHud {
}
// bedrock
final JoinGameTracker joinGameTracker = userConnection.get(JoinGameTracker.class);
if (joinGameTracker != null) {
final JoinGameDataTracker joinGameDataTracker = userConnection.get(JoinGameDataTracker.class);
if (joinGameDataTracker != null) {
final int movementMode = userConnection.get(GameSessionStorage.class).getMovementMode();
String movement = "Server with rewind";
if (movementMode == ServerMovementModes.CLIENT) {
@ -117,10 +117,10 @@ public abstract class MixinDebugHud {
movement = "Server";
}
information.add("Bedrock Level: " + joinGameTracker.getLevelId() + ", Enchantment Seed: " + joinGameTracker.getEnchantmentSeed() + ", Movement: " + movement);
information.add("Bedrock Level: " + joinGameDataTracker.getLevelId() + ", Enchantment Seed: " + joinGameDataTracker.getEnchantmentSeed() + ", Movement: " + movement);
}
if (joinGameTracker != null) {
information.add("World Seed: " + joinGameTracker.getSeed());
if (joinGameDataTracker != null) {
information.add("World Seed: " + joinGameDataTracker.getSeed());
}
final BlobCache blobCache = userConnection.get(BlobCache.class);
if (blobCache != null) {

View File

@ -20,7 +20,7 @@
package de.florianmichael.viafabricplus.injection.mixin.viabedrock;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameTracker;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
import net.raphimc.viabedrock.protocol.BedrockProtocol;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -32,7 +32,7 @@ public abstract class MixinBedrockProtocol {
@Inject(method = "init", at = @At("RETURN"))
private void hookStorages(UserConnection user, CallbackInfo ci) {
user.put(new JoinGameTracker(user));
user.put(new JoinGameDataTracker(user));
}
}

View File

@ -21,7 +21,7 @@ package de.florianmichael.viafabricplus.injection.mixin.viabedrock;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameTracker;
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
import net.raphimc.viabedrock.protocol.packets.JoinPackets;
import net.raphimc.viabedrock.protocol.types.primitive.LongLEType;
import net.raphimc.viabedrock.protocol.types.primitive.StringType;
@ -36,21 +36,21 @@ public abstract class MixinJoinPackets {
@Redirect(method = "lambda$register$2", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/packet/PacketWrapper;read(Lcom/viaversion/viaversion/api/type/Type;)Ljava/lang/Object;", ordinal = 5))
private static Object trackWorldSeed(PacketWrapper instance, Type<LongLEType> tType) throws Exception {
final Object seed = instance.read(tType);
instance.user().get(JoinGameTracker.class).setSeed((long) seed);
instance.user().get(JoinGameDataTracker.class).setSeed((long) seed);
return seed;
}
@Redirect(method = "lambda$register$2", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/packet/PacketWrapper;read(Lcom/viaversion/viaversion/api/type/Type;)Ljava/lang/Object;", ordinal = 55))
private static Object trackLevelId(PacketWrapper instance, Type<StringType> tType) throws Exception {
final Object levelId = instance.read(tType);
instance.user().get(JoinGameTracker.class).setLevelId((String) levelId);
instance.user().get(JoinGameDataTracker.class).setLevelId((String) levelId);
return levelId;
}
@Redirect(method = "lambda$register$2", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/packet/PacketWrapper;read(Lcom/viaversion/viaversion/api/type/Type;)Ljava/lang/Object;", ordinal = 63))
private static Object trackEnchantmentSeed(PacketWrapper instance, Type<VarIntType> tType) throws Exception {
final Object enchantmentSeed = instance.read(tType);
instance.user().get(JoinGameTracker.class).setEnchantmentSeed((Integer) enchantmentSeed);
instance.user().get(JoinGameDataTracker.class).setEnchantmentSeed((Integer) enchantmentSeed);
return enchantmentSeed;
}