Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Make ClientChunks a StorableObject (#3487)
Dieser Commit ist enthalten in:
Ursprung
21d293dd7f
Commit
c7c38e70c0
@ -21,6 +21,7 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||||
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
@ -30,19 +31,10 @@ import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
|
|||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
|
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
|
||||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.metadata.MetadataRewriter1_9To1_8;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.metadata.MetadataRewriter1_9To1_8;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.EntityPackets;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.*;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.InventoryPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.PlayerPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.SpawnPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.packets.WorldPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.*;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.*;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.ClientChunks;
|
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.*;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.CommandBlockStorage;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.InventoryTracker;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.MovementTracker;
|
|
||||||
import com.viaversion.viaversion.util.GsonUtil;
|
import com.viaversion.viaversion.util.GsonUtil;
|
||||||
|
|
||||||
public class Protocol1_9To1_8 extends AbstractProtocol<ClientboundPackets1_8, ClientboundPackets1_9, ServerboundPackets1_8, ServerboundPackets1_9> {
|
public class Protocol1_9To1_8 extends AbstractProtocol<ClientboundPackets1_8, ClientboundPackets1_9, ServerboundPackets1_8, ServerboundPackets1_9> {
|
||||||
@ -139,7 +131,7 @@ public class Protocol1_9To1_8 extends AbstractProtocol<ClientboundPackets1_8, Cl
|
|||||||
// Entity tracker
|
// Entity tracker
|
||||||
userConnection.addEntityTracker(this.getClass(), new EntityTracker1_9(userConnection));
|
userConnection.addEntityTracker(this.getClass(), new EntityTracker1_9(userConnection));
|
||||||
// Chunk tracker
|
// Chunk tracker
|
||||||
userConnection.put(new ClientChunks(userConnection));
|
userConnection.put(new ClientChunks());
|
||||||
// Movement tracker
|
// Movement tracker
|
||||||
userConnection.put(new MovementTracker());
|
userConnection.put(new MovementTracker());
|
||||||
// Inventory tracker
|
// Inventory tracker
|
||||||
|
@ -18,17 +18,13 @@
|
|||||||
package com.viaversion.viaversion.protocols.protocol1_9to1_8.storage;
|
package com.viaversion.viaversion.protocols.protocol1_9to1_8.storage;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.viaversion.viaversion.api.connection.StoredObject;
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ClientChunks extends StoredObject {
|
public class ClientChunks implements StorableObject {
|
||||||
private final Set<Long> loadedChunks = Sets.newConcurrentHashSet();
|
private final Set<Long> loadedChunks = Sets.newConcurrentHashSet();
|
||||||
|
|
||||||
public ClientChunks(UserConnection connection) {
|
|
||||||
super(connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long toLong(int msw, int lsw) {
|
public static long toLong(int msw, int lsw) {
|
||||||
return ((long) msw << 32) + lsw + 2147483648L;
|
return ((long) msw << 32) + lsw + 2147483648L;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren