Guest User

Untitled

a guest
Jan 31st, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. public abstract class RadarDetectionLogic {
  2.    
  3.     public AxisAlignedBB boundingBox;
  4.     public abstract World getRadarWorld();
  5.  
  6.     public abstract int getRadarX();
  7.  
  8.     public abstract int getRadarY();
  9.  
  10.     public abstract int getRadarZ();
  11.    
  12.     public abstract int getRadarRange();
  13.    
  14.     // Radar Specs
  15.     int RadarRange = 48;
  16.     double RadarRangeHoriz;
  17.     double RadarRangeVerti;
  18.     int RadarRangeHorizintal;
  19.     int RadarRangeVertical;
  20.    
  21.     // Radar Scan results
  22.     boolean dangerous;
  23.     int count;
  24.    
  25.     public void updateRadar(int range) {
  26.         // TODO Auto-generated method stub
  27.         boolean active;
  28.         double x = this.getRadarX();
  29.         double y = this.getRadarY();
  30.         double z = this.getRadarZ();
  31.         if (range > 0 && range >= 16) {
  32.             // Let's make sure it can detect entities at least a chunk away.
  33.             RadarRange = range;
  34.         } else {
  35.             RadarRange = 16;
  36.         }
  37.         this.RadarRangeHoriz = RadarRange*2;
  38.         this.RadarRangeVerti = RadarRange;
  39.         AxisAlignedBB tester = null;
  40.         tester.setBounds(x-RadarRangeHoriz, y-RadarRangeVerti, z-RadarRangeHoriz, x+RadarRangeHoriz, y+RadarRangeVerti, z+RadarRangeHoriz);
  41.         List list = this.getRadarWorld().getEntitiesWithinAABB(Entity.class, this.boundingBox);
  42.         int count = list.size();
  43.         if (count > 0) {
  44.             dangerous = true;
  45.             this.count = count;
  46.         } else {
  47.             dangerous = false;
  48.             this.count = 0;
  49.         }
  50.         Minecraft.getMinecraft().thePlayer.sendChatMessage(x + " " + y + " " + z + ";range:" + range);
  51.     }
  52.    
  53.     public boolean getDanger() {
  54.         return dangerous;
  55.     }
  56.    
  57.     public int getEntityCount() {
  58.         return count;
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment