2020-06-23 16:39:42 +02:00
|
|
|
From 01c6938c93255619c89e749911cc41df63f2655a Mon Sep 17 00:00:00 2001
|
2020-02-26 20:12:29 +01:00
|
|
|
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
|
2020-06-16 16:46:05 +02:00
|
|
|
index 34c191d76..3f487a9d9 100644
|
2020-02-26 20:12:29 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
2020-06-16 16:46:05 +02:00
|
|
|
@@ -199,7 +199,14 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
2020-02-26 20:12:29 +01:00
|
|
|
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()));
|
|
|
|
}
|
2020-06-16 16:46:05 +02:00
|
|
|
@@ -212,7 +219,7 @@ public class TileEntityConduit extends TileEntity implements ITickable {
|
2020-02-26 20:12:29 +01:00
|
|
|
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
|
|
|
|
|