Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class RadarDetectionLogic {
- public abstract World getRadarWorld();
- public abstract int getRadarX();
- public abstract int getRadarY();
- public abstract int getRadarZ();
- public abstract int getRadarRange();
- // Radar Specs
- int RadarRange = 48;
- double RadarRangeHoriz;
- double RadarRangeVerti;
- int RadarRangeHorizintal;
- int RadarRangeVertical;
- // Radar Scan results
- boolean dangerous;
- int count;
- public void updateRadar(int range) {
- // TODO Auto-generated method stub
- boolean active;
- double x = this.getRadarX();
- double y = this.getRadarY();
- double z = this.getRadarZ();
- if (range > 0 && range >= 16) {
- // Let's make sure it can detect entities at least a chunk away.
- RadarRange = range;
- }
- this.RadarRangeHoriz = RadarRange*2;
- this.RadarRangeVerti = RadarRange;
- int count = this.getRadarWorld().getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+1, z+1).expand(this.RadarRangeHoriz, this.RadarRangeVerti, this.RadarRangeHoriz)).size();
- if (count > 0) {
- dangerous = true;
- this.count = count;
- } else {
- dangerous = false;
- this.count = 0;
- }
- Minecraft.getMinecraft().thePlayer.sendChatMessage(x + " " + y + " " + z + ";range:" + range);
- }
- public boolean getDanger() {
- return dangerous;
- }
- public int getEntityCount() {
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment