Search in sources :

Example 21 with Cube

use of com.builtbroken.mc.imp.transform.region.Cube 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);
            }
        }
    }
}
Also used : IRadioWaveReceiver(com.builtbroken.mc.api.map.radio.IRadioWaveReceiver) Cube(com.builtbroken.mc.imp.transform.region.Cube) IRadioWaveSender(com.builtbroken.mc.api.map.radio.IRadioWaveSender) ArrayList(java.util.ArrayList)

Aggregations

Cube (com.builtbroken.mc.imp.transform.region.Cube)21 Pos (com.builtbroken.mc.imp.transform.vector.Pos)8 IRadioWaveReceiver (com.builtbroken.mc.api.map.radio.IRadioWaveReceiver)5 ArrayList (java.util.ArrayList)4 Entity (net.minecraft.entity.Entity)4 PacketTile (com.builtbroken.mc.core.network.packet.PacketTile)3 BlockTile (com.builtbroken.mc.prefab.tile.BlockTile)3 Tile (com.builtbroken.mc.prefab.tile.Tile)3 FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)3 TileEntity (net.minecraft.tileentity.TileEntity)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Test (org.junit.Test)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)2 IRadioWaveSender (com.builtbroken.mc.api.map.radio.IRadioWaveSender)1 IMultiTileHost (com.builtbroken.mc.api.tile.multiblock.IMultiTileHost)1 PacketSelectionData (com.builtbroken.mc.core.network.packet.PacketSelectionData)1 RadioMap (com.builtbroken.mc.lib.world.radio.RadioMap)1 Region (com.builtbroken.mc.modflag.Region)1 EntityExplosive (icbm.classic.content.entity.EntityExplosive)1