From a98c7ba2c706caa0ba83bddefa5ffecbe658ccd3 Mon Sep 17 00:00:00 2001 From: Erik Broes Date: Mon, 27 Jun 2011 00:25:01 +0200 Subject: Massive renaming update in nms. If you bypassed Bukkit, you will likely break. Also minimized all the nms diffs and generic cleanups all around. --- .../net/minecraft/server/EntityWeatherStorm.java | 42 ++++++++++------------ 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'src/main/java/net/minecraft/server/EntityWeatherStorm.java') diff --git a/src/main/java/net/minecraft/server/EntityWeatherStorm.java b/src/main/java/net/minecraft/server/EntityWeatherStorm.java index c7bba5e6..87d454d6 100644 --- a/src/main/java/net/minecraft/server/EntityWeatherStorm.java +++ b/src/main/java/net/minecraft/server/EntityWeatherStorm.java @@ -3,7 +3,6 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; @@ -11,13 +10,12 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; public class EntityWeatherStorm extends EntityWeather { - private int b; + private int lifeTicks; public long a = 0L; private int c; // CraftBukkit start private CraftWorld cworld; - private CraftServer server; public boolean isEffect = false; public EntityWeatherStorm(World world, double d0, double d1, double d2) { @@ -31,25 +29,23 @@ public class EntityWeatherStorm extends EntityWeather { // CraftBukkit start this.isEffect = isEffect; - cworld = ((WorldServer) world).getWorld(); - server = ((WorldServer) world).getServer(); + this.cworld = world.getWorld(); // CraftBukkit end this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F); - this.b = 2; + this.lifeTicks = 2; this.a = this.random.nextLong(); this.c = this.random.nextInt(3) + 1; // CraftBukkit - if (!isEffect && world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { + if (!isEffect && world.spawnMonsters >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { int i = MathHelper.floor(d0); int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) { // CraftBukkit start - org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k); - BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null); - ((WorldServer) world).getServer().getPluginManager().callEvent(event); + BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null); + world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { world.setTypeId(i, j, k, Block.FIRE.id); @@ -64,9 +60,9 @@ public class EntityWeatherStorm extends EntityWeather { if (world.getTypeId(j, k, l) == 0 && Block.FIRE.canPlace(world, j, k, l)) { // CraftBukkit start - org.bukkit.block.Block theBlock = cworld.getBlockAt(j, k, l); - BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null); - ((WorldServer) world).getServer().getPluginManager().callEvent(event); + BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(j, k, l), IgniteCause.LIGHTNING, null); + world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { world.setTypeId(j, k, l, Block.FIRE.id); } @@ -78,30 +74,30 @@ public class EntityWeatherStorm extends EntityWeather { public void o_() { super.o_(); - if (this.b == 2) { + if (this.lifeTicks == 2) { this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F); } - --this.b; - if (this.b < 0) { + --this.lifeTicks; + if (this.lifeTicks < 0) { if (this.c == 0) { this.die(); - } else if (this.b < -this.random.nextInt(10)) { + } else if (this.lifeTicks < -this.random.nextInt(10)) { --this.c; - this.b = 1; + this.lifeTicks = 1; this.a = this.random.nextLong(); // CraftBukkit - if (!isEffect && this.world.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) { + if (!this.isEffect && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY); int k = MathHelper.floor(this.locZ); if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) { // CraftBukkit start - org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k); - BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null); - ((WorldServer) world).getServer().getPluginManager().callEvent(event); + BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null); + this.world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { this.world.setTypeId(i, j, k, Block.FIRE.id); } @@ -111,7 +107,7 @@ public class EntityWeatherStorm extends EntityWeather { } } - if (this.b >= 0 && !isEffect) { // CraftBukkit + if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit 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)); -- cgit v1.2.3