mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Added World.strikeLightningEffect() that does no damage.
This commit is contained in:
parent
c05cc33f7a
commit
6cbd4cdf9e
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user