package net.minecraft.server; import com.google.common.base.Predicates; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.koloboke.collect.map.hash.HashObjIntMap; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.List; import javax.annotation.Nullable; public class RegistryBlockID implements Registry { private int a; private final HashObjIntMap b; // Akarin - IdentityHashMap -> HashObjIntMap private final List c; public RegistryBlockID() { this(512); } public RegistryBlockID(int i) { this.c = Lists.newArrayListWithExpectedSize(i); this.b = com.koloboke.collect.map.hash.HashObjIntMaps.getDefaultFactory().withHashConfig(com.koloboke.collect.hash.HashConfig.fromLoads(1./3., 2./3., 2./3.)).withNullKeyAllowed(true).withKeyEquivalence(com.koloboke.collect.Equivalence.identity()).newUpdatableMap(i); // Akarin - koloboke } public void a(T t0, int i) { this.b.put(t0, i); while (this.c.size() <= i) { this.c.add(null); // Paper - decompile fix } this.c.set(i, t0); if (this.a <= i) { this.a = i + 1; } } public void b(T t0) { this.a(t0, this.a); } public int getId(T t0) { Integer integer = (Integer) this.b.get(t0); return integer == null ? -1 : integer; } @Nullable public final T fromId(int i) { return i >= 0 && i < this.c.size() ? this.c.get(i) : null; } public Iterator iterator() { return Iterators.filter(this.c.iterator(), Predicates.notNull()); } public int size() { return this.a(); } // Paper - OBFHELPER public int a() { return this.b.size(); } }