Remove EntityMeta storage
This commit is contained in:
parent
debf77de54
commit
2b29bf1c9b
2 changed files with 1 additions and 29 deletions
|
@ -29,7 +29,6 @@ import static me.tofaa.entitylib.meta.MetaOffsetConverter.EntityMetaOffsets.*;
|
||||||
public class EntityMeta implements EntityMetadataProvider {
|
public class EntityMeta implements EntityMetadataProvider {
|
||||||
|
|
||||||
private static final MetaConverterRegistry registry = new MetaConverterRegistry();
|
private static final MetaConverterRegistry registry = new MetaConverterRegistry();
|
||||||
private static final Map<Integer, EntityMeta> metaMap = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public static @NotNull BiFunction<Integer, Metadata, EntityMeta> getConverter(EntityType entityType) {
|
public static @NotNull BiFunction<Integer, Metadata, EntityMeta> getConverter(EntityType entityType) {
|
||||||
return registry.get(entityType);
|
return registry.get(entityType);
|
||||||
|
@ -42,13 +41,7 @@ public class EntityMeta implements EntityMetadataProvider {
|
||||||
public static @NotNull EntityMeta createMeta(int entityId, EntityType entityType) {
|
public static @NotNull EntityMeta createMeta(int entityId, EntityType entityType) {
|
||||||
Metadata metadata = new Metadata(entityId);
|
Metadata metadata = new Metadata(entityId);
|
||||||
BiFunction<Integer, Metadata, EntityMeta> converter = getConverter(entityType);
|
BiFunction<Integer, Metadata, EntityMeta> converter = getConverter(entityType);
|
||||||
EntityMeta entityMeta = converter.apply(entityId, metadata);
|
return converter.apply(entityId, metadata);
|
||||||
metaMap.put(entityId, entityMeta);
|
|
||||||
return entityMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @Nullable EntityMeta getMeta(int entityId) {
|
|
||||||
return metaMap.get(entityId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final byte OFFSET = 0;
|
public static final byte OFFSET = 0;
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package me.tofaa.entitylib.meta;
|
|
||||||
|
|
||||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
|
||||||
import me.tofaa.entitylib.utils.ConcurrentWeakIdentityHashMap;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
final class MultiMeta {
|
|
||||||
|
|
||||||
private final WeakReference<EntityMeta> parent;
|
|
||||||
private final Map<UUID, List<EntityData>> replacements;
|
|
||||||
|
|
||||||
MultiMeta(EntityMeta parent) {
|
|
||||||
this.parent = new WeakReference<>(parent);
|
|
||||||
this.replacements = new ConcurrentWeakIdentityHashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue