19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
86 lines
3.4 KiB
Diff
86 lines
3.4 KiB
Diff
From 730b85ab092a7365bede2db67e038d2c8c86f748 Mon Sep 17 00:00:00 2001
|
|
From: drXor <mcyoungsota@gmail.com>
|
|
Date: Sun, 23 Feb 2014 16:16:59 -0400
|
|
Subject: [PATCH] Implement Silenceable Lightning API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
|
index 5bda5d3..1bbce9b 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
|
@@ -13,6 +13,8 @@ public class EntityLightning extends EntityWeather {
|
|
// CraftBukkit start
|
|
public boolean isEffect = false;
|
|
|
|
+ public boolean isSilent = false; // Spigot
|
|
+
|
|
public EntityLightning(World world, double d0, double d1, double d2) {
|
|
this(world, d0, d1, d2, false);
|
|
}
|
|
@@ -53,12 +55,19 @@ public class EntityLightning extends EntityWeather {
|
|
}
|
|
}
|
|
}
|
|
+ }
|
|
|
|
+ // Spigot start
|
|
+ public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent)
|
|
+ {
|
|
+ this( world, d0, d1, d2, isEffect );
|
|
+ this.isSilent = isSilent;
|
|
}
|
|
+ // Spigot end
|
|
|
|
public void s_() {
|
|
super.s_();
|
|
- if (this.lifeTicks == 2) {
|
|
+ if (!isSilent && this.lifeTicks == 2) { // Spigot
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
//this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
|
float pitch = 0.8F + this.random.nextFloat() * 0.2F;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index e395704..50fdfcd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1385,6 +1385,22 @@ public class CraftWorld implements World {
|
|
{
|
|
CraftWorld.this.playEffect( location, effect, 0 );
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public LightningStrike strikeLightning(Location loc, boolean isSilent)
|
|
+ {
|
|
+ EntityLightning lightning = new EntityLightning( world, loc.getX(), loc.getY(), loc.getZ(), false, isSilent );
|
|
+ world.strikeLightning( lightning );
|
|
+ return new CraftLightningStrike( server, lightning );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public LightningStrike strikeLightningEffect(Location loc, boolean isSilent)
|
|
+ {
|
|
+ EntityLightning lightning = new EntityLightning( world, loc.getX(), loc.getY(), loc.getZ(), true, isSilent );
|
|
+ world.strikeLightning( lightning );
|
|
+ return new CraftLightningStrike( server, lightning );
|
|
+ }
|
|
};
|
|
|
|
public Spigot spigot()
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
|
index 243e8e5..0bacc83 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
|
@@ -31,6 +31,11 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
|
// Spigot start
|
|
private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() {
|
|
|
|
+ @Override
|
|
+ public boolean isSilent()
|
|
+ {
|
|
+ return getHandle().isSilent;
|
|
+ }
|
|
};
|
|
|
|
@Override
|
|
--
|
|
2.1.0
|
|
|