diff options
author | sk89q <the.sk89q@gmail.com> | 2011-05-06 19:25:44 -0700 |
---|---|---|
committer | sk89q <the.sk89q@gmail.com> | 2011-05-06 19:25:44 -0700 |
commit | 6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d (patch) | |
tree | 734b17d0ab1efcafa38844e63f656f19d3611014 | |
parent | c05cc33f7a70080429ac7c34614c47420d46e86f (diff) | |
download | craftbukkit-6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d.tar craftbukkit-6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d.tar.gz craftbukkit-6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d.tar.lz craftbukkit-6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d.tar.xz craftbukkit-6cbd4cdf9e3e6367756e31225af2d8a18ad82e8d.zip |
Added World.strikeLightningEffect() that does no damage.
3 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/EntityWeatherStorm.java b/src/main/java/net/minecraft/server/EntityWeatherStorm.java index 0faf59bb..cacb06ea 100644 --- a/src/main/java/net/minecraft/server/EntityWeatherStorm.java +++ b/src/main/java/net/minecraft/server/EntityWeatherStorm.java @@ -18,13 +18,19 @@ public class EntityWeatherStorm extends EntityWeather { // CraftBukkit start private CraftWorld cworld; private CraftServer server; - // CraftBukkit end + public boolean isEffect = false; public EntityWeatherStorm(World world, double d0, double d1, double d2) { + this(world, d0, d1, d2, false); + } + + public EntityWeatherStorm(World world, double d0, double d1, double d2, boolean isEffect) { + // CraftBukkit end super(world); // CraftBukkit start + this.isEffect = isEffect; cworld = ((WorldServer) world).getWorld(); server = ((WorldServer) world).getServer(); // CraftBukkit end @@ -33,7 +39,9 @@ public class EntityWeatherStorm extends EntityWeather { this.b = 2; this.a = this.random.nextLong(); this.c = this.random.nextInt(3) + 1; - if (world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { + // CraftBukkit start + if (!isEffect && world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { + // CraftBukkit end int i = MathHelper.floor(d0); int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); @@ -83,7 +91,9 @@ public class EntityWeatherStorm extends EntityWeather { --this.c; this.b = 1; this.a = this.random.nextLong(); - if (this.world.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) { + // CraftBukkit start + if (!isEffect && this.world.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) { + // CraftBukkit end int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY); int k = MathHelper.floor(this.locZ); @@ -102,7 +112,9 @@ public class EntityWeatherStorm extends EntityWeather { } } - if (this.b >= 0) { + // CraftBukkit start + if (!isEffect && this.b >= 0) { + // CraftBukkit end double d0 = 3.0D; List list = this.world.b((Entity) this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0)); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 40f39596..c31d62ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -371,6 +371,12 @@ public class CraftWorld implements World { return new CraftLightningStrike(server, lightning); } + public LightningStrike strikeLightningEffect(Location loc) { + EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ(), true); + world.a(lightning); + return new CraftLightningStrike(server, lightning); + } + public boolean generateTree(Location loc, TreeType type) { return generateTree(loc, type, world); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index d081b7f8..3c595a2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -14,4 +14,8 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike public EntityWeatherStorm getHandle() { return (EntityWeatherStorm)super.getHandle(); } + + public boolean isEffect() { + return ((EntityWeatherStorm) super.getHandle()).isEffect; + } } |