Data class
Пакет: com.hypixel.hytale.component
Файл: com/hypixel/hytale/component/ComponentRegistry.java
Поля (24)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
break |
|
private final Map<String, Codec<Component<ECS_TYPE>>> |
codecMap |
|
private final Object2IntMap<String> |
componentIdToIndex |
|
private final String[] |
componentIds |
|
private final int |
componentSize |
|
private final DataChange[] |
dataChanges |
|
private final BuilderCodec<Holder<ECS_TYPE>> |
entityCodec |
|
private final ComponentRegistry<ECS_TYPE> |
registry |
|
private final Object2IntMap<String> |
resourceIdToIndex |
|
private final String[] |
resourceIds |
|
private final int |
resourceSize |
|
private final ISystem<ECS_TYPE>[] |
sortedSystems |
|
private final int |
systemSize |
|
private final int |
systemTypeSize |
|
private final BitSet[] |
systemTypeToSystemIndex |
|
Function |
var1 |
|
int |
var2 |
|
int |
var2 |
|
int |
var2 |
|
int |
var2 |
|
|
var2 |
|
ComponentRegistry.Data |
var2 |
|
Object2ObjectOpenHashMap |
var4 |
|
private final int |
version |
Методы (34)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public void |
appendDumppublic void appendDump(@Nonnull String var1, @Nonnull StringBuilder var2) |
|
private BuilderCodec<Holder<ECS_TYPE>> |
createCodecprivate BuilderCodec<Holder<ECS_TYPE>> createCodec() |
|
public <T extends Component<ECS_TYPE>> T |
createComponentpublic <T extends Component<ECS_TYPE>> T createComponent(@Nonnull ComponentType<ECS_TYPE, T> var1) |
|
public <T extends Resource<ECS_TYPE>> T |
createResourcepublic <T extends Resource<ECS_TYPE>> T createResource(@Nonnull ResourceType<ECS_TYPE, T> var1) |
|
public boolean |
equalspublic boolean equals(@Nullable Object var1) |
|
|
for for(int var5 = 0; var5 < this.componentSize; var5++) |
|
|
for for(int var3 = 0; var3 < this.sortedSystems.length; var3++) |
|
|
for for(int var3 = 0; var3 < this.componentSize; var3++) |
|
|
for for(int var4 = 0; var4 < this.resourceSize; var4++) |
|
|
for for(int var5 = 0; var5 < this.systemSize; var5++) |
|
|
for for(int var6 = 0; var6 < this.dataChanges.length; var6++) |
|
public <T extends Component<ECS_TYPE>> Codec<T> |
getComponentCodecpublic <T extends Component<ECS_TYPE>> Codec<T> getComponentCodec(@Nonnull ComponentType<ECS_TYPE, T> var1) |
|
public String |
getComponentIdpublic String getComponentId(@Nonnull ComponentType<ECS_TYPE, ?> var1) |
|
public int |
getComponentSizepublic int getComponentSize() |
|
public DataChange |
getDataChangepublic DataChange getDataChange(int var1) |
|
public int |
getDataChangeCountpublic int getDataChangeCount() |
|
public BuilderCodec<Holder<ECS_TYPE>> |
getEntityCodecpublic BuilderCodec<Holder<ECS_TYPE>> getEntityCodec() |
|
public ComponentRegistry<ECS_TYPE> |
getRegistrypublic ComponentRegistry<ECS_TYPE> getRegistry() |
|
public <T extends Resource<ECS_TYPE>> BuilderCodec<T> |
getResourceCodecpublic <T extends Resource<ECS_TYPE>> BuilderCodec<T> getResourceCodec(@Nonnull ResourceType<ECS_TYPE, T> var1) |
|
public String |
getResourceIdpublic String getResourceId(@Nonnull ResourceType<ECS_TYPE, ?> var1) |
|
public int |
getResourceSizepublic int getResourceSize() |
|
public ISystem<ECS_TYPE> |
getSystempublic ISystem<ECS_TYPE> getSystem(int var1) |
|
public <T extends ISystem<ECS_TYPE>> T |
getSystempublic <T extends ISystem<ECS_TYPE>> T getSystem(int var1, SystemType<ECS_TYPE, T> var2) |
|
public <T extends ISystem<ECS_TYPE>> BitSet |
getSystemIndexesForTypepublic <T extends ISystem<ECS_TYPE>> BitSet getSystemIndexesForType(@Nonnull SystemType<ECS_TYPE, T> var1) |
|
public int |
getSystemSizepublic int getSystemSize() |
|
public <T extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE, T> |
getSystemTypepublic <T extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE, T> getSystemType(Class<? super T> var1) |
|
public int |
getSystemTypeSizepublic int getSystemTypeSize() |
|
public int |
getVersionpublic int getVersion() |
|
public int |
hashCodepublic int hashCode() |
|
|
if if(this.componentCodecs[var5] != null) |
|
|
if if(this.sortedSystems[var3] == var1) |
|
|
if if(this == var1) |
|
public int |
indexOfpublic int indexOf(ISystem<ECS_TYPE> var1) |
|
public String |
toStringpublic String toString() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.component;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.ExtraInfo;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.lookup.MapProvidedMapCodec;
class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.component.data.change.ChangeType;
class="kw">import com.hypixel.hytale.component.data.change.ComponentChange;
class="kw">import com.hypixel.hytale.component.data.change.DataChange;
class="kw">import com.hypixel.hytale.component.data.change.ResourceChange;
class="kw">import com.hypixel.hytale.component.data.change.SystemChange;
class="kw">import com.hypixel.hytale.component.data.change.SystemGroupChange;
class="kw">import com.hypixel.hytale.component.data.change.SystemTypeChange;
class="kw">import com.hypixel.hytale.component.data.unknown.TempUnknownComponent;
class="kw">import com.hypixel.hytale.component.data.unknown.UnknownComponents;
class="kw">import com.hypixel.hytale.component.dependency.Dependency;
class="kw">import com.hypixel.hytale.component.event.EntityEventType;
class="kw">import com.hypixel.hytale.component.event.EntityHolderEventType;
class="kw">import com.hypixel.hytale.component.event.WorldEventType;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.query.ReadWriteArchetypeQuery;
class="kw">import com.hypixel.hytale.component.spatial.SpatialResource;
class="kw">import com.hypixel.hytale.component.spatial.SpatialStructure;
class="kw">import com.hypixel.hytale.component.system.EcsEvent;
class="kw">import com.hypixel.hytale.component.system.EntityEventSystem;
class="kw">import com.hypixel.hytale.component.system.EntityHolderEventSystem;
class="kw">import com.hypixel.hytale.component.system.HolderSystem;
class="kw">import com.hypixel.hytale.component.system.ISystem;
class="kw">import com.hypixel.hytale.component.system.QuerySystem;
class="kw">import com.hypixel.hytale.component.system.RefChangeSystem;
class="kw">import com.hypixel.hytale.component.system.RefSystem;
class="kw">import com.hypixel.hytale.component.system.System;
class="kw">import com.hypixel.hytale.component.system.WorldEventSystem;
class="kw">import com.hypixel.hytale.component.system.tick.ArchetypeTickingSystem;
class="kw">import com.hypixel.hytale.component.system.tick.RunWhenPausedSystem;
class="kw">import com.hypixel.hytale.component.system.tick.TickableSystem;
class="kw">import com.hypixel.hytale.component.system.tick.TickingSystem;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntMaps;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import java.lang.ref.Reference;
class="kw">import java.lang.ref.ReferenceQueue;
class="kw">import java.lang.ref.WeakReference;
class="kw">import java.util.Arrays;
class="kw">import java.util.BitSet;
class="kw">import java.util.Collections;
class="kw">import java.util.HashSet;
class="kw">import java.util.LinkedHashMap;
class="kw">import java.util.List;
class="kw">import java.util.Map;
class="kw">import java.util.Optional;
class="kw">import java.util.Set;
class="kw">import java.util.concurrent.ConcurrentHashMap;
class="kw">import java.util.concurrent.atomic.AtomicInteger;
class="kw">import java.util.concurrent.locks.ReadWriteLock;
class="kw">import java.util.concurrent.locks.ReentrantReadWriteLock;
class="kw">import java.util.concurrent.locks.StampedLock;
class="kw">import java.util.function.Consumer;
class="kw">import java.util.function.Function;
class="kw">import java.util.function.Supplier;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.bson.BsonDocument;
class="kw">public class ComponentRegistry<ECS_TYPE> class="kw">implements IComponentRegistry<ECS_TYPE> {
class="kw">public class="kw">static class="kw">final int UNASSIGNED_INDEX = Integer.MIN_VALUE;
class="kw">public class="kw">static class="kw">final int DEFAULT_INITIAL_SIZE = 16;
class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Deprecated
class="kw">private class="kw">static class="kw">final KeyedCodec<Integer> VERSION = new KeyedCodec<>("Version", Codec.INTEGER);
class="kw">private class="kw">static class="kw">final AtomicInteger REFERENCE_THREAD_COUNTER = new AtomicInteger();
class="kw">private boolean shutdown;
class="kw">private class="kw">final StampedLock dataLock = new StampedLock();
@Nonnull
class="kw">private class="kw">final Object2IntMap<String> componentIdToIndex = new Object2IntOpenHashMap(16);
class="kw">private class="kw">final BitSet componentIndexReuse = new BitSet();
class="kw">private int componentSize;
@Nonnull
class="kw">private String[] componentIds = new String[16];
@Nonnull
class="kw">private BuilderCodec<? class="kw">extends Component<ECS_TYPE>>[] componentCodecs = new BuilderCodec[16];
@Nonnull
class="kw">private Supplier<? class="kw">extends Component<ECS_TYPE>>[] componentSuppliers = new Supplier[16];
@Nonnull
class="kw">private ComponentType<ECS_TYPE, ? class="kw">extends Component<ECS_TYPE>>[] componentTypes = new ComponentType[16];
@Nonnull
class="kw">private class="kw">final Object2IntMap<String> resourceIdToIndex = new Object2IntOpenHashMap(16);
class="kw">private class="kw">final BitSet resourceIndexReuse = new BitSet();
class="kw">private int resourceSize;
@Nonnull
class="kw">private String[] resourceIds = new String[16];
@Nonnull
class="kw">private BuilderCodec<? class="kw">extends Resource<ECS_TYPE>>[] resourceCodecs = new BuilderCodec[16];
@Nonnull
class="kw">private Supplier<? class="kw">extends Resource<ECS_TYPE>>[] resourceSuppliers = new Supplier[16];
@Nonnull
class="kw">private ResourceType<ECS_TYPE, ? class="kw">extends Resource<ECS_TYPE>>[] resourceTypes = new ResourceType[16];
@Nonnull
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends ISystem<ECS_TYPE>>> systemTypeClassToIndex = new Object2IntOpenHashMap(16);
@Nonnull
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends EcsEvent>> entityEventTypeClassToIndex = new Object2IntOpenHashMap(16);
@Nonnull
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends EcsEvent>> entityHolderEventTypeClassToIndex = new Object2IntOpenHashMap(16);
@Nonnull
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends EcsEvent>> worldEventTypeClassToIndex = new Object2IntOpenHashMap(16);
class="kw">private class="kw">final BitSet systemTypeIndexReuse = new BitSet();
class="kw">private int systemTypeSize;
@Nonnull
class="kw">private SystemType<ECS_TYPE, ? class="kw">extends ISystem<ECS_TYPE>>[] systemTypes = new SystemType[16];
class="kw">private BitSet[] systemTypeToSystemIndex = new BitSet[16];
class="kw">private class="kw">final BitSet systemGroupIndexReuse = new BitSet();
class="kw">private int systemGroupSize;
@Nonnull
class="kw">private SystemGroup<ECS_TYPE>[] systemGroups = new SystemGroup[16];
class="kw">private int systemSize;
@Nonnull
class="kw">private ISystem<ECS_TYPE>[] systems = new ISystem[16];
@Nonnull
class="kw">private ISystem<ECS_TYPE>[] sortedSystems = new ISystem[16];
@Nonnull
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends ISystem<ECS_TYPE>>> systemClasses = new Object2IntOpenHashMap(16);
@Nonnull
class="kw">private class="kw">final Object2BooleanMap<Class<? class="kw">extends ISystem<ECS_TYPE>>> systemBypassClassCheck = new Object2BooleanOpenHashMap(16);
@Nonnull
class="kw">private class="kw">final StampedLock storeLock = new StampedLock();
class="kw">private int storeSize;
@Nonnull
class="kw">private Store<ECS_TYPE>[] stores = new Store[16];
class="kw">private class="kw">final ReadWriteLock dataUpdateLock = new ReentrantReadWriteLock();
class="kw">private ComponentRegistry.Data<ECS_TYPE> data;
class="kw">private class="kw">final Set<Reference<Holder<ECS_TYPE>>> holders = ConcurrentHashMap.newKeySet();
class="kw">private class="kw">final ReferenceQueue<Holder<ECS_TYPE>> holderReferenceQueue = new ReferenceQueue<>();
@Nonnull
class="kw">private class="kw">final Thread holderReferenceThread;
@Nonnull
class="kw">private class="kw">final ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> unknownComponentType;
@Nonnull
class="kw">private class="kw">final ComponentType<ECS_TYPE, NonTicking<ECS_TYPE>> nonTickingComponentType;
@Nonnull
class="kw">private class="kw">final ComponentType<ECS_TYPE, NonSerialized<ECS_TYPE>> nonSerializedComponentType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, HolderSystem<ECS_TYPE>> holderSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, RefSystem<ECS_TYPE>> refSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, RefChangeSystem<ECS_TYPE, ?>> refChangeSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, QuerySystem<ECS_TYPE>> querySystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, TickingSystem<ECS_TYPE>> tickingSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, TickableSystem<ECS_TYPE>> tickableSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, RunWhenPausedSystem<ECS_TYPE>> runWhenPausedSystemType;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, ArchetypeTickingSystem<ECS_TYPE>> archetypeTickingSystemType;
class="kw">public ComponentRegistry() {
this.componentIdToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.resourceIdToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.systemTypeClassToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.entityEventTypeClassToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.entityHolderEventTypeClassToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.worldEventTypeClassToIndex.defaultReturnValue(Integer.MIN_VALUE);
for (int var1 = 0; var1 < 16; var1++) {
this.systemTypeToSystemIndex[var1] = new BitSet();
}
this.data = new ComponentRegistry.Data<>(this);
this.unknownComponentType = this.registerComponent(UnknownComponents.class, "Unknown", UnknownComponents.CODEC);
this.nonTickingComponentType = this.registerComponent(NonTicking.class, NonTicking::get);
this.nonSerializedComponentType = this.registerComponent(NonSerialized.class, NonSerialized::get);
this.holderSystemType = this.registerSystemType(HolderSystem.class);
this.refSystemType = this.registerSystemType(RefSystem.class);
this.refChangeSystemType = this.registerSystemType(RefChangeSystem.class);
this.querySystemType = this.registerSystemType(QuerySystem.class);
this.tickingSystemType = this.registerSystemType(TickingSystem.class);
this.tickableSystemType = this.registerSystemType(TickableSystem.class);
this.runWhenPausedSystemType = this.registerSystemType(RunWhenPausedSystem.class);
this.archetypeTickingSystemType = this.registerSystemType(ArchetypeTickingSystem.class);
this.holderReferenceThread = new Thread(() -> {
try {
while (!Thread.interrupted()) {
this.holders.remove(this.holderReferenceQueue.remove());
}
} catch (InterruptedException var2) {
Thread.currentThread().interrupt();
}
}, "EntityHolderReferenceThread-" + REFERENCE_THREAD_COUNTER.getAndIncrement());
this.holderReferenceThread.setDaemon(true);
this.holderReferenceThread.start();
}
class="kw">public boolean isShutdown() {
class="kw">return this.shutdown;
}
class="kw">public void shutdown() {
this.shutdown0();
}
void shutdown0() {
this.shutdown = true;
this.holderReferenceThread.interrupt();
long var1 = this.storeLock.writeLock();
try {
for (int var3 = this.storeSize - 1; var3 >= 0; var3--) {
Store var4 = this.stores[var3];
if (var4 != null) {
var4.shutdown0(this.data);
}
}
this.stores = Store.EMPTY_ARRAY;
} class="kw">finally {
this.storeLock.unlockWrite(var1);
}
}
@Nonnull
class="kw">public ReadWriteLock getDataUpdateLock() {
class="kw">return this.dataUpdateLock;
}
@Nonnull
class="kw">public ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> getUnknownComponentType() {
class="kw">return this.unknownComponentType;
}
@Nonnull
class="kw">public ComponentType<ECS_TYPE, NonTicking<ECS_TYPE>> getNonTickingComponentType() {
class="kw">return this.nonTickingComponentType;
}
@Nonnull
class="kw">public ComponentType<ECS_TYPE, NonSerialized<ECS_TYPE>> getNonSerializedComponentType() {
class="kw">return this.nonSerializedComponentType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, HolderSystem<ECS_TYPE>> getHolderSystemType() {
class="kw">return this.holderSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, RefSystem<ECS_TYPE>> getRefSystemType() {
class="kw">return this.refSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, RefChangeSystem<ECS_TYPE, ?>> getRefChangeSystemType() {
class="kw">return this.refChangeSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, QuerySystem<ECS_TYPE>> getQuerySystemType() {
class="kw">return this.querySystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, TickingSystem<ECS_TYPE>> getTickingSystemType() {
class="kw">return this.tickingSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, TickableSystem<ECS_TYPE>> getTickableSystemType() {
class="kw">return this.tickableSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, RunWhenPausedSystem<ECS_TYPE>> getRunWhenPausedSystemType() {
class="kw">return this.runWhenPausedSystemType;
}
@Nonnull
class="kw">public SystemType<ECS_TYPE, ArchetypeTickingSystem<ECS_TYPE>> getArchetypeTickingSystemType() {
class="kw">return this.archetypeTickingSystemType;
}
@Nonnull
@Override
class="kw">public <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent(@Nonnull Class<? super T> var1, @Nonnull Supplier<T> var2) {
class="kw">return this.registerComponent(var1, null, null, var2, false);
}
@Nonnull
@Override
class="kw">public <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent(
@Nonnull Class<? super T> var1, @Nonnull String var2, @Nonnull BuilderCodec<T> var3
) {
class="kw">return this.registerComponent(var1, var2, var3, var3::getDefaultValue, false);
}
@Deprecated
@Nonnull
class="kw">public <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent(
@Nonnull Class<? super T> var1, @Nonnull String var2, @Nonnull BuilderCodec<T> var3, boolean var4
) {
class="kw">return this.registerComponent(var1, var2, var3, var3::getDefaultValue, var4);
}
@Nonnull
class="kw">private <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent(
@Nonnull Class<? super T> var1, @Nullable String var2, @Nullable BuilderCodec<T> var3, @Nonnull Supplier<T> var4, boolean var5
) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (var3 != null && !var5) {
ExtraInfo var6 = ExtraInfo.THREAD_LOCAL.get();
var3.validateDefaults(var6, new HashSet<>());
var6.getValidationResults().logOrThrowValidatorExceptions(LOGGER, "Default Asset Validation Failed!\n");
}
long var13 = this.dataLock.writeLock();
try {
ComponentType var8 = this.registerComponent0(var1, var2, var3, var4, new ComponentType<>());
var13 = this.dataLock.tryConvertToReadLock(var13);
this.updateData0(new ComponentChange<>(ChangeType.REGISTERED, var8));
class="kw">return var8;
} class="kw">finally {
this.dataLock.unlock(var13);
}
}
class="kw">public <T class="kw">extends Component<ECS_TYPE>> void unregisterComponent(@Nonnull ComponentType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validateRegistry(this);
var1.validate();
if (var1.equals(this.unknownComponentType)) {
throw new IllegalArgumentException("UnknownComponentType can not be unregistered!");
}
long var2 = this.dataLock.writeLock();
try {
this.unregisterComponent0(var1);
List var4 = new ObjectArrayList();
var4.add(new ComponentChange<>(ChangeType.UNREGISTERED, var1));
for (int var5 = this.systemSize - 1; var5 >= 0; var5--) {
ISystem var6 = this.systems[var5];
if (var6 class="kw">instanceof QuerySystem var7) {
Query var8 = var7.getQuery();
if (var8 != null && var8.requiresComponentType(var1)) {
this.unregisterSystem0(var5, var6);
var4.add(new SystemChange<>(ChangeType.UNREGISTERED, var6));
}
}
}
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(var4.toArray(DataChange[]::new));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public <T class="kw">extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE, T> registerResource(@Nonnull Class<? super T> var1, @Nonnull Supplier<T> var2) {
class="kw">return this.registerResource(var1, null, null, var2);
}
@Nonnull
@Override
class="kw">public <T class="kw">extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE, T> registerResource(
@Nonnull Class<? super T> var1, @Nonnull String var2, @Nonnull BuilderCodec<T> var3
) {
class="kw">return this.registerResource(var1, var2, var3, var3::getDefaultValue);
}
@Nonnull
class="kw">private <T class="kw">extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE, T> registerResource(
@Nonnull Class<? super T> var1, @Nullable String var2, @Nullable BuilderCodec<T> var3, @Nonnull Supplier<T> var4
) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (var3 != null) {
ExtraInfo var5 = ExtraInfo.THREAD_LOCAL.get();
var3.validateDefaults(var5, new HashSet<>());
var5.getValidationResults().logOrThrowValidatorExceptions(LOGGER, "Default Asset Validation Failed!\n");
}
long var12 = this.dataLock.writeLock();
try {
ResourceType var7 = this.registerResource0(var1, var2, var3, var4, new ResourceType<>());
var12 = this.dataLock.tryConvertToReadLock(var12);
this.updateData0(new ResourceChange<>(ChangeType.REGISTERED, var7));
class="kw">return var7;
} class="kw">finally {
this.dataLock.unlock(var12);
}
}
class="kw">public <T class="kw">extends Resource<ECS_TYPE>> void unregisterResource(@Nonnull ResourceType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validateRegistry(this);
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterResource0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new ResourceChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE, T> registerSystemType(@Nonnull Class<? super T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (!ISystem.class.isAssignableFrom(var1)) {
throw new IllegalArgumentException("systemTypeClass must extend ComponentSystem! " + var1);
}
long var2 = this.dataLock.writeLock();
try {
SystemType var4 = this.registerSystemType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.REGISTERED, var4));
class="kw">return var4;
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> void unregisterSystemType(@Nonnull SystemType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterSystemType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public <T class="kw">extends EcsEvent> EntityEventType<ECS_TYPE, T> registerEntityEventType(@Nonnull Class<? super T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (!EcsEvent.class.isAssignableFrom(var1)) {
throw new IllegalArgumentException("eventTypeClass must extend EcsEvent! " + var1);
}
long var2 = this.dataLock.writeLock();
try {
EntityEventType var4 = this.registerEntityEventType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.REGISTERED, var4));
class="kw">return var4;
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public <T class="kw">extends EcsEvent> WorldEventType<ECS_TYPE, T> registerWorldEventType(@Nonnull Class<? super T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (!EcsEvent.class.isAssignableFrom(var1)) {
throw new IllegalArgumentException("eventTypeClass must extend EcsEvent! " + var1);
}
long var2 = this.dataLock.writeLock();
try {
WorldEventType var4 = this.registerWorldEventType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.REGISTERED, var4));
class="kw">return var4;
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
class="kw">public <T class="kw">extends EcsEvent> void unregisterEntityEventType(@Nonnull EntityEventType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterEntityEventType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
class="kw">public <T class="kw">extends EcsEvent> void unregisterEntityHolderEventType(@Nonnull EntityHolderEventType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterEntityHolderEventType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
class="kw">public <T class="kw">extends EcsEvent> void unregisterWorldEventType(@Nonnull WorldEventType<ECS_TYPE, T> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterWorldEventType0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemTypeChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public SystemGroup<ECS_TYPE> registerSystemGroup() {
class="kw">return this.registerSystemGroup(Collections.emptySet());
}
@Nonnull
class="kw">public SystemGroup<ECS_TYPE> registerSystemGroup(Set<Dependency<ECS_TYPE>> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
long var2 = this.dataLock.writeLock();
try {
SystemGroup var4 = this.registerSystemGroup0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemGroupChange<>(ChangeType.REGISTERED, var4));
class="kw">return var4;
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
class="kw">public void unregisterSystemGroup(@Nonnull SystemGroup<ECS_TYPE> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
var1.validate();
long var2 = this.dataLock.writeLock();
try {
this.unregisterSystemGroup0(var1);
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(new SystemGroupChange<>(ChangeType.UNREGISTERED, var1));
var1.invalidate();
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Override
class="kw">public void registerSystem(@Nonnull ISystem<ECS_TYPE> var1) {
this.registerSystem(var1, false);
}
@Deprecated(forRemoval = true)
class="kw">public void registerSystem(@Nonnull ISystem<ECS_TYPE> var1, boolean var2) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
Class var3 = (Class<? class="kw">extends ISystem>)var1.getClass();
if (var1 class="kw">instanceof QuerySystem var4) {
Query var5 = var4.getQuery();
var5.validateRegistry(this);
var5.validate();
if (var5 class="kw">instanceof ReadWriteArchetypeQuery var6 && var6.getReadArchetype().equals(var6.getWriteArchetype())) {
LOGGER.at(Level.WARNING)
.log(
"%s.getQuery() is using ReadWriteArchetypeEntityQuery with the same `Read` and `Modified` Archetype! This can be simplified by using the Archetype directly as the EntityQuery.",
var3.getName()
);
}
}
long var14 = this.dataLock.writeLock();
try {
if (!var2) {
if (this.systemClasses.containsKey(var3)) {
throw new IllegalArgumentException("System of type " + var3.getName() + " is already registered!");
}
} else {
this.systemBypassClassCheck.put(var3, true);
}
if (ArrayUtil.indexOf(this.systems, var1) != -1) {
throw new IllegalArgumentException("System is already registered!");
}
for (Dependency var7 : var1.getDependencies()) {
var7.validate(this);
}
this.registerSystem0(var1);
List var16 = new ObjectArrayList();
var16.add(new SystemChange<>(ChangeType.REGISTERED, var1));
if (var1 class="kw">instanceof System var17) {
for (ComponentRegistration var9 : var17.getComponentRegistrations()) {
ComponentType var10 = this.registerComponent0((ComponentRegistration<ECS_TYPE, ? class="kw">extends Component<ECS_TYPE>>)var9);
var16.add(new ComponentChange<>(ChangeType.REGISTERED, var10));
}
for (ResourceRegistration var25 : var17.getResourceRegistrations()) {
ResourceType var26 = this.registerResource0((ResourceRegistration<ECS_TYPE, ? class="kw">extends Resource<ECS_TYPE>>)var25);
var16.add(new ResourceChange<>(ChangeType.REGISTERED, var26));
}
}
if (var1 class="kw">instanceof EntityEventSystem var18 && !this.entityEventTypeClassToIndex.containsKey(var18.getEventType())) {
EntityEventType var22 = this.registerEntityEventType0(var18.getEventType());
var16.add(new SystemTypeChange<>(ChangeType.REGISTERED, (SystemType<ECS_TYPE, EntityEventSystem<ECS_TYPE, EcsEvent>>)var22));
}
if (var1 class="kw">instanceof EntityHolderEventSystem var19 && !this.entityHolderEventTypeClassToIndex.containsKey(var19.getEventType())) {
EntityHolderEventType var23 = this.registerEntityHolderEventType0(var19.getEventType());
var16.add(new SystemTypeChange<>(ChangeType.REGISTERED, (SystemType<ECS_TYPE, EntityHolderEventSystem<ECS_TYPE, EcsEvent>>)var23));
}
if (var1 class="kw">instanceof WorldEventSystem var20 && !this.worldEventTypeClassToIndex.containsKey(var20.getEventType())) {
WorldEventType var24 = this.registerWorldEventType0(var20.getEventType());
var16.add(new SystemTypeChange<>(ChangeType.REGISTERED, (SystemType<ECS_TYPE, WorldEventSystem<ECS_TYPE, EcsEvent>>)var24));
}
var14 = this.dataLock.tryConvertToReadLock(var14);
this.updateData0(var16.toArray(DataChange[]::new));
} class="kw">finally {
this.dataLock.unlock(var14);
}
}
class="kw">public void unregisterSystem(@Nonnull Class<? class="kw">extends ISystem<ECS_TYPE>> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
long var2 = this.dataLock.writeLock();
try {
int var4 = this.systemClasses.getInt(var1);
ISystem var5 = this.systems[var4];
if (var5 != null) {
if (var5 class="kw">instanceof QuerySystem var6) {
Query var7 = var6.getQuery();
var7.validateRegistry(this);
var7.validate();
}
int var14 = ArrayUtil.indexOf(this.systems, var5);
if (var14 == -1) {
throw new IllegalArgumentException("System is not registered!");
}
this.unregisterSystem0(var14, var5);
List var15 = new ObjectArrayList();
var15.add(new SystemChange<>(ChangeType.UNREGISTERED, var5));
if (var5 class="kw">instanceof System var8) {
for (ComponentRegistration var10 : var8.getComponentRegistrations()) {
this.unregisterComponent0(var10.componentType());
var15.add(new ComponentChange<>(ChangeType.UNREGISTERED, var10.componentType()));
}
for (ResourceRegistration var17 : var8.getResourceRegistrations()) {
this.unregisterResource0(var17.resourceType());
var15.add(new ResourceChange<>(ChangeType.UNREGISTERED, var17.resourceType()));
}
}
var2 = this.dataLock.tryConvertToReadLock(var2);
this.updateData0(var15.toArray(DataChange[]::new));
class="kw">return;
}
} class="kw">finally {
this.dataLock.unlock(var2);
}
}
@Nonnull
@Override
class="kw">public ResourceType<ECS_TYPE, SpatialResource<Ref<ECS_TYPE>, ECS_TYPE>> registerSpatialResource(@Nonnull Supplier<SpatialStructure<Ref<ECS_TYPE>>> var1) {
class="kw">return this.registerResource(SpatialResource.class, () -> new SpatialResource<>(var1.get()));
}
@Nonnull
class="kw">public Store<ECS_TYPE> addStore(@Nonnull ECS_TYPE var1, @Nonnull IResourceStorage var2) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
} else {
class="kw">return this.addStore0(var1, var2, var0 -> {});
}
}
@Nonnull
class="kw">public Store<ECS_TYPE> addStore(@Nonnull ECS_TYPE var1, @Nonnull IResourceStorage var2, Consumer<Store<ECS_TYPE>> var3) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
} else {
class="kw">return this.addStore0(var1, var2, var3);
}
}
class="kw">public void removeStore(@Nonnull Store<ECS_TYPE> var1) {
if (this.shutdown) {
throw new IllegalStateException("Registry has been shutdown");
}
if (var1.isShutdown()) {
throw new IllegalStateException("Store is already shutdown!");
}
this.removeStore0(var1);
}
@Nonnull
class="kw">public Holder<ECS_TYPE> newHolder() {
Holder var1 = new Holder<>(this);
this.holders.add(new WeakReference<>(var1, this.holderReferenceQueue));
class="kw">return var1;
}
@Nonnull
class="kw">public Holder<ECS_TYPE> newHolder(@Nonnull Archetype<ECS_TYPE> var1, @Nonnull Component<ECS_TYPE>[] var2) {
Holder var3 = new Holder<>(this, var1, var2);
this.holders.add(new WeakReference<>(var3, this.holderReferenceQueue));
class="kw">return var3;
}
@Nonnull
class="kw">protected Holder<ECS_TYPE> _internal_newEntityHolder() {
class="kw">return new Holder<>();
}
class="kw">public ComponentRegistry.Data<ECS_TYPE> _internal_getData() {
class="kw">return this.data;
}
class="kw">public ComponentRegistry.Data<ECS_TYPE> getData() {
this.assertInStoreThread();
class="kw">return this.data;
}
@Nonnull
class="kw">public BuilderCodec<Holder<ECS_TYPE>> getEntityCodec() {
class="kw">return this.data.getEntityCodec();
}
class="kw">public void assertInStoreThread() {
long var1 = this.storeLock.readLock();
try {
for (int var3 = 0; var3 < this.storeSize; var3++) {
if (this.stores[var3].isInThread()) {
class="kw">return;
}
}
throw new AssertionError("Data can only be accessed from a store thread!");
} class="kw">finally {
this.storeLock.unlockRead(var1);
}
}
@Nullable
class="kw">public Holder<ECS_TYPE> deserialize(@Nonnull BsonDocument var1) {
Optional var2 = VERSION.get(var1);
if (var2.isPresent()) {
class="kw">return this.deserialize(var1, var2.get());
}
ExtraInfo var3 = ExtraInfo.THREAD_LOCAL.get();
Holder var4 = this.data.getEntityCodec().decode(var1, var3);
var3.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
class="kw">return var4;
}
@Nullable
@Deprecated
class="kw">public Holder<ECS_TYPE> deserialize(@Nonnull BsonDocument var1, int var2) {
ExtraInfo var3 = new ExtraInfo(var2);
Holder var4 = this.data.getEntityCodec().decode(var1, var3);
var3.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
class="kw">return var4;
}
class="kw">public BsonDocument serialize(@Nonnull Holder<ECS_TYPE> var1) {
ExtraInfo var2 = ExtraInfo.THREAD_LOCAL.get();
BsonDocument var3 = this.data.getEntityCodec().encode(var1, var2).asDocument();
var2.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
class="kw">return var3;
}
class="kw">public boolean hasSystem(@Nonnull ISystem<ECS_TYPE> var1) {
class="kw">return ArrayUtil.indexOf(this.systems, var1, 0, this.systemSize) != -1;
}
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> boolean hasSystemClass(@Nonnull Class<T> var1) {
class="kw">return this.systemClasses.containsKey(var1);
}
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> boolean hasSystemType(@Nonnull SystemType<ECS_TYPE, T> var1) {
class="kw">return this.systemTypeClassToIndex.containsKey(var1.getTypeClass());
}
class="kw">public boolean hasSystemGroup(@Nonnull SystemGroup<ECS_TYPE> var1) {
class="kw">return ArrayUtil.indexOf(this.systemGroups, var1) != -1;
}
@Nonnull
class="kw">private <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent0(@Nonnull ComponentRegistration<ECS_TYPE, T> var1) {
class="kw">return this.registerComponent0(var1.typeClass(), var1.id(), var1.codec(), var1.supplier(), var1.componentType());
}
@Nonnull
class="kw">private <T class="kw">extends Component<ECS_TYPE>> ComponentType<ECS_TYPE, T> registerComponent0(
@Nonnull Class<? super T> var1,
@Nullable String var2,
@Nullable BuilderCodec<T> var3,
@Nonnull Supplier<T> var4,
@Nonnull ComponentType<ECS_TYPE, T> var5
) {
if (var2 != null && this.componentIdToIndex.containsKey(var2)) {
throw new IllegalArgumentException("id '" + var2 + "' already exists!");
}
int var6;
if (this.componentIndexReuse.isEmpty()) {
var6 = this.componentSize++;
} else {
var6 = this.componentIndexReuse.nextSetBit(0);
this.componentIndexReuse.clear(var6);
}
if (this.componentIds.length <= var6) {
int var7 = ArrayUtil.grow(var6);
this.componentIds = Arrays.copyOf(this.componentIds, var7);
this.componentCodecs = Arrays.copyOf(this.componentCodecs, var7);
this.componentSuppliers = Arrays.copyOf(this.componentSuppliers, var7);
this.componentTypes = Arrays.copyOf(this.componentTypes, var7);
}
var5.init(this, var1, var6);
this.componentIdToIndex.put(var2, var6);
this.componentIds[var6] = var2;
this.componentCodecs[var6] = var3;
this.componentSuppliers[var6] = var4;
this.componentTypes[var6] = var5;
class="kw">return var5;
}
class="kw">private <T class="kw">extends Component<ECS_TYPE>> void unregisterComponent0(@Nonnull ComponentType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.componentSize - 1) {
int var3 = this.componentIndexReuse.previousClearBit(var2 - 1);
this.componentSize = var3 + 1;
this.componentIndexReuse.clear(this.componentSize, var2);
} else {
this.componentIndexReuse.set(var2);
}
this.componentIdToIndex.removeInt(this.componentIds[var2]);
this.componentIds[var2] = null;
this.componentCodecs[var2] = null;
this.componentSuppliers[var2] = null;
this.componentTypes[var2] = null;
}
@Nonnull
class="kw">private <T class="kw">extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE, T> registerResource0(@Nonnull ResourceRegistration<ECS_TYPE, T> var1) {
class="kw">return this.registerResource0(var1.typeClass(), var1.id(), var1.codec(), var1.supplier(), var1.resourceType());
}
@Nonnull
class="kw">private <T class="kw">extends Resource<ECS_TYPE>> ResourceType<ECS_TYPE, T> registerResource0(
@Nonnull Class<? super T> var1, @Nullable String var2, @Nullable BuilderCodec<T> var3, @Nonnull Supplier<T> var4, @Nonnull ResourceType<ECS_TYPE, T> var5
) {
if (var2 != null && this.resourceIdToIndex.containsKey(var2)) {
throw new IllegalArgumentException("id '" + var2 + "' already exists!");
}
int var6;
if (this.resourceIndexReuse.isEmpty()) {
var6 = this.resourceSize++;
} else {
var6 = this.resourceIndexReuse.nextSetBit(0);
this.resourceIndexReuse.clear(var6);
}
if (this.resourceIds.length <= var6) {
int var7 = ArrayUtil.grow(var6);
this.resourceIds = Arrays.copyOf(this.resourceIds, var7);
this.resourceCodecs = Arrays.copyOf(this.resourceCodecs, var7);
this.resourceSuppliers = Arrays.copyOf(this.resourceSuppliers, var7);
this.resourceTypes = Arrays.copyOf(this.resourceTypes, var7);
}
var5.init(this, var1, var6);
this.resourceIdToIndex.put(var2, var6);
this.resourceIds[var6] = var2;
this.resourceCodecs[var6] = var3;
this.resourceSuppliers[var6] = var4;
this.resourceTypes[var6] = var5;
class="kw">return var5;
}
class="kw">private <T class="kw">extends Resource<ECS_TYPE>> void unregisterResource0(@Nonnull ResourceType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.resourceSize - 1) {
int var3 = this.resourceIndexReuse.previousClearBit(var2 - 1);
this.resourceSize = var3 + 1;
this.resourceIndexReuse.clear(this.resourceSize, var2);
} else {
this.resourceIndexReuse.set(var2);
}
this.resourceIdToIndex.removeInt(this.resourceIds[var2]);
this.resourceIds[var2] = null;
this.resourceCodecs[var2] = null;
this.resourceSuppliers[var2] = null;
this.resourceTypes[var2] = null;
}
@Nonnull
class="kw">private <T class="kw">extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE, T> registerSystemType0(@Nonnull Class<? super T> var1) {
if (this.systemTypeClassToIndex.containsKey(var1)) {
throw new IllegalArgumentException("system type '" + var1 + "' already exists!");
}
int var2;
if (this.systemTypeIndexReuse.isEmpty()) {
var2 = this.systemTypeSize++;
} else {
var2 = this.systemTypeIndexReuse.nextSetBit(0);
this.systemTypeIndexReuse.clear(var2);
}
if (this.systemTypes.length <= var2) {
this.systemTypes = Arrays.copyOf(this.systemTypes, ArrayUtil.grow(var2));
this.systemTypeToSystemIndex = Arrays.copyOf(this.systemTypeToSystemIndex, ArrayUtil.grow(var2));
}
Class var3 = (Class<T>)var1;
SystemType var4 = new SystemType<>(this, var3, var2);
this.systemTypeClassToIndex.put(var3, var2);
this.systemTypes[var2] = var4;
class="kw">return var4;
}
class="kw">private <T class="kw">extends ISystem<ECS_TYPE>> void unregisterSystemType0(@Nonnull SystemType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.systemTypeSize - 1) {
int var3 = this.systemTypeIndexReuse.previousClearBit(var2 - 1);
this.systemTypeSize = var3 + 1;
this.systemTypeIndexReuse.clear(this.systemTypeSize, var2);
} else {
this.systemTypeIndexReuse.set(var2);
}
this.systemTypeClassToIndex.removeInt(var1.getTypeClass());
this.systemTypes[var2] = null;
this.systemTypeToSystemIndex[var2].clear();
}
@Nonnull
class="kw">private <T class="kw">extends EcsEvent> EntityEventType<ECS_TYPE, T> registerEntityEventType0(@Nonnull Class<? super T> var1) {
if (this.entityEventTypeClassToIndex.containsKey(var1)) {
throw new IllegalArgumentException("event type '" + var1 + "' already exists!");
}
int var2;
if (this.systemTypeIndexReuse.isEmpty()) {
var2 = this.systemTypeSize++;
} else {
var2 = this.systemTypeIndexReuse.nextSetBit(0);
this.systemTypeIndexReuse.clear(var2);
}
if (this.systemTypes.length <= var2) {
this.systemTypes = Arrays.copyOf(this.systemTypes, ArrayUtil.grow(var2));
this.systemTypeToSystemIndex = Arrays.copyOf(this.systemTypeToSystemIndex, ArrayUtil.grow(var2));
}
Class var3 = (Class<T>)var1;
EntityEventType var4 = new EntityEventType<>(this, EntityEventSystem.class, var3, var2);
this.entityEventTypeClassToIndex.put(var3, var2);
this.systemTypes[var2] = var4;
class="kw">return var4;
}
class="kw">private <T class="kw">extends EcsEvent> void unregisterEntityEventType0(@Nonnull EntityEventType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.systemTypeSize - 1) {
int var3 = this.systemTypeIndexReuse.previousClearBit(var2 - 1);
this.systemTypeSize = var3 + 1;
this.systemTypeIndexReuse.clear(this.systemTypeSize, var2);
} else {
this.systemTypeIndexReuse.set(var2);
}
this.entityEventTypeClassToIndex.removeInt(var1.getEventClass());
this.systemTypes[var2] = null;
this.systemTypeToSystemIndex[var2].clear();
}
@Nullable
class="kw">public <T class="kw">extends EcsEvent> EntityEventType<ECS_TYPE, T> getEntityEventTypeForClass(Class<T> var1) {
int var2 = this.entityEventTypeClassToIndex.getInt(var1);
class="kw">return var2 == Integer.MIN_VALUE ? null : (EntityEventType)this.systemTypes[var2];
}
@Nonnull
class="kw">private <T class="kw">extends EcsEvent> EntityHolderEventType<ECS_TYPE, T> registerEntityHolderEventType0(@Nonnull Class<? super T> var1) {
if (this.entityHolderEventTypeClassToIndex.containsKey(var1)) {
throw new IllegalArgumentException("event type '" + var1 + "' already exists!");
}
int var2;
if (this.systemTypeIndexReuse.isEmpty()) {
var2 = this.systemTypeSize++;
} else {
var2 = this.systemTypeIndexReuse.nextSetBit(0);
this.systemTypeIndexReuse.clear(var2);
}
if (this.systemTypes.length <= var2) {
this.systemTypes = Arrays.copyOf(this.systemTypes, ArrayUtil.grow(var2));
this.systemTypeToSystemIndex = Arrays.copyOf(this.systemTypeToSystemIndex, ArrayUtil.grow(var2));
}
Class var3 = (Class<T>)var1;
EntityHolderEventType var4 = new EntityHolderEventType<>(this, EntityHolderEventSystem.class, var3, var2);
this.entityHolderEventTypeClassToIndex.put(var3, var2);
this.systemTypes[var2] = var4;
class="kw">return var4;
}
class="kw">private <T class="kw">extends EcsEvent> void unregisterEntityHolderEventType0(@Nonnull EntityHolderEventType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.systemTypeSize - 1) {
int var3 = this.systemTypeIndexReuse.previousClearBit(var2 - 1);
this.systemTypeSize = var3 + 1;
this.systemTypeIndexReuse.clear(this.systemTypeSize, var2);
} else {
this.systemTypeIndexReuse.set(var2);
}
this.entityHolderEventTypeClassToIndex.removeInt(var1.getEventClass());
this.systemTypes[var2] = null;
this.systemTypeToSystemIndex[var2].clear();
}
@Nullable
class="kw">public <T class="kw">extends EcsEvent> EntityHolderEventType<ECS_TYPE, T> getEntityHolderEventTypeForClass(Class<T> var1) {
int var2 = this.entityHolderEventTypeClassToIndex.getInt(var1);
class="kw">return var2 == Integer.MIN_VALUE ? null : (EntityHolderEventType)this.systemTypes[var2];
}
@Nonnull
class="kw">private <T class="kw">extends EcsEvent> WorldEventType<ECS_TYPE, T> registerWorldEventType0(@Nonnull Class<? super T> var1) {
if (this.worldEventTypeClassToIndex.containsKey(var1)) {
throw new IllegalArgumentException("event type '" + var1 + "' already exists!");
}
int var2;
if (this.systemTypeIndexReuse.isEmpty()) {
var2 = this.systemTypeSize++;
} else {
var2 = this.systemTypeIndexReuse.nextSetBit(0);
this.systemTypeIndexReuse.clear(var2);
}
if (this.systemTypes.length <= var2) {
this.systemTypes = Arrays.copyOf(this.systemTypes, ArrayUtil.grow(var2));
this.systemTypeToSystemIndex = Arrays.copyOf(this.systemTypeToSystemIndex, ArrayUtil.grow(var2));
}
Class var3 = (Class<T>)var1;
WorldEventType var4 = new WorldEventType<>(this, WorldEventSystem.class, var3, var2);
this.worldEventTypeClassToIndex.put(var3, var2);
this.systemTypes[var2] = var4;
class="kw">return var4;
}
class="kw">private <T class="kw">extends EcsEvent> void unregisterWorldEventType0(@Nonnull WorldEventType<ECS_TYPE, T> var1) {
int var2 = var1.getIndex();
if (var2 == this.systemTypeSize - 1) {
int var3 = this.systemTypeIndexReuse.previousClearBit(var2 - 1);
this.systemTypeSize = var3 + 1;
this.systemTypeIndexReuse.clear(this.systemTypeSize, var2);
} else {
this.systemTypeIndexReuse.set(var2);
}
this.worldEventTypeClassToIndex.removeInt(var1.getEventClass());
this.systemTypes[var2] = null;
this.systemTypeToSystemIndex[var2].clear();
}
@Nullable
class="kw">public <T class="kw">extends EcsEvent> WorldEventType<ECS_TYPE, T> getWorldEventTypeForClass(Class<T> var1) {
int var2 = this.worldEventTypeClassToIndex.getInt(var1);
class="kw">return var2 == Integer.MIN_VALUE ? null : (WorldEventType)this.systemTypes[var2];
}
@Nonnull
class="kw">private SystemGroup<ECS_TYPE> registerSystemGroup0(@Nonnull Set<Dependency<ECS_TYPE>> var1) {
int var2;
if (this.systemGroupIndexReuse.isEmpty()) {
var2 = this.systemGroupSize++;
} else {
var2 = this.systemGroupIndexReuse.nextSetBit(0);
this.systemGroupIndexReuse.clear(var2);
}
if (this.systemGroups.length <= var2) {
this.systemGroups = Arrays.copyOf(this.systemGroups, ArrayUtil.grow(var2));
}
SystemGroup var3 = new SystemGroup<>(this, var2, var1);
this.systemGroups[var2] = var3;
class="kw">return var3;
}
class="kw">private void unregisterSystemGroup0(@Nonnull SystemGroup<ECS_TYPE> var1) {
int var2 = var1.getIndex();
if (var2 == this.systemGroupSize - 1) {
int var3 = this.systemGroupIndexReuse.previousClearBit(var2 - 1);
this.systemGroupSize = var3 + 1;
this.systemGroupIndexReuse.clear(this.systemGroupSize, var2);
} else {
this.systemGroupIndexReuse.set(var2);
}
this.systemGroups[var2] = null;
}
class="kw">private void registerSystem0(@Nonnull ISystem<ECS_TYPE> var1) {
int var2 = this.systemSize++;
if (this.systems.length <= var2) {
this.systems = Arrays.copyOf(this.systems, ArrayUtil.grow(var2));
}
this.systems[var2] = var1;
this.systemClasses.put(var1.getClass(), var2);
var1.onSystemRegistered();
}
class="kw">private void unregisterSystem0(int var1, @Nonnull ISystem<ECS_TYPE> var2) {
int var3 = this.systemSize - 1;
if (var1 != var3) {
ISystem var4 = this.systems[var3];
this.systems[var1] = var4;
this.systemClasses.put(var4.getClass(), var1);
}
this.systems[var3] = null;
this.systemSize = var3;
Class var6 = (Class<? class="kw">extends ISystem>)var2.getClass();
boolean var5 = this.systemBypassClassCheck.getBoolean(var6);
if (!var5 && !this.systemClasses.remove(var6, var1)) {
throw new IllegalArgumentException("Failed to remove system " + var6.getName() + ", " + var1);
}
var2.onSystemUnregistered();
}
@Nonnull
class="kw">private Store<ECS_TYPE> addStore0(@Nonnull ECS_TYPE var1, @Nonnull IResourceStorage var2, Consumer<Store<ECS_TYPE>> var3) {
long var4 = this.storeLock.writeLock();
try {
int var6 = this.storeSize++;
if (this.stores.length <= var6) {
this.stores = Arrays.copyOf(this.stores, ArrayUtil.grow(var6));
}
Store var7 = new Store<>(this, var6, var1, var2);
this.stores[var6] = var7;
var3.accept(var7);
var7.onAdd(this.data);
class="kw">return var7;
} class="kw">finally {
this.storeLock.unlockWrite(var4);
}
}
class="kw">private void removeStore0(@Nonnull Store<ECS_TYPE> var1) {
var1.shutdown0(this.data);
long var2;
do {
Thread.onSpinWait();
this.doDataUpdate();
var2 = this.storeLock.tryWriteLock();
} while (!this.storeLock.validate(var2));
try {
int var4 = var1.storeIndex;
int var5 = this.storeSize - 1;
if (var4 != var5) {
Store var6 = this.stores[var5];
var6.storeIndex = var4;
this.stores[var4] = var6;
}
this.stores[var5] = null;
this.storeSize = var5;
} class="kw">finally {
this.storeLock.unlockWrite(var2);
}
}
ComponentRegistry.Data<ECS_TYPE> doDataUpdate() {
class="kw">return this.data;
}
class="kw">private void updateData0(@Nonnull DataChange... var1) {
boolean var2 = false;
boolean var3 = false;
for (DataChange var7 : var1) {
if (var7 class="kw">instanceof SystemChange) {
var2 = true;
}
if (var7 class="kw">instanceof SystemTypeChange) {
var3 = true;
}
}
if (var2) {
if (this.sortedSystems.length < this.systems.length) {
this.sortedSystems = Arrays.copyOf(this.systems, this.systems.length);
} else {
java.lang.System.arraycopy(this.systems, 0, this.sortedSystems, 0, this.systems.length);
}
ISystem.calculateOrder(this, this.sortedSystems, this.systemSize);
}
if (var2 || var3) {
for (int var13 = 0; var13 < this.systemTypeSize; var13++) {
SystemType var15 = this.systemTypes[var13];
if (var15 != null) {
BitSet var16 = this.systemTypeToSystemIndex[var13] = new BitSet();
for (int var18 = 0; var18 < this.systemSize; var18++) {
if (var15.isType(this.sortedSystems[var18])) {
var16.set(var18);
}
}
}
}
}
long var14 = this.storeLock.readLock();
this.dataUpdateLock.writeLock().lock();
try {
ComponentRegistry.Data var17 = this.data;
this.data = new ComponentRegistry.Data<>(var17.getVersion() + 1, this, var1);
for (int var19 = 0; var19 < this.storeSize; var19++) {
this.stores[var19].updateData(var17, this.data);
}
for (Reference var8 : this.holders) {
Holder var9 = var8.get();
if (var9 != null) {
var9.updateData(var17, this.data);
}
}
} class="kw">finally {
this.dataUpdateLock.writeLock().unlock();
this.storeLock.unlockRead(var14);
}
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ComponentRegistry{super()="
+ this.getClass()
+ "@"
+ this.hashCode()
+ ", shutdown="
+ this.shutdown
+ ", dataLock="
+ this.dataLock
+ ", idToIndex="
+ this.componentIdToIndex
+ ", componentIndexReuse="
+ this.componentIndexReuse
+ ", componentSize="
+ this.componentSize
+ ", componentIds="
+ Arrays.toString(this.componentIds)
+ ", componentCodecs="
+ Arrays.toString(this.componentCodecs)
+ ", componentSuppliers="
+ Arrays.toString(this.componentSuppliers)
+ ", componentTypes="
+ Arrays.toString(this.componentTypes)
+ ", resourceIndexReuse="
+ this.resourceIndexReuse
+ ", resourceSize="
+ this.resourceSize
+ ", resourceIds="
+ Arrays.toString(this.resourceIds)
+ ", resourceCodecs="
+ Arrays.toString(this.resourceCodecs)
+ ", resourceSuppliers="
+ Arrays.toString(this.resourceSuppliers)
+ ", resourceTypes="
+ Arrays.toString(this.resourceTypes)
+ ", systemSize="
+ this.systemSize
+ ", systems="
+ Arrays.toString(this.systems)
+ ", sortedSystems="
+ Arrays.toString(this.sortedSystems)
+ ", storeLock="
+ this.storeLock
+ ", storeSize="
+ this.storeSize
+ ", stores="
+ Arrays.toString(this.stores)
+ ", data="
+ this.data
+ "}";
}
class="kw">public <T class="kw">extends Component<ECS_TYPE>> T createComponent(@Nonnull ComponentType<ECS_TYPE, T> var1) {
long var2 = this.dataLock.readLock();
try {
class="kw">return this.data.createComponent(var1);
} class="kw">finally {
this.dataLock.unlockRead(var2);
}
}
class="kw">public class="kw">static class Data<ECS_TYPE> {
class="kw">private class="kw">final int version;
@Nonnull
class="kw">private class="kw">final ComponentRegistry<ECS_TYPE> registry;
class="kw">private class="kw">final Object2IntMap<String> componentIdToIndex;
class="kw">private class="kw">final int componentSize;
@Nonnull
class="kw">private class="kw">final String[] componentIds;
@Nonnull
class="kw">private class="kw">final BuilderCodec<? class="kw">extends Component<ECS_TYPE>>[] componentCodecs;
@Nonnull
class="kw">private class="kw">final Supplier<? class="kw">extends Component<ECS_TYPE>>[] componentSuppliers;
@Nonnull
class="kw">private class="kw">final ComponentType<ECS_TYPE, ? class="kw">extends Component<ECS_TYPE>>[] componentTypes;
class="kw">private class="kw">final Object2IntMap<String> resourceIdToIndex;
class="kw">private class="kw">final int resourceSize;
@Nonnull
class="kw">private class="kw">final String[] resourceIds;
@Nonnull
class="kw">private class="kw">final BuilderCodec<? class="kw">extends Resource<ECS_TYPE>>[] resourceCodecs;
@Nonnull
class="kw">private class="kw">final Supplier<? class="kw">extends Resource<ECS_TYPE>>[] resourceSuppliers;
@Nonnull
class="kw">private class="kw">final ResourceType<ECS_TYPE, ? class="kw">extends Resource<ECS_TYPE>>[] resourceTypes;
class="kw">private class="kw">final Object2IntMap<Class<? class="kw">extends ISystem<ECS_TYPE>>> systemTypeClassToIndex;
class="kw">private class="kw">final int systemTypeSize;
@Nonnull
class="kw">private class="kw">final SystemType<ECS_TYPE, ? class="kw">extends ISystem<ECS_TYPE>>[] systemTypes;
@Nonnull
class="kw">private class="kw">final BitSet[] systemTypeToSystemIndex;
class="kw">private class="kw">final int systemSize;
@Nonnull
class="kw">private class="kw">final ISystem<ECS_TYPE>[] sortedSystems;
@Nonnull
class="kw">private class="kw">final Map<String, Codec<Component<ECS_TYPE>>> codecMap;
@Nonnull
class="kw">private class="kw">final BuilderCodec<Holder<ECS_TYPE>> entityCodec;
@Nullable
class="kw">private class="kw">final DataChange[] dataChanges;
class="kw">private Data(@Nonnull ComponentRegistry<ECS_TYPE> var1) {
this.version = 0;
this.registry = var1;
this.componentIdToIndex = Object2IntMaps.emptyMap();
this.componentSize = 0;
this.componentIds = ArrayUtil.EMPTY_STRING_ARRAY;
this.componentCodecs = (BuilderCodec<? class="kw">extends Component<ECS_TYPE>>[])BuilderCodec.EMPTY_ARRAY;
this.componentSuppliers = ArrayUtil.emptySupplierArray();
this.componentTypes = ComponentType.EMPTY_ARRAY;
this.resourceIdToIndex = Object2IntMaps.emptyMap();
this.resourceSize = 0;
this.resourceIds = ArrayUtil.EMPTY_STRING_ARRAY;
this.resourceCodecs = (BuilderCodec<? class="kw">extends Resource<ECS_TYPE>>[])BuilderCodec.EMPTY_ARRAY;
this.resourceSuppliers = ArrayUtil.emptySupplierArray();
this.resourceTypes = ResourceType.EMPTY_ARRAY;
this.systemTypeClassToIndex = Object2IntMaps.emptyMap();
this.systemTypeSize = 0;
this.systemTypes = SystemType.EMPTY_ARRAY;
this.systemTypeToSystemIndex = ArrayUtil.EMPTY_BITSET_ARRAY;
this.systemSize = 0;
this.sortedSystems = ISystem.EMPTY_ARRAY;
this.codecMap = Collections.emptyMap();
this.entityCodec = this.createCodec();
this.dataChanges = null;
}
class="kw">private Data(int var1, @Nonnull ComponentRegistry<ECS_TYPE> var2, DataChange... var3) {
this.version = var1;
this.registry = var2;
this.componentIdToIndex = new Object2IntOpenHashMap(var2.componentIdToIndex);
this.componentIdToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.componentSize = var2.componentSize;
this.componentIds = Arrays.copyOf(var2.componentIds, this.componentSize);
this.componentCodecs = Arrays.copyOf(var2.componentCodecs, this.componentSize);
this.componentSuppliers = Arrays.copyOf(var2.componentSuppliers, this.componentSize);
this.componentTypes = Arrays.copyOf(var2.componentTypes, this.componentSize);
this.resourceIdToIndex = new Object2IntOpenHashMap(var2.resourceIdToIndex);
this.resourceIdToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.resourceSize = var2.resourceSize;
this.resourceIds = Arrays.copyOf(var2.resourceIds, this.resourceSize);
this.resourceCodecs = Arrays.copyOf(var2.resourceCodecs, this.resourceSize);
this.resourceSuppliers = Arrays.copyOf(var2.resourceSuppliers, this.resourceSize);
this.resourceTypes = Arrays.copyOf(var2.resourceTypes, this.resourceSize);
this.systemTypeClassToIndex = new Object2IntOpenHashMap(var2.systemTypeClassToIndex);
this.systemTypeClassToIndex.defaultReturnValue(Integer.MIN_VALUE);
this.systemTypeSize = var2.systemTypeSize;
this.systemTypes = Arrays.copyOf(var2.systemTypes, this.systemTypeSize);
this.systemTypeToSystemIndex = Arrays.copyOf(var2.systemTypeToSystemIndex, this.systemTypeSize);
this.systemSize = var2.systemSize;
this.sortedSystems = Arrays.copyOf(var2.sortedSystems, this.systemSize);
Object2ObjectOpenHashMap var4 = new Object2ObjectOpenHashMap(this.componentSize);
for (int var5 = 0; var5 < this.componentSize; var5++) {
if (this.componentCodecs[var5] != null) {
var4.put(this.componentIds[var5], this.componentCodecs[var5]);
}
}
this.codecMap = var4;
this.entityCodec = this.createCodec();
this.dataChanges = var3;
}
@Nonnull
class="kw">private BuilderCodec<Holder<ECS_TYPE>> createCodec() {
Function var1 = var0 -> var0 != null ? var0 : TempUnknownComponent.COMPONENT_CODEC;
class="kw">return BuilderCodec.builder(Holder.class, this.registry::newHolder)
.append(
new KeyedCodec<>("Components", new MapProvidedMapCodec<>(this.codecMap, var1, LinkedHashMap::new, false)),
(var1x, var2) -> var1x.loadComponentsMap(this, var2),
var1x -> var1x.createComponentsMap(this)
)
.add()
.build();
}
class="kw">public int getVersion() {
class="kw">return this.version;
}
@Nonnull
class="kw">public ComponentRegistry<ECS_TYPE> getRegistry() {
class="kw">return this.registry;
}
@Nullable
class="kw">public ComponentType<ECS_TYPE, ?> getComponentType(String var1) {
int var2 = this.componentIdToIndex.getInt(var1);
class="kw">return var2 == Integer.MIN_VALUE ? null : this.componentTypes[var2];
}
class="kw">public int getComponentSize() {
class="kw">return this.componentSize;
}
@Nullable
class="kw">public String getComponentId(@Nonnull ComponentType<ECS_TYPE, ?> var1) {
class="kw">return this.componentIds[var1.getIndex()];
}
@Nullable
class="kw">public <T class="kw">extends Component<ECS_TYPE>> Codec<T> getComponentCodec(@Nonnull ComponentType<ECS_TYPE, T> var1) {
class="kw">return (Codec<T>)this.componentCodecs[var1.getIndex()];
}
class="kw">public <T class="kw">extends Component<ECS_TYPE>> T createComponent(@Nonnull ComponentType<ECS_TYPE, T> var1) {
var1.validateRegistry(this.registry);
var1.validate();
class="kw">return (T)this.componentSuppliers[var1.getIndex()].get();
}
class="kw">public ResourceType<ECS_TYPE, ?> getResourceType(int var1) {
class="kw">return this.resourceTypes[var1];
}
@Nullable
class="kw">public ResourceType<ECS_TYPE, ?> getResourceType(String var1) {
int var2 = this.resourceIdToIndex.getInt(var1);
class="kw">return var2 == Integer.MIN_VALUE ? null : this.resourceTypes[var2];
}
class="kw">public int getResourceSize() {
class="kw">return this.resourceSize;
}
@Nullable
class="kw">public String getResourceId(@Nonnull ResourceType<ECS_TYPE, ?> var1) {
class="kw">return this.resourceIds[var1.getIndex()];
}
@Nullable
class="kw">public <T class="kw">extends Resource<ECS_TYPE>> BuilderCodec<T> getResourceCodec(@Nonnull ResourceType<ECS_TYPE, T> var1) {
class="kw">return (BuilderCodec<T>)this.resourceCodecs[var1.getIndex()];
}
class="kw">public <T class="kw">extends Resource<ECS_TYPE>> T createResource(@Nonnull ResourceType<ECS_TYPE, T> var1) {
var1.validateRegistry(this.registry);
var1.validate();
class="kw">return (T)this.resourceSuppliers[var1.getIndex()].get();
}
class="kw">public int getSystemTypeSize() {
class="kw">return this.systemTypeSize;
}
@Nullable
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> SystemType<ECS_TYPE, T> getSystemType(Class<? super T> var1) {
int var2 = this.systemTypeClassToIndex.getInt(var1);
class="kw">return (SystemType<ECS_TYPE, T>)(var2 == Integer.MIN_VALUE ? null : this.systemTypes[var2]);
}
class="kw">public SystemType<ECS_TYPE, ? class="kw">extends ISystem<ECS_TYPE>> getSystemType(int var1) {
class="kw">return this.systemTypes[var1];
}
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> BitSet getSystemIndexesForType(@Nonnull SystemType<ECS_TYPE, T> var1) {
class="kw">return this.systemTypeToSystemIndex[var1.getIndex()];
}
class="kw">public int getSystemSize() {
class="kw">return this.systemSize;
}
class="kw">public ISystem<ECS_TYPE> getSystem(int var1) {
class="kw">return this.sortedSystems[var1];
}
class="kw">public <T class="kw">extends ISystem<ECS_TYPE>> T getSystem(int var1, SystemType<ECS_TYPE, T> var2) {
class="kw">return (T)this.sortedSystems[var1];
}
class="kw">public int indexOf(ISystem<ECS_TYPE> var1) {
int var2 = -1;
for (int var3 = 0; var3 < this.sortedSystems.length; var3++) {
if (this.sortedSystems[var3] == var1) {
var2 = var3;
break;
}
}
class="kw">return var2;
}
@Nonnull
class="kw">public BuilderCodec<Holder<ECS_TYPE>> getEntityCodec() {
class="kw">return this.entityCodec;
}
class="kw">public int getDataChangeCount() {
class="kw">return this.dataChanges.length;
}
class="kw">public DataChange getDataChange(int var1) {
class="kw">return this.dataChanges[var1];
}
@Override
class="kw">public boolean equals(@Nullable Object var1) {
if (this == var1) {
class="kw">return true;
} else if (var1 != null && this.getClass() == var1.getClass()) {
ComponentRegistry.Data var2 = (ComponentRegistry.Data<?>)var1;
class="kw">return this.version == var2.version;
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return this.version;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "Data{version="
+ this.version
+ ", componentSize="
+ this.componentSize
+ ", componentSuppliers="
+ Arrays.toString(this.componentSuppliers)
+ ", resourceSize="
+ this.resourceSize
+ ", resourceSuppliers="
+ Arrays.toString(this.resourceSuppliers)
+ ", systemSize="
+ this.systemSize
+ ", sortedSystems="
+ Arrays.toString(this.sortedSystems)
+ ", dataChanges="
+ Arrays.toString(this.dataChanges)
+ "}";
}
class="kw">public void appendDump(@Nonnull String var1, @Nonnull StringBuilder var2) {
var2.append(var1).append("version=").append(this.version).append("\n");
var2.append(var1).append("componentSize=").append(this.componentSize).append("\n");
var2.append(var1).append("componentSuppliers=").append("\n");
for (int var3 = 0; var3 < this.componentSize; var3++) {
var2.append(var1).append("\t- ").append(var3).append("\t").append(this.componentSuppliers[var3]).append("\n");
}
var2.append(var1).append("resourceSuppliers=").append("\n");
for (int var4 = 0; var4 < this.resourceSize; var4++) {
var2.append(var1).append("\t- ").append(var4).append("\t").append(this.resourceSuppliers[var4]).append("\n");
}
var2.append(var1).append("systemSize=").append(this.systemSize).append("\n");
var2.append(var1).append("sortedSystems=").append("\n");
for (int var5 = 0; var5 < this.systemSize; var5++) {
var2.append(var1).append("\t- ").append(var5).append("\t").append(this.sortedSystems[var5]).append("\n");
}
var2.append(var1).append("dataChanges=").append("\n");
for (int var6 = 0; var6 < this.dataChanges.length; var6++) {
var2.append(var1).append("\t- ").append(var6).append("\t").append(this.dataChanges[var6]).append("\n");
}
}
}
}