mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-23 02:55:27 +01:00
43 lines
2.3 KiB
Diff
43 lines
2.3 KiB
Diff
From 01c6938c93255619c89e749911cc41df63f2655a Mon Sep 17 00:00:00 2001
|
|
From: chickeneer <emcchickeneer@gmail.com>
|
|
Date: Sun, 14 Jul 2019 13:50:53 -0500
|
|
Subject: [PATCH] EMC ConduitNewTargetEvent and remove target for cancelled
|
|
damage events
|
|
|
|
---
|
|
.../java/net/minecraft/server/TileEntityConduit.java | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityConduit.java b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
index 34c191d76..3f487a9d9 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
@@ -199,7 +199,14 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
|
List<EntityLiving> list = this.world.a(EntityLiving.class, this.m(), (java.util.function.Predicate<EntityLiving>) (entityliving1) -> { // CraftBukkit - decompile error
|
|
return entityliving1 instanceof IMonster && entityliving1.isInWaterOrRain();
|
|
});
|
|
-
|
|
+ // EMC start
|
|
+ List<org.bukkit.entity.LivingEntity> bukkitEntities = Lists.newArrayListWithCapacity(list.size());
|
|
+ for (EntityLiving entity : list) {
|
|
+ bukkitEntities.add(entity.getBukkitLivingEntity());
|
|
+ }
|
|
+ new com.empireminecraft.customevents.ConduitNewTargetEvent(bukkitEntities, CraftBlock.at(this.world, this.position)).callEvent();
|
|
+ list.removeIf(entityLiving -> !bukkitEntities.contains(entityLiving.getBukkitLivingEntity()));
|
|
+ // EMC end
|
|
if (!list.isEmpty()) {
|
|
this.target = (EntityLiving) list.get(this.world.random.nextInt(list.size()));
|
|
}
|
|
@@ -212,7 +219,7 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
|
CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position);
|
|
if (this.target.damageEntity(DamageSource.MAGIC, 4.0F)) {
|
|
this.world.playSound((EntityHuman) null, this.target.locX(), this.target.locY(), this.target.locZ(), SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
- }
|
|
+ } else { this.target = null; } // EMC
|
|
CraftEventFactory.blockDamage = null;
|
|
// CraftBukkit end
|
|
}
|
|
--
|
|
2.25.1.windows.1
|
|
|