3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

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

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-10-19 09:16:06 +02:00
Commit f5d92bf74f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
10 geänderte Dateien mit 39 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -13,6 +13,8 @@ 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,6 +29,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.BitSet; import java.util.BitSet;
import java.util.List; import java.util.List;
// TODO specialized sub interfaces
public interface Chunk { public interface Chunk {
/** /**

Datei anzeigen

@ -474,7 +474,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
/** /**
* Returns the unmapped packet type, or null if mapped over ids. * Returns the unmapped packet type, or null if mapped over ids.
* This is NOT the same as calling {@link #getOldId()} (think of unmapped vs. old in 1.17->1.16). * This is NOT the same as calling {@link #getOldId()} (think of unmapped vs. old in 1.171.16).
* *
* @return unmapped packet type, or null if mapped over ids * @return unmapped packet type, or null if mapped over ids
*/ */
@ -485,7 +485,7 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
/** /**
* Returns the mapped packet type, or null if mapped over ids or mapped to no packet type. * Returns the mapped packet type, or null if mapped over ids or mapped to no packet type.
* This is NOT the same as calling {@link #getNewId()} (think of mapped vs. new in 1.17->1.16). * This is NOT the same as calling {@link #getNewId()} (think of mapped vs. new in 1.171.16).
* *
* @return new packet type, or null if mapped over ids or mapped to no packet type * @return new packet type, or null if mapped over ids or mapped to no packet type
*/ */

Datei anzeigen

@ -29,6 +29,7 @@ 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() {
@ -52,4 +53,9 @@ 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,14 +24,13 @@ 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 Map<Integer, EntityType> entityTypes = new ConcurrentHashMap<>(); private final Int2ObjectMap<EntityType> entityTypes = Int2ObjectSyncMap.hashmap();
private final Map<Integer, StoredEntityData> entityData; private final Int2ObjectMap<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;
@ -47,7 +46,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 ? new ConcurrentHashMap<>() : null; this.entityData = storesEntityData ? Int2ObjectSyncMap.hashmap() : null;
} }
@Override @Override

Datei anzeigen

@ -17,15 +17,14 @@
*/ */
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 java.util.Set; import space.vectrix.flare.fastutil.Int2ObjectSyncMap;
public class EntityTracker1_11 extends EntityTrackerBase { public class EntityTracker1_11 extends EntityTrackerBase {
private final Set<Integer> holograms = Sets.newConcurrentHashSet(); private final IntSet holograms = Int2ObjectSyncMap.hashset();
public EntityTracker1_11(UserConnection user) { public EntityTracker1_11(UserConnection user) {
super(user, EntityType.PLAYER); super(user, EntityType.PLAYER);

Datei anzeigen

@ -21,6 +21,7 @@ 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;
@ -28,7 +29,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 = new ConcurrentHashMap<>(); private final Map<Position, ReplacementData> blocks = SyncMap.hashmap();
static { static {
// Flower pots // Flower pots

Datei anzeigen

@ -20,15 +20,14 @@ 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 java.util.Map; import space.vectrix.flare.fastutil.Int2ObjectSyncMap;
import java.util.concurrent.ConcurrentHashMap;
public class EntityTracker1_14 extends EntityTrackerBase { public class EntityTracker1_14 extends EntityTrackerBase {
private final Map<Integer, Byte> insentientData = new ConcurrentHashMap<>(); private final Int2ObjectMap<Byte> insentientData = Int2ObjectSyncMap.hashmap();
// 0x1 = sleeping, 0x2 = riptide // 0x1 = sleeping, 0x2 = riptide
private final Map<Integer, Byte> sleepingAndRiptideData = new ConcurrentHashMap<>(); private final Int2ObjectMap<Byte> sleepingAndRiptideData = Int2ObjectSyncMap.hashmap();
private final Map<Integer, Byte> playerEntityFlags = new ConcurrentHashMap<>(); private final Int2ObjectMap<Byte> playerEntityFlags = Int2ObjectSyncMap.hashmap();
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,7 +18,6 @@
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;
@ -40,25 +39,22 @@ 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.ArrayList; import java.util.*;
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 Map<Integer, UUID> uuidMap = new ConcurrentHashMap<>(); private final Int2ObjectMap<UUID> uuidMap = Int2ObjectSyncMap.hashmap();
private final Map<Integer, List<Metadata>> metadataBuffer = new ConcurrentHashMap<>(); private final Int2ObjectMap<List<Metadata>> metadataBuffer = Int2ObjectSyncMap.hashmap();
private final Map<Integer, Integer> vehicleMap = new ConcurrentHashMap<>(); private final Int2ObjectMap<Integer> vehicleMap = Int2ObjectSyncMap.hashmap();
private final Map<Integer, BossBar> bossBarMap = new ConcurrentHashMap<>(); private final Int2ObjectMap<BossBar> bossBarMap = Int2ObjectSyncMap.hashmap();
private final Set<Integer> validBlocking = Sets.newConcurrentHashSet(); private final IntSet validBlocking = Int2ObjectSyncMap.hashset();
private final Set<Integer> knownHolograms = Sets.newConcurrentHashSet(); private final Set<Integer> knownHolograms = Int2ObjectSyncMap.hashset();
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,6 +5,7 @@ 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 = "2.0.0"
openNBT = "2.0-SNAPSHOT" openNBT = "2.0-SNAPSHOT"
javassist = "3.28.0-GA" javassist = "3.28.0-GA"
@ -34,6 +35,8 @@ 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" }