/** * Creates a new hash map using the elements of two parallel arrays. * * @param k * the array of keys of the new hash map. * @param v * the array of corresponding values in the new hash map. * @param f * the load factor. * @throws IllegalArgumentException * if {@code k} and {@code v} have different lengths. */ public Short2ObjectOpenHashMap(final short[] k, final V[] v, final float f) { this(k.length, f); if (k.length != v.length) throw new IllegalArgumentException( "The key array and the value array have different lengths (" + k.length + " and " + v.length + ")"); for (int i = 0; i < k.length; i++) this.put(k[i], v[i]); } /**
public void addTileEntityInternal( short index, TileEntity tileEntity ) { if ( this.tileEntities == null ) { this.tileEntities = new Short2ObjectOpenHashMap<>(); } this.tileEntities.put( index, tileEntity ); }
public TemporaryStorage getTemporaryStorage( int x, int y, int z, int layer ) { short index = getIndex( x, y, z ); // Select correct layer Short2ObjectOpenHashMap<TemporaryStorage> storage = this.temporaryStorages[layer]; if ( storage == null ) { storage = new Short2ObjectOpenHashMap<>(); this.temporaryStorages[layer] = storage; } TemporaryStorage blockStorage = storage.get( index ); if ( blockStorage == null ) { blockStorage = new TemporaryStorage(); storage.put( index, blockStorage ); } return blockStorage; }
@Override public void readData(DataIn data) { startX = data.readVarInt(); startZ = data.readVarInt(); claimedChunks = data.readVarInt(); loadedChunks = data.readVarInt(); maxClaimedChunks = data.readVarInt(); maxLoadedChunks = data.readVarInt(); teams = new Short2ObjectOpenHashMap<>(); for (ClientClaimedChunks.Team team : data.readCollection(ClientClaimedChunks.Team.DESERIALIZER)) { teams.put(team.uid, team); } }
team.nameComponent = chunkTeam.getTitle(); team.isAlly = chunkTeam.isAlly(p); teams.put(chunkTeam.getUID(), team);