Optimize clear()
This commit is contained in:
parent
433db3409a
commit
c09c4ccf68
|
|
@ -98,7 +98,6 @@ public class ForgeRegistryMixin<V extends IForgeRegistryEntry<V>> {
|
||||||
this.fastRegistry.optimize();
|
this.fastRegistry.optimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Redirect(method = "sync", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/BiMap;clear()V"))
|
@Redirect(method = "sync", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/BiMap;clear()V"))
|
||||||
private void clearBiMap(BiMap map) {
|
private void clearBiMap(BiMap map) {
|
||||||
if(map == this.owners) {
|
if(map == this.owners) {
|
||||||
|
|
@ -108,6 +107,4 @@ public class ForgeRegistryMixin<V extends IForgeRegistryEntry<V>> {
|
||||||
} else
|
} else
|
||||||
map.clear();
|
map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@ import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class FastForgeRegistry<V extends IForgeRegistryEntry<V>> {
|
public class FastForgeRegistry<V extends IForgeRegistryEntry<V>> {
|
||||||
private BiMap<Integer, V> ids;
|
private final BiMap<Integer, V> ids;
|
||||||
private DataFieldBiMap<ResourceLocation> names;
|
private final DataFieldBiMap<ResourceLocation> names;
|
||||||
private DataFieldBiMap<ResourceKey<V>> keys;
|
private final DataFieldBiMap<ResourceKey<V>> keys;
|
||||||
private DataFieldBiMap<?> owners;
|
private final DataFieldBiMap<?> owners;
|
||||||
private ResourceKey<Registry<V>> registryKey;
|
private final ResourceKey<Registry<V>> registryKey;
|
||||||
|
|
||||||
private ObjectArrayList<V> valuesById;
|
private final ObjectArrayList<V> valuesById;
|
||||||
private Object2ObjectOpenHashMap<V, RegistryValueData> infoByValue;
|
private final Object2ObjectOpenHashMap<V, RegistryValueData> infoByValue;
|
||||||
|
|
||||||
private void storeId(V value, int id) {
|
private void storeId(V value, int id) {
|
||||||
RegistryValueData pair = infoByValue.computeIfAbsent(value, k -> new RegistryValueData());
|
RegistryValueData pair = infoByValue.computeIfAbsent(value, k -> new RegistryValueData());
|
||||||
|
|
@ -58,6 +58,7 @@ public class FastForgeRegistry<V extends IForgeRegistryEntry<V>> {
|
||||||
}
|
}
|
||||||
this.names.clearUnsafe();
|
this.names.clearUnsafe();
|
||||||
this.keys.clearUnsafe();
|
this.keys.clearUnsafe();
|
||||||
|
this.owners.clearUnsafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FastForgeRegistry(ResourceKey<Registry<V>> registryKey) {
|
public FastForgeRegistry(ResourceKey<Registry<V>> registryKey) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user