3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Merge remote-tracking branch 'origin/master' into dev

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-10-16 13:26:06 +02:00
Commit 027e132749
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
8 geänderte Dateien mit 31 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -13,8 +13,6 @@ dependencies {
targetConfiguration = "shadow" targetConfiguration = "shadow"
} }
api(libs.fastutil) api(libs.fastutil)
api(libs.flare)
api(libs.flareFastutil)
api(libs.openNBT) api(libs.openNBT)
api(libs.gson) api(libs.gson)

Datei anzeigen

@ -29,7 +29,6 @@ fun ShadowJar.configureRelocations() {
relocate("com.google.gson", "com.viaversion.viaversion.libs.gson") relocate("com.google.gson", "com.viaversion.viaversion.libs.gson")
relocate("com.github.steveice10.opennbt", "com.viaversion.viaversion.libs.opennbt") relocate("com.github.steveice10.opennbt", "com.viaversion.viaversion.libs.opennbt")
relocate("it.unimi.dsi.fastutil", "com.viaversion.viaversion.libs.fastutil") relocate("it.unimi.dsi.fastutil", "com.viaversion.viaversion.libs.fastutil")
relocate("space.vectrix.flare", "com.viaversion.viaversion.libs.flare")
} }
fun ShadowJar.configureExcludes() { fun ShadowJar.configureExcludes() {
@ -53,9 +52,4 @@ fun ShadowJar.configureExcludes() {
exclude("it/unimi/dsi/fastutil/*/*Synchronized*") exclude("it/unimi/dsi/fastutil/*/*Synchronized*")
exclude("it/unimi/dsi/fastutil/*/*Unmodifiable*") exclude("it/unimi/dsi/fastutil/*/*Unmodifiable*")
exclude("it/unimi/dsi/fastutil/io/*") exclude("it/unimi/dsi/fastutil/io/*")
// Flare - only need int maps
exclude("space/vectrix/flare/fastutil/*Double*")
exclude("space/vectrix/flare/fastutil/*Float*")
exclude("space/vectrix/flare/fastutil/*Long*")
exclude("space/vectrix/flare/fastutil/*Short*")
} }

Datei anzeigen

@ -24,13 +24,14 @@ import com.viaversion.viaversion.api.data.entity.ClientEntityIdChangeListener;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import space.vectrix.flare.fastutil.Int2ObjectSyncMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeListener { public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeListener {
private final Int2ObjectMap<EntityType> entityTypes = Int2ObjectSyncMap.hashmap(); private final Map<Integer, EntityType> entityTypes = new ConcurrentHashMap<>();
private final Int2ObjectMap<StoredEntityData> entityData; private final Map<Integer, StoredEntityData> entityData;
private final UserConnection connection; private final UserConnection connection;
private final EntityType playerType; private final EntityType playerType;
private int clientEntityId = -1; private int clientEntityId = -1;
@ -46,7 +47,7 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
public EntityTrackerBase(UserConnection connection, @Nullable EntityType playerType, boolean storesEntityData) { public EntityTrackerBase(UserConnection connection, @Nullable EntityType playerType, boolean storesEntityData) {
this.connection = connection; this.connection = connection;
this.playerType = playerType; this.playerType = playerType;
this.entityData = storesEntityData ? Int2ObjectSyncMap.hashmap() : null; this.entityData = storesEntityData ? new ConcurrentHashMap<>() : null;
} }
@Override @Override

Datei anzeigen

@ -17,14 +17,15 @@
*/ */
package com.viaversion.viaversion.protocols.protocol1_11to1_10.storage; package com.viaversion.viaversion.protocols.protocol1_11to1_10.storage;
import com.google.common.collect.Sets;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_11Types.EntityType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_11Types.EntityType;
import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import it.unimi.dsi.fastutil.ints.IntSet;
import space.vectrix.flare.fastutil.Int2ObjectSyncMap; import java.util.Set;
public class EntityTracker1_11 extends EntityTrackerBase { public class EntityTracker1_11 extends EntityTrackerBase {
private final IntSet holograms = Int2ObjectSyncMap.hashset(); private final Set<Integer> holograms = Sets.newConcurrentHashSet();
public EntityTracker1_11(UserConnection user) { public EntityTracker1_11(UserConnection user) {
super(user, EntityType.PLAYER); super(user, EntityType.PLAYER);

Datei anzeigen

@ -21,7 +21,6 @@ import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.minecraft.Position;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.ints.IntSet;
import space.vectrix.flare.SyncMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -29,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
// TODO Fix memory leak lolz (only a smol one tho) // TODO Fix memory leak lolz (only a smol one tho)
public class BlockStorage implements StorableObject { public class BlockStorage implements StorableObject {
private static final IntSet WHITELIST = new IntOpenHashSet(46, .99F); private static final IntSet WHITELIST = new IntOpenHashSet(46, .99F);
private final Map<Position, ReplacementData> blocks = SyncMap.hashmap(); private final Map<Position, ReplacementData> blocks = new ConcurrentHashMap<>();
static { static {
// Flower pots // Flower pots

Datei anzeigen

@ -20,14 +20,15 @@ package com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types;
import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import space.vectrix.flare.fastutil.Int2ObjectSyncMap; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class EntityTracker1_14 extends EntityTrackerBase { public class EntityTracker1_14 extends EntityTrackerBase {
private final Int2ObjectMap<Byte> insentientData = Int2ObjectSyncMap.hashmap(); private final Map<Integer, Byte> insentientData = new ConcurrentHashMap<>();
// 0x1 = sleeping, 0x2 = riptide // 0x1 = sleeping, 0x2 = riptide
private final Int2ObjectMap<Byte> sleepingAndRiptideData = Int2ObjectSyncMap.hashmap(); private final Map<Integer, Byte> sleepingAndRiptideData = new ConcurrentHashMap<>();
private final Int2ObjectMap<Byte> playerEntityFlags = Int2ObjectSyncMap.hashmap(); private final Map<Integer, Byte> playerEntityFlags = new ConcurrentHashMap<>();
private int latestTradeWindowId; private int latestTradeWindowId;
private boolean forceSendCenterChunk = true; private boolean forceSendCenterChunk = true;
private int chunkCenterX, chunkCenterZ; private int chunkCenterX, chunkCenterZ;

Datei anzeigen

@ -18,6 +18,7 @@
package com.viaversion.viaversion.protocols.protocol1_9to1_8.storage; package com.viaversion.viaversion.protocols.protocol1_9to1_8.storage;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Sets;
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.legacy.bossbar.BossBar; import com.viaversion.viaversion.api.legacy.bossbar.BossBar;
@ -39,22 +40,25 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.chat.GameMode;
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.providers.BossBarProvider; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.BossBarProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.EntityIdProvider; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.EntityIdProvider;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.IntSet;
import space.vectrix.flare.fastutil.Int2ObjectSyncMap;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class EntityTracker1_9 extends EntityTrackerBase { public class EntityTracker1_9 extends EntityTrackerBase {
public static final String WITHER_TRANSLATABLE = "{\"translate\":\"entity.WitherBoss.name\"}"; public static final String WITHER_TRANSLATABLE = "{\"translate\":\"entity.WitherBoss.name\"}";
public static final String DRAGON_TRANSLATABLE = "{\"translate\":\"entity.EnderDragon.name\"}"; public static final String DRAGON_TRANSLATABLE = "{\"translate\":\"entity.EnderDragon.name\"}";
private final Int2ObjectMap<UUID> uuidMap = Int2ObjectSyncMap.hashmap(); private final Map<Integer, UUID> uuidMap = new ConcurrentHashMap<>();
private final Int2ObjectMap<List<Metadata>> metadataBuffer = Int2ObjectSyncMap.hashmap(); private final Map<Integer, List<Metadata>> metadataBuffer = new ConcurrentHashMap<>();
private final Int2ObjectMap<Integer> vehicleMap = Int2ObjectSyncMap.hashmap(); private final Map<Integer, Integer> vehicleMap = new ConcurrentHashMap<>();
private final Int2ObjectMap<BossBar> bossBarMap = Int2ObjectSyncMap.hashmap(); private final Map<Integer, BossBar> bossBarMap = new ConcurrentHashMap<>();
private final IntSet validBlocking = Int2ObjectSyncMap.hashset(); private final Set<Integer> validBlocking = Sets.newConcurrentHashSet();
private final Set<Integer> knownHolograms = Int2ObjectSyncMap.hashset(); private final Set<Integer> knownHolograms = Sets.newConcurrentHashSet();
private final Set<Position> blockInteractions = Collections.newSetFromMap(CacheBuilder.newBuilder() private final Set<Position> blockInteractions = Collections.newSetFromMap(CacheBuilder.newBuilder()
.maximumSize(1000) .maximumSize(1000)
.expireAfterAccess(250, TimeUnit.MILLISECONDS) .expireAfterAccess(250, TimeUnit.MILLISECONDS)

Datei anzeigen

@ -5,7 +5,6 @@ metadata.format.version = "1.1"
adventure = "4.9.1" adventure = "4.9.1"
gson = "2.8.8" gson = "2.8.8"
fastutil = "8.5.6" fastutil = "8.5.6"
flare = "1.0.0"
openNBT = "2.0-SNAPSHOT" openNBT = "2.0-SNAPSHOT"
javassist = "3.28.0-GA" javassist = "3.28.0-GA"
@ -35,8 +34,6 @@ adventureTextSerializerLegacy = { group = "net.kyori", name = "adventure-text-se
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" } fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
flare = { group = "space.vectrix.flare", name = "flare", version.ref = "flare" }
flareFastutil = { group = "space.vectrix.flare", name = "flare-fastutil", version.ref = "flare" }
openNBT = { group = "com.viaversion", name = "opennbt", version.ref = "openNBT" } openNBT = { group = "com.viaversion", name = "opennbt", version.ref = "openNBT" }
javassist = { group = "org.javassist", name = "javassist", version.ref = "javassist" } javassist = { group = "org.javassist", name = "javassist", version.ref = "javassist" }