summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nms-patches/TileEntityConduit.patch33
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java2
2 files changed, 32 insertions, 3 deletions
diff --git a/nms-patches/TileEntityConduit.patch b/nms-patches/TileEntityConduit.patch
index 0d8d1ba6..c830c74c 100644
--- a/nms-patches/TileEntityConduit.patch
+++ b/nms-patches/TileEntityConduit.patch
@@ -1,6 +1,17 @@
--- a/net/minecraft/server/TileEntityConduit.java
+++ b/net/minecraft/server/TileEntityConduit.java
-@@ -152,7 +152,7 @@
+@@ -7,6 +7,10 @@
+ import java.util.UUID;
+ import java.util.function.Predicate;
+ import javax.annotation.Nullable;
++// CraftBukkit start
++import org.bukkit.craftbukkit.block.CraftBlock;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
+
+ public class TileEntityConduit extends TileEntity implements ITickable {
+
+@@ -152,7 +156,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (this.position.m(new BlockPosition(entityhuman)) <= (double) j && entityhuman.ao()) {
@@ -9,7 +20,7 @@
}
}
-@@ -169,8 +169,8 @@
+@@ -169,8 +173,8 @@
this.j = this.l();
this.k = null;
} else if (this.j == null) {
@@ -20,7 +31,23 @@
});
if (!list.isEmpty()) {
-@@ -215,7 +215,7 @@
+@@ -181,8 +185,13 @@
+ }
+
+ if (this.j != null) {
+- this.world.a((EntityHuman) null, this.j.locX, this.j.locY, this.j.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
+- this.j.damageEntity(DamageSource.MAGIC, 4.0F);
++ // CraftBukkit start
++ CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position);
++ if (this.j.damageEntity(DamageSource.MAGIC, 4.0F)) {
++ this.world.a((EntityHuman) null, this.j.locX, this.j.locY, this.j.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
++ }
++ CraftEventFactory.blockDamage = null;
++ // CraftBukkit end
+ }
+
+ if (entityliving != this.j) {
+@@ -215,7 +224,7 @@
@Nullable
private EntityLiving l() {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a50f91c9..daaf5037 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -507,6 +507,8 @@ public class CraftEventFactory {
cause = DamageCause.CONTACT;
} else if (source == DamageSource.HOT_FLOOR) {
cause = DamageCause.HOT_FLOOR;
+ } else if (source == DamageSource.MAGIC) {
+ cause = DamageCause.MAGIC;
} else {
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
}