3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00
Paper/nms-patches/TileEntityConduit.patch
2019-04-23 12:00:00 +10:00

57 Zeilen
2.7 KiB
Diff

--- a/net/minecraft/server/TileEntityConduit.java
+++ b/net/minecraft/server/TileEntityConduit.java
@@ -6,6 +6,10 @@
import java.util.Random;
import java.util.UUID;
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 {
@@ -158,7 +162,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (this.position.a((BaseBlockPosition) (new BlockPosition(entityhuman)), (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
}
}
@@ -175,7 +179,7 @@
this.target = this.v();
this.k = null;
} else if (this.target == null) {
- List<EntityLiving> list = this.world.a(EntityLiving.class, this.u(), (entityliving1) -> {
+ List<EntityLiving> list = this.world.a(EntityLiving.class, this.u(), (java.util.function.Predicate<EntityLiving>) (entityliving1) -> { // CraftBukkit - decompile error
return entityliving1 instanceof IMonster && entityliving1.isInWaterOrRain();
});
@@ -187,8 +191,13 @@
}
if (this.target != null) {
- this.world.a((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
- this.target.damageEntity(DamageSource.MAGIC, 4.0F);
+ // CraftBukkit start
+ CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position);
+ if (this.target.damageEntity(DamageSource.MAGIC, 4.0F)) {
+ this.world.a((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+ CraftEventFactory.blockDamage = null;
+ // CraftBukkit end
}
if (entityliving != this.target) {
@@ -221,7 +230,7 @@
@Nullable
private EntityLiving v() {
- List<EntityLiving> list = this.world.a(EntityLiving.class, this.u(), (entityliving) -> {
+ List<EntityLiving> list = this.world.a(EntityLiving.class, this.u(), (java.util.function.Predicate<EntityLiving>) (entityliving) -> { // CraftBukkit - decompile error
return entityliving.getUniqueID().equals(this.k);
});