2021-06-11 15:00:00 +10:00

40 lines
2.1 KiB
Diff

--- a/net/minecraft/world/level/block/entity/TileEntityConduit.java
+++ b/net/minecraft/world/level/block/entity/TileEntityConduit.java
@@ -29,6 +29,11 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class TileEntityConduit extends TileEntity {
private static final int BLOCK_REFRESH_RATE = 2;
@@ -205,7 +210,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (blockposition.a((BaseBlockPosition) entityhuman.getChunkCoordinates(), (double) j) && entityhuman.isInWaterOrRain()) {
- entityhuman.addEffect(new MobEffect(MobEffects.CONDUIT_POWER, 260, 0, true, true));
+ entityhuman.addEffect(new MobEffect(MobEffects.CONDUIT_POWER, 260, 0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONDUIT); // CraftBukkit
}
}
@@ -234,8 +239,13 @@
}
if (tileentityconduit.destroyTarget != null) {
- world.playSound((EntityHuman) null, tileentityconduit.destroyTarget.locX(), tileentityconduit.destroyTarget.locY(), tileentityconduit.destroyTarget.locZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
- tileentityconduit.destroyTarget.damageEntity(DamageSource.MAGIC, 4.0F);
+ // CraftBukkit start
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition);
+ if (tileentityconduit.destroyTarget.damageEntity(DamageSource.MAGIC, 4.0F)) {
+ world.playSound((EntityHuman) null, tileentityconduit.destroyTarget.locX(), tileentityconduit.destroyTarget.locY(), tileentityconduit.destroyTarget.locZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+ CraftEventFactory.blockDamage = null;
+ // CraftBukkit end
}
if (entityliving != tileentityconduit.destroyTarget) {