82 lines
3.9 KiB
Diff
82 lines
3.9 KiB
Diff
--- a/net/minecraft/world/level/block/entity/TileEntityConduit.java
|
|
+++ b/net/minecraft/world/level/block/entity/TileEntityConduit.java
|
|
@@ -28,6 +28,10 @@
|
|
import net.minecraft.world.phys.AxisAlignedBB;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.server.level.WorldServer;
|
|
+// CraftBukkit end
|
|
+
|
|
public class TileEntityConduit extends TileEntity {
|
|
|
|
private static final int BLOCK_REFRESH_RATE = 2;
|
|
@@ -55,7 +59,7 @@
|
|
@Override
|
|
protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
|
super.loadAdditional(nbttagcompound, holderlookup_a);
|
|
- this.destroyTargetUUID = (UUID) nbttagcompound.read("Target", UUIDUtil.CODEC).orElse((Object) null);
|
|
+ this.destroyTargetUUID = (UUID) nbttagcompound.read("Target", UUIDUtil.CODEC).orElse(null); // CraftBukkit - decompile error
|
|
}
|
|
|
|
@Override
|
|
@@ -174,8 +178,20 @@
|
|
}
|
|
|
|
private static void applyEffects(World world, BlockPosition blockposition, List<BlockPosition> list) {
|
|
+ // CraftBukkit start
|
|
+ applyEffects(world, blockposition, getRange(list));
|
|
+ }
|
|
+
|
|
+ public static int getRange(List<BlockPosition> list) {
|
|
+ // CraftBukkit end
|
|
int i = list.size();
|
|
int j = i / 7 * 16;
|
|
+ // CraftBukkit start
|
|
+ return j;
|
|
+ }
|
|
+
|
|
+ private static void applyEffects(World world, BlockPosition blockposition, int j) { // j = effect range in blocks
|
|
+ // CraftBukkit end
|
|
int k = blockposition.getX();
|
|
int l = blockposition.getY();
|
|
int i1 = blockposition.getZ();
|
|
@@ -185,7 +201,7 @@
|
|
if (!list1.isEmpty()) {
|
|
for (EntityHuman entityhuman : list1) {
|
|
if (blockposition.closerThan(entityhuman.blockPosition(), (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
|
|
}
|
|
}
|
|
|
|
@@ -193,6 +209,12 @@
|
|
}
|
|
|
|
private static void updateDestroyTarget(World world, BlockPosition blockposition, IBlockData iblockdata, List<BlockPosition> list, TileEntityConduit tileentityconduit) {
|
|
+ // CraftBukkit start - add "damageTarget" boolean
|
|
+ updateDestroyTarget(world, blockposition, iblockdata, list, tileentityconduit, true);
|
|
+ }
|
|
+
|
|
+ public static void updateDestroyTarget(World world, BlockPosition blockposition, IBlockData iblockdata, List<BlockPosition> list, TileEntityConduit tileentityconduit, boolean damageTarget) {
|
|
+ // CraftBukkit end
|
|
EntityLiving entityliving = tileentityconduit.destroyTarget;
|
|
int i = list.size();
|
|
|
|
@@ -213,9 +235,12 @@
|
|
tileentityconduit.destroyTarget = null;
|
|
}
|
|
|
|
- if (tileentityconduit.destroyTarget != null) {
|
|
- world.playSound((Entity) null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
- tileentityconduit.destroyTarget.hurt(world.damageSources().magic(), 4.0F);
|
|
+ // CraftBukkit start
|
|
+ if (damageTarget && tileentityconduit.destroyTarget != null) {
|
|
+ if (tileentityconduit.destroyTarget.hurtServer((WorldServer) world, world.damageSources().magic().directBlock(world, blockposition), 4.0F)) {
|
|
+ world.playSound((Entity) null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
if (entityliving != tileentityconduit.destroyTarget) {
|