mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 17:37:45 +01:00
SPIGOT-4319: Conduit damage should be a block event
This commit is contained in:
parent
4228a56c0d
commit
9636bb8d77
@ -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() {
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user