use of com.builtbroken.mc.api.map.radio.IRadioWaveSender in project Engine by VoltzEngine-Project.
the class RadioMap method remove.
public boolean remove(IRadioWaveReceiver receiver) {
if (fullMapRangeReceives.contains(receiver)) {
fullMapRangeReceives.remove(receiver);
}
if (receive_to_chunks.containsKey(receiver)) {
//Clear cached chunk positions
for (ChunkCoordIntPair pair : receive_to_chunks.get(receiver)) {
if (chunk_to_entities.containsKey(pair)) {
chunk_to_entities.get(pair).remove(receiver);
}
}
//Clear entry in receiver map
receive_to_chunks.remove(receiver);
//Update sender cache
for (IRadioWaveSender sender : sender_to_receivers_cache.keySet()) {
List<IRadioWaveReceiver> receivers = sender_to_receivers_cache.get(sender);
if (receivers == null) {
receivers = new ArrayList();
}
if (receivers.contains(receiver)) {
receivers.remove(receiver);
}
sender_to_receivers_cache.put(sender, receivers);
}
return true;
}
return false;
}
use of com.builtbroken.mc.api.map.radio.IRadioWaveSender in project Engine by VoltzEngine-Project.
the class RadioMap method updateSenderCache.
protected void updateSenderCache(IRadioWaveReceiver receiver, Cube range) {
if (range != null) {
//Update sender cache
for (IRadioWaveSender sender : sender_to_receivers_cache.keySet()) {
Cube senderRange = sender.getRadioSenderRange();
if (senderRange.doesOverlap(range)) {
List<IRadioWaveReceiver> receivers = sender_to_receivers_cache.get(sender);
if (receivers == null) {
receivers = new ArrayList();
}
if (!receivers.contains(receiver)) {
receivers.add(receiver);
}
sender_to_receivers_cache.put(sender, receivers);
}
}
}
}
Aggregations