aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1036-Conduit-API.patch
blob: 9df9ff716be2c964f8aed343ff4a6ca035395c0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tamion <70228790+notTamion@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:46:40 +0100
Subject: [PATCH] Conduit API

== AT ==
public net.minecraft.world.level.block.entity.ConduitBlockEntity effectBlocks
public net.minecraft.world.level.block.entity.ConduitBlockEntity destroyTarget

diff --git a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
index 761d009cdeea28b6fd593c5bf1e4dcfa45f3fc27..37e0b762b86e74f607a4541ecb7b24ad7a591d0e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -187,7 +187,7 @@ public class ConduitBlockEntity extends BlockEntity {
 
     private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) {
         int i = activatingBlocks.size();
-        int j = i / 7 * 16;
+        int j = i / 7 * 16; // Paper - Conduit API; diff on change
         int k = pos.getX();
         int l = pos.getY();
         int i1 = pos.getZ();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
index 29bcac10a7edf53015941e4c28c4f2d9a5a3db56..f0b0348e105fb27c829ec29e638433c57bfd5f64 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
@@ -18,4 +18,23 @@ public class CraftConduit extends CraftBlockEntityState<ConduitBlockEntity> impl
     public CraftConduit copy() {
         return new CraftConduit(this);
     }
+
+    // Paper start - Conduit API
+    @Override
+    public boolean isActive() {
+        requirePlaced();
+        return this.getTileEntity().isActive();
+    }
+
+    @Override
+    public int getRange() {
+        requirePlaced();
+        return this.getTileEntity().effectBlocks.size() / 7 * 16;
+    }
+
+    @Override
+    public org.bukkit.entity.LivingEntity getTarget() {
+        return this.getTileEntity().destroyTarget == null ? null : this.getTileEntity().destroyTarget.getBukkitLivingEntity();
+    }
+    // Paper end - Conduit API
 }