mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-24 14:52:50 +02:00
43 lines
2.3 KiB
Diff
43 lines
2.3 KiB
Diff
From 81111b4cbd11a7e68111395a69795fb7a17d6e0f 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 07f265b299..b6ad68fcbf 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityConduit.java
|
|
@@ -182,7 +182,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()));
|
|
}
|
|
@@ -195,7 +202,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
|
|
|