示例#1
0
 public void explode(MainClass m, Location loc) {
   for (int x = -5; x < 5; x++)
     for (int z = -5; z < 5; z++) {
       if (Location.getDistance(
               loc.add(new Location(random.nextInt(4) - 2, random.nextInt(4) - 2)),
               new Location(loc.x + x, loc.z + z))
           <= range) {
         Location loc2 = new Location(loc.getX() + x, loc.getZ() + z);
         m.getWorld()
             .addParticle(
                 new Particle(loc2.x, loc2.z, 50 + random.nextInt(80), new Velocity(0, 0), 6));
         hit(loc2, m.getWorld().getPlayer());
         for (int a = 0; a < m.getWorld().getEntityArray().length; a++) {
           if (m.getWorld().getEntityArray()[a] == null) continue;
           if (m.getWorld().getEntityArray()[a] instanceof EntityLiving) {
             EntityLiving el = (EntityLiving) m.getWorld().getEntityArray()[a];
             hit(loc2, el);
           }
         }
       }
     }
 }
示例#2
0
 private void hit(Location loc, EntityLiving goal) {
   if (Location.getDistance(loc, goal.getLocation()) < 0.5f) {
     goal.damage(1, true);
     goal.addStatus("UNMOVE", 40, true);
   }
 }
示例#3
0
 public float getZ() {
   return location.getZ();
 }