BlueGit

timfa containerpipes

Wake idle pipes when a dispenser fills a water or lava bucket.

Version 1.7.3.

Co-authored-by: Cursor <cursoragent@cursor.com>

timfa Tim Falken · pushed by timfa

Authored 2026-08-17 · 3 months ago

Hash
199cc6c619bc1008eafe7a9dab175724d64b78ec
Parent
8bab4729
9 files changed +56 −124
README.md +1 −1
@@ -1,4 +1,4 @@
1 # ContainerPipes 1.7.2
1 # ContainerPipes 1.7.3
2 2
3 3 Paper plugin that connects containers with visible pipes and moves items (or cauldron liquids) between them automatically.
4 4
@@ -1,4 +1,4 @@
1# ContainerPipes 1.7.2
1# ContainerPipes 1.7.3
2
2
3Paper plugin that connects containers with visible pipes and moves items (or cauldron liquids) between them automatically.
3Paper plugin that connects containers with visible pipes and moves items (or cauldron liquids) between them automatically.
4
4
build.gradle.kts +1 −1
@@ -1,6 +1,6 @@
1 1 plugins { java }
2 2 group = "nl.timfalken"
3 version = "1.7.2"
3 version = "1.7.3"
4 4 repositories {
5 5 maven {
6 6 name = "papermc"
@@ -1,6 +1,6 @@
1plugins { java }
1plugins { java }
2group = "nl.timfalken"
2group = "nl.timfalken"
3version = "1.7.2"
3version = "1.7.3"
4repositories {
4repositories {
5 maven {
5 maven {
6 name = "papermc"
6 name = "papermc"
src/README-1.7.1.md deleted +0 −76
@@ -1,76 +0,0 @@
1 # ContainerPipes
2
3 Paper plugin that connects containers with visible pipes and moves items (or cauldron liquids) between them automatically.
4
5 Pipes are face-independent: behaviour comes from whether a pipe is incoming or outgoing, and from Paper’s own slot rules — not from which side of the block you attach to.
6
7 ## Requirements
8
9 - Paper **26.2** (Java **25**)
10 - No other plugins required
11
12 ## Playing
13
14 1. Shift-click a supported container with an empty hand to pick the **source** side.
15 2. Shift-click the **destination** container the same way.
16 3. If a free route exists within range, a pipe appears and transfers start.
17
18 - **Shift + shears** on a pipe (or its endpoints) removes the connection.
19 - **Shift-click** an *item* pipe segment to open its filter (up to five materials). Liquid pipes have no filter UI.
20 - Only **liquid → liquid** (cauldron family) and **item → item** connections are allowed; mixed endpoints cancel the selection.
21
22 Admin command: `/containerpipes <status|reload|refresh>` (`containerpipes.admin`).
23
24 ## Supported endpoints
25
26 **Item containers**
27
28 | Type | Notes |
29 |---|---|
30 | Chests, trapped chests, copper chests, barrels | Full inventory |
31 | Hoppers, dispensers, droppers, shelves | Full inventory |
32 | Shulker boxes | Normal storage; cannot insert a shulker into a shulker |
33 | Furnaces, blast furnaces, smokers | Insert: smeltable then fuel (`canSmelt` / `isFuel`). Extract: result only |
34 | Crafters | Destination only; respects disabled slots |
35 | Brewing stands | Insert: ingredient → fuel → bottles (Paper/`canPlaceItem`). Extract: bottles only |
36 | Composters | Insert compostables (`isCompostable` / chance). Extract bone meal at full level |
37 | Chiseled bookshelves | Normal slots; books via `Tag.ITEMS_BOOKSHELF_BOOKS` |
38 | Decorated pots | Single stacked item type |
39 | Jukeboxes | Insert playable discs; extract when not playing |
40
41 **Liquid containers** (cauldron family only)
42
43 `CAULDRON`, `WATER_CAULDRON`, `LAVA_CAULDRON`, `POWDER_SNOW_CAULDRON` — one level per transfer tick. Water, lava, and powder snow do not mix. The endpoint is the **block position**, so filling or emptying the same cauldron does not break the pipe.
44
45 **Not supported:** ender chests, lecterns, minecarts, boats, redstone locking of hoppers.
46
47 Item legality uses Paper APIs and datapack tags (not hardcoded item lists), so datapack changes stay compatible.
48
49 ## Configuration
50
51 Defaults live in `config.yml` (copied to the plugin data folder on first run):
52
53 - Transfer interval and max connection range
54 - Visual pipe material, scale, and particles
55 - Filter UI titles and player messages (Dutch + English)
56 - Performance: idle sleep, wake probes, display refresh
57
58 Connections are stored in `connections.tsv` under the plugin data folder.
59
60 ## Build
61
62 ```bash
63 gradle clean jar
64 ```
65
66 Output: `build/libs/ContainerPipes-<version>.jar`
67
68 Releases are tagged as `X.Y.Z` (optional `v` prefix). The GitLab pipeline validates the tag, bumps version files, builds the jar, and publishes a GitLab Release.
69
70 ## Technical overview
71
72 - **Routing:** A* through empty space between the clicked faces; path and endpoints are persisted.
73 - **Item transfers:** Source containers are grouped and scheduled. Idle groups sleep and wake on inventory/interact/chunk events (plus a slow probe). Furnaces, brewing stands, jukeboxes, and composters use live specialty rules; ordinary inventories use a short-lived slot cache.
74 - **Liquid transfers:** Separate lightweight network with fluid-type/level cache, sleep when empty/full/incompatible, wake on `CauldronLevelChangeEvent` and internal updates.
75 - **Visuals:** Block displays for pipe segments; optional transfer particles (`DRIPPING_WATER` / `DRIPPING_LAVA` / `SNOWFLAKE` for liquids).
76 - **Code layout:** `ContainerPipesPlugin` owns connections and player UX; `OptimizedTransferPlanner` runs item transfers; `HopperStyleEndpoints` / `AdvancedEndpointsPatch` cover specialty item blocks and crafter/liquid behaviour.
@@ -1,76 +0,0 @@
1# ContainerPipes
2
3Paper plugin that connects containers with visible pipes and moves items (or cauldron liquids) between them automatically.
4
5Pipes are face-independent: behaviour comes from whether a pipe is incoming or outgoing, and from Paper’s own slot rules — not from which side of the block you attach to.
6
7## Requirements
8
9- Paper **26.2** (Java **25**)
10- No other plugins required
11
12## Playing
13
141. Shift-click a supported container with an empty hand to pick the **source** side.
152. Shift-click the **destination** container the same way.
163. If a free route exists within range, a pipe appears and transfers start.
17
18- **Shift + shears** on a pipe (or its endpoints) removes the connection.
19- **Shift-click** an *item* pipe segment to open its filter (up to five materials). Liquid pipes have no filter UI.
20- Only **liquid → liquid** (cauldron family) and **item → item** connections are allowed; mixed endpoints cancel the selection.
21
22Admin command: `/containerpipes <status|reload|refresh>` (`containerpipes.admin`).
23
24## Supported endpoints
25
26**Item containers**
27
28| Type | Notes |
29|---|---|
30| Chests, trapped chests, copper chests, barrels | Full inventory |
31| Hoppers, dispensers, droppers, shelves | Full inventory |
32| Shulker boxes | Normal storage; cannot insert a shulker into a shulker |
33| Furnaces, blast furnaces, smokers | Insert: smeltable then fuel (`canSmelt` / `isFuel`). Extract: result only |
34| Crafters | Destination only; respects disabled slots |
35| Brewing stands | Insert: ingredient → fuel → bottles (Paper/`canPlaceItem`). Extract: bottles only |
36| Composters | Insert compostables (`isCompostable` / chance). Extract bone meal at full level |
37| Chiseled bookshelves | Normal slots; books via `Tag.ITEMS_BOOKSHELF_BOOKS` |
38| Decorated pots | Single stacked item type |
39| Jukeboxes | Insert playable discs; extract when not playing |
40
41**Liquid containers** (cauldron family only)
42
43`CAULDRON`, `WATER_CAULDRON`, `LAVA_CAULDRON`, `POWDER_SNOW_CAULDRON` — one level per transfer tick. Water, lava, and powder snow do not mix. The endpoint is the **block position**, so filling or emptying the same cauldron does not break the pipe.
44
45**Not supported:** ender chests, lecterns, minecarts, boats, redstone locking of hoppers.
46
47Item legality uses Paper APIs and datapack tags (not hardcoded item lists), so datapack changes stay compatible.
48
49## Configuration
50
51Defaults live in `config.yml` (copied to the plugin data folder on first run):
52
53- Transfer interval and max connection range
54- Visual pipe material, scale, and particles
55- Filter UI titles and player messages (Dutch + English)
56- Performance: idle sleep, wake probes, display refresh
57
58Connections are stored in `connections.tsv` under the plugin data folder.
59
60## Build
61
62```bash
63gradle clean jar
64```
65
66Output: `build/libs/ContainerPipes-<version>.jar`
67
68Releases are tagged as `X.Y.Z` (optional `v` prefix). The GitLab pipeline validates the tag, bumps version files, builds the jar, and publishes a GitLab Release.
69
70## Technical overview
71
72- **Routing:** A* through empty space between the clicked faces; path and endpoints are persisted.
73- **Item transfers:** Source containers are grouped and scheduled. Idle groups sleep and wake on inventory/interact/chunk events (plus a slow probe). Furnaces, brewing stands, jukeboxes, and composters use live specialty rules; ordinary inventories use a short-lived slot cache.
74- **Liquid transfers:** Separate lightweight network with fluid-type/level cache, sleep when empty/full/incompatible, wake on `CauldronLevelChangeEvent` and internal updates.
75- **Visuals:** Block displays for pipe segments; optional transfer particles (`DRIPPING_WATER` / `DRIPPING_LAVA` / `SNOWFLAKE` for liquids).
76- **Code layout:** `ContainerPipesPlugin` owns connections and player UX; `OptimizedTransferPlanner` runs item transfers; `HopperStyleEndpoints` / `AdvancedEndpointsPatch` cover specialty item blocks and crafter/liquid behaviour.
src/README-1.7.2.md deleted +0 −44
@@ -1,44 +0,0 @@
1 # ContainerPipes 1.7.2
2
3 Builds on 1.7.0 (Crafter destinations + liquid cauldron pipes).
4
5 ## Powder snow liquids
6
7 `POWDER_SNOW_CAULDRON` is a third transferable liquid, with the same 3-level `Levelled` behaviour as water:
8
9 - one cauldron level moves per transfer interval
10 - empty `CAULDRON` ↔ powder snow levels work like water
11 - water, lava and powder snow never mix (incompatible destination → no transfer)
12
13 Particle: `SNOWFLAKE` (water/lava still use `DRIPPING_WATER` / `DRIPPING_LAVA`).
14
15 ## Cauldron endpoint identity
16
17 A liquid endpoint is the **cauldron position**, not the current block material. The same pipe stays valid across:
18
19 `CAULDRON` ↔ `WATER_CAULDRON` ↔ `LAVA_CAULDRON` ↔ `POWDER_SNOW_CAULDRON`
20
21 ## Hopper-style containers (face-independent)
22
23 Pipes support the same container interactions hoppers do, but **slot choice does not depend on which face the pipe attaches to**. Incoming vs outgoing pipes plus Paper slot rules decide the behaviour.
24
25 | Endpoint | Behaviour |
26 |---|---|
27 | Chest / barrel / copper chest / hopper / dispenser / dropper / shelf / shulker | Normal storage (shulker-in-shulker blocked via `Tag.SHULKER_BOXES`) |
28 | Furnace / blast furnace / smoker | Insert: `canSmelt` then `isFuel`. Extract: result slot only |
29 | Crafter | Destination-only; live disabled slots |
30 | Brewing stand | Insert: ingredient → fuel (`Tag.ITEMS_BREWING_FUEL`) → bottles, each gated by Paper/NMS `canPlaceItem`. Extract: bottle slots only |
31 | Composter | Insert: `Material.isCompostable()` + `getCompostChance()`. Extract: bone meal at max level. Level cache only (no slot cache) |
32 | Chiseled bookshelf | Normal slot cache; insert gated by `Tag.ITEMS_BOOKSHELF_BOOKS` |
33 | Decorated pot | Single-item stack via `DecoratedPotInventory` |
34 | Jukebox | Insert if `DataComponentTypes.JUKEBOX_PLAYABLE`; extract when not playing |
35
36 Not supported (hoppers cannot either): ender chest, lectern. Minecarts/entities and redstone locking are ignored.
37
38 Item legality always comes from Paper APIs / datapack tags — not hardcoded item lists — so datapack changes stay compatible.
39
40 ## Still from 1.7.0
41
42 Liquid pipes: liquid → liquid only; no filter UI; shift + shears removes. Wakeups via `CauldronLevelChangeEvent` + cache + emergency probe.
43
44 Existing `connections.tsv` and `config.yml` remain compatible.
@@ -1,44 +0,0 @@
1# ContainerPipes 1.7.2
2
3Builds on 1.7.0 (Crafter destinations + liquid cauldron pipes).
4
5## Powder snow liquids
6
7`POWDER_SNOW_CAULDRON` is a third transferable liquid, with the same 3-level `Levelled` behaviour as water:
8
9- one cauldron level moves per transfer interval
10- empty `CAULDRON` ↔ powder snow levels work like water
11- water, lava and powder snow never mix (incompatible destination → no transfer)
12
13Particle: `SNOWFLAKE` (water/lava still use `DRIPPING_WATER` / `DRIPPING_LAVA`).
14
15## Cauldron endpoint identity
16
17A liquid endpoint is the **cauldron position**, not the current block material. The same pipe stays valid across:
18
19`CAULDRON` ↔ `WATER_CAULDRON` ↔ `LAVA_CAULDRON` ↔ `POWDER_SNOW_CAULDRON`
20
21## Hopper-style containers (face-independent)
22
23Pipes support the same container interactions hoppers do, but **slot choice does not depend on which face the pipe attaches to**. Incoming vs outgoing pipes plus Paper slot rules decide the behaviour.
24
25| Endpoint | Behaviour |
26|---|---|
27| Chest / barrel / copper chest / hopper / dispenser / dropper / shelf / shulker | Normal storage (shulker-in-shulker blocked via `Tag.SHULKER_BOXES`) |
28| Furnace / blast furnace / smoker | Insert: `canSmelt` then `isFuel`. Extract: result slot only |
29| Crafter | Destination-only; live disabled slots |
30| Brewing stand | Insert: ingredient → fuel (`Tag.ITEMS_BREWING_FUEL`) → bottles, each gated by Paper/NMS `canPlaceItem`. Extract: bottle slots only |
31| Composter | Insert: `Material.isCompostable()` + `getCompostChance()`. Extract: bone meal at max level. Level cache only (no slot cache) |
32| Chiseled bookshelf | Normal slot cache; insert gated by `Tag.ITEMS_BOOKSHELF_BOOKS` |
33| Decorated pot | Single-item stack via `DecoratedPotInventory` |
34| Jukebox | Insert if `DataComponentTypes.JUKEBOX_PLAYABLE`; extract when not playing |
35
36Not supported (hoppers cannot either): ender chest, lectern. Minecarts/entities and redstone locking are ignored.
37
38Item legality always comes from Paper APIs / datapack tags — not hardcoded item lists — so datapack changes stay compatible.
39
40## Still from 1.7.0
41
42Liquid pipes: liquid → liquid only; no filter UI; shift + shears removes. Wakeups via `CauldronLevelChangeEvent` + cache + emergency probe.
43
44Existing `connections.tsv` and `config.yml` remain compatible.
src/README-1.7.3.md added +13 −0
@@ -0,0 +1,13 @@
1 # ContainerPipes 1.7.3
2
3 Builds on 1.7.2 (powder-snow liquids + hopper-style endpoints).
4
5 ## Dispenser bucket wake
6
7 Idle pipes now wake on `BlockDispenseEvent`. A dispenser that fills an empty bucket from water/lava/powder snow (or empties a filled bucket) no longer waits for the sleeping probe: the dispenser inventory is re-read one tick later, and the block it faces is woken too so a cauldron endpoint can resume.
8
9 ## Still from 1.7.2
10
11 Powder snow liquids, cauldron position identity, and face-independent hopper-style containers are unchanged.
12
13 Existing `connections.tsv` and `config.yml` remain compatible.
@@ -0,0 +1,13 @@
1# ContainerPipes 1.7.3
2
3Builds on 1.7.2 (powder-snow liquids + hopper-style endpoints).
4
5## Dispenser bucket wake
6
7Idle pipes now wake on `BlockDispenseEvent`. A dispenser that fills an empty bucket from water/lava/powder snow (or empties a filled bucket) no longer waits for the sleeping probe: the dispenser inventory is re-read one tick later, and the block it faces is woken too so a cauldron endpoint can resume.
8
9## Still from 1.7.2
10
11Powder snow liquids, cauldron position identity, and face-independent hopper-style containers are unchanged.
12
13Existing `connections.tsv` and `config.yml` remain compatible.
src/main/java/nl/timfalken/containerpipes/AdvancedEndpointsPatch.java +17 −0
@@ -192,6 +192,7 @@ public final class AdvancedEndpointsPatch {
192 192 String[] eventNames = {
193 193 "org.bukkit.event.player.PlayerInteractEvent",
194 194 "org.bukkit.event.block.CauldronLevelChangeEvent",
195 "org.bukkit.event.block.BlockDispenseEvent",
195 196 "org.bukkit.event.world.ChunkLoadEvent"
196 197 };
197 198 for (String name : eventNames) {
@@ -209,6 +210,11 @@ public final class AdvancedEndpointsPatch {
209 210 else if (name.endsWith("CauldronLevelChangeEvent")) {
210 211 Object block = call(event, "getBlock");
211 212 scheduleWakeBlock(block, 1L);
213 } else if (name.endsWith("BlockDispenseEvent") || name.endsWith("BlockDispenseArmorEvent")) {
214 // Dispenser bucket fill/empty can change a cauldron without a
215 // player interact. Wake the dispenser target one tick later.
216 Object block = call(event, "getBlock");
217 scheduleWakeFacing(block, 1L);
212 218 } else if (name.endsWith("ChunkLoadEvent")) {
213 219 // Connections are intentionally not tagged with a persisted pipe
214 220 // kind, so an endpoint that was unloaded during plugin startup can
@@ -455,6 +461,17 @@ public final class AdvancedEndpointsPatch {
455 461 }, delay);
456 462 }
457 463
464 void scheduleWakeFacing(Object block, long delay) {
465 try {
466 Object data = call(block, "getBlockData");
467 Object facing = call(data, "getFacing");
468 ClassLoader cl = plugin.getClass().getClassLoader();
469 Class<?> blockFace = Class.forName("org.bukkit.block.BlockFace", false, cl);
470 Object target = call(block, "getRelative", new Class<?>[]{blockFace}, facing);
471 scheduleWakeBlock(target, delay);
472 } catch (Throwable ignored) {}
473 }
474
458 475 void wakeChunk(Object chunk) throws Exception {
459 476 Object world = call(chunk, "getWorld");
460 477 UUID worldId = (UUID) call(world, "getUID");
@@ -192,6 +192,7 @@ public final class AdvancedEndpointsPatch {
192 String[] eventNames = {
192 String[] eventNames = {
193 "org.bukkit.event.player.PlayerInteractEvent",
193 "org.bukkit.event.player.PlayerInteractEvent",
194 "org.bukkit.event.block.CauldronLevelChangeEvent",
194 "org.bukkit.event.block.CauldronLevelChangeEvent",
195 "org.bukkit.event.block.BlockDispenseEvent",
195 "org.bukkit.event.world.ChunkLoadEvent"
196 "org.bukkit.event.world.ChunkLoadEvent"
196 };
197 };
197 for (String name : eventNames) {
198 for (String name : eventNames) {
@@ -209,6 +210,11 @@ public final class AdvancedEndpointsPatch {
209 else if (name.endsWith("CauldronLevelChangeEvent")) {
210 else if (name.endsWith("CauldronLevelChangeEvent")) {
210 Object block = call(event, "getBlock");
211 Object block = call(event, "getBlock");
211 scheduleWakeBlock(block, 1L);
212 scheduleWakeBlock(block, 1L);
213 } else if (name.endsWith("BlockDispenseEvent") || name.endsWith("BlockDispenseArmorEvent")) {
214 // Dispenser bucket fill/empty can change a cauldron without a
215 // player interact. Wake the dispenser target one tick later.
216 Object block = call(event, "getBlock");
217 scheduleWakeFacing(block, 1L);
212 } else if (name.endsWith("ChunkLoadEvent")) {
218 } else if (name.endsWith("ChunkLoadEvent")) {
213 // Connections are intentionally not tagged with a persisted pipe
219 // Connections are intentionally not tagged with a persisted pipe
214 // kind, so an endpoint that was unloaded during plugin startup can
220 // kind, so an endpoint that was unloaded during plugin startup can
@@ -455,6 +461,17 @@ public final class AdvancedEndpointsPatch {
455 }, delay);
461 }, delay);
456 }
462 }
457
463
464 void scheduleWakeFacing(Object block, long delay) {
465 try {
466 Object data = call(block, "getBlockData");
467 Object facing = call(data, "getFacing");
468 ClassLoader cl = plugin.getClass().getClassLoader();
469 Class<?> blockFace = Class.forName("org.bukkit.block.BlockFace", false, cl);
470 Object target = call(block, "getRelative", new Class<?>[]{blockFace}, facing);
471 scheduleWakeBlock(target, delay);
472 } catch (Throwable ignored) {}
473 }
474
458 void wakeChunk(Object chunk) throws Exception {
475 void wakeChunk(Object chunk) throws Exception {
459 Object world = call(chunk, "getWorld");
476 Object world = call(chunk, "getWorld");
460 UUID worldId = (UUID) call(world, "getUID");
477 UUID worldId = (UUID) call(world, "getUID");
src/main/java/nl/timfalken/containerpipes/ContainerPipesPlugin.java +1 −1
@@ -57,7 +57,7 @@ public final class ContainerPipesPlugin extends JavaPlugin implements Listener,
57 57 loadConnections();
58 58 startTasks();
59 59 Bukkit.getScheduler().runTask(this, this::refreshLoadedDisplays);
60 getLogger().info("ContainerPipes 1.7.2 enabled with " + connections.size() + " connection(s).");
60 getLogger().info("ContainerPipes 1.7.3 enabled with " + connections.size() + " connection(s).");
61 61 AdvancedEndpointsPatch.enable(this);
62 62 }
63 63
@@ -57,7 +57,7 @@ public final class ContainerPipesPlugin extends JavaPlugin implements Listener,
57 loadConnections();
57 loadConnections();
58 startTasks();
58 startTasks();
59 Bukkit.getScheduler().runTask(this, this::refreshLoadedDisplays);
59 Bukkit.getScheduler().runTask(this, this::refreshLoadedDisplays);
60 getLogger().info("ContainerPipes 1.7.2 enabled with " + connections.size() + " connection(s).");
60 getLogger().info("ContainerPipes 1.7.3 enabled with " + connections.size() + " connection(s).");
61 AdvancedEndpointsPatch.enable(this);
61 AdvancedEndpointsPatch.enable(this);
62 }
62 }
63
63
src/main/java/nl/timfalken/containerpipes/OptimizedTransferPlanner.java +22 −0
@@ -5,10 +5,13 @@ import org.bukkit.Location;
5 5 import org.bukkit.Material;
6 6 import org.bukkit.World;
7 7 import org.bukkit.block.Block;
8 import org.bukkit.block.BlockFace;
8 9 import org.bukkit.block.BlockState;
9 10 import org.bukkit.block.Chest;
10 11 import org.bukkit.block.Container;
11 12 import org.bukkit.block.DoubleChest;
13 import org.bukkit.block.data.BlockData;
14 import org.bukkit.block.data.Directional;
12 15 import org.bukkit.configuration.file.FileConfiguration;
13 16 import org.bukkit.inventory.BrewerInventory;
14 17 import org.bukkit.inventory.ChiseledBookshelfInventory;
@@ -314,6 +317,9 @@ public final class OptimizedTransferPlanner {
314 317 // Bookshelf / pot / jukebox / composter bone-meal often change via
315 318 // right-click without opening an inventory GUI.
316 319 "org.bukkit.event.player.PlayerInteractEvent",
320 // Dispenser/dropper/crafter: empty bucket ↔ water/lava/powder-snow
321 // bucket (and other dispense mutations) never open an inventory GUI.
322 "org.bukkit.event.block.BlockDispenseEvent",
317 323 "org.bukkit.event.world.ChunkLoadEvent",
318 324 "org.bukkit.event.world.ChunkUnloadEvent"
319 325 };
@@ -368,6 +374,13 @@ public final class OptimizedTransferPlanner {
368 374 if (!actionName.contains("RIGHT_CLICK_BLOCK") && !actionName.contains("LEFT_CLICK_BLOCK")) return;
369 375 Object clicked = call(event, "getClickedBlock");
370 376 if (clicked instanceof Block block) schedule(() -> wakeBlock(block), 1L);
377 } else if (name.endsWith("BlockDispenseEvent") || name.endsWith("BlockDispenseArmorEvent")) {
378 // Inventory replacement (bucket fill/empty) is applied after this event.
379 Block block = (Block) call(event, "getBlock");
380 schedule(() -> {
381 wakeBlock(block);
382 wakeDispenseTarget(block);
383 }, 1L);
371 384 } else if (name.endsWith("ChunkLoadEvent") || name.endsWith("ChunkUnloadEvent")) {
372 385 // Double-chest canonical identities can change as either half loads.
373 386 lastConnectionCount = -1;
@@ -390,6 +403,15 @@ public final class OptimizedTransferPlanner {
390 403 if (inventory != null) wakeInventory(inventory);
391 404 }
392 405
406 void wakeDispenseTarget(Block dispenser) {
407 if (dispenser == null) return;
408 BlockData data = dispenser.getBlockData();
409 if (!(data instanceof Directional directional)) return;
410 BlockFace facing = directional.getFacing();
411 if (facing == null) return;
412 wakeBlock(dispenser.getRelative(facing));
413 }
414
393 415 void schedule(Runnable runnable, long delay) throws Exception {
394 416 Object scheduler = call(call(plugin, "getServer"), "getScheduler");
395 417 Class<?> pluginInterface = Class.forName("org.bukkit.plugin.Plugin", false, plugin.getClass().getClassLoader());
@@ -5,10 +5,13 @@ import org.bukkit.Location;
5import org.bukkit.Material;
5import org.bukkit.Material;
6import org.bukkit.World;
6import org.bukkit.World;
7import org.bukkit.block.Block;
7import org.bukkit.block.Block;
8import org.bukkit.block.BlockFace;
8import org.bukkit.block.BlockState;
9import org.bukkit.block.BlockState;
9import org.bukkit.block.Chest;
10import org.bukkit.block.Chest;
10import org.bukkit.block.Container;
11import org.bukkit.block.Container;
11import org.bukkit.block.DoubleChest;
12import org.bukkit.block.DoubleChest;
13import org.bukkit.block.data.BlockData;
14import org.bukkit.block.data.Directional;
12import org.bukkit.configuration.file.FileConfiguration;
15import org.bukkit.configuration.file.FileConfiguration;
13import org.bukkit.inventory.BrewerInventory;
16import org.bukkit.inventory.BrewerInventory;
14import org.bukkit.inventory.ChiseledBookshelfInventory;
17import org.bukkit.inventory.ChiseledBookshelfInventory;
@@ -314,6 +317,9 @@ public final class OptimizedTransferPlanner {
314 // Bookshelf / pot / jukebox / composter bone-meal often change via
317 // Bookshelf / pot / jukebox / composter bone-meal often change via
315 // right-click without opening an inventory GUI.
318 // right-click without opening an inventory GUI.
316 "org.bukkit.event.player.PlayerInteractEvent",
319 "org.bukkit.event.player.PlayerInteractEvent",
320 // Dispenser/dropper/crafter: empty bucket ↔ water/lava/powder-snow
321 // bucket (and other dispense mutations) never open an inventory GUI.
322 "org.bukkit.event.block.BlockDispenseEvent",
317 "org.bukkit.event.world.ChunkLoadEvent",
323 "org.bukkit.event.world.ChunkLoadEvent",
318 "org.bukkit.event.world.ChunkUnloadEvent"
324 "org.bukkit.event.world.ChunkUnloadEvent"
319 };
325 };
@@ -368,6 +374,13 @@ public final class OptimizedTransferPlanner {
368 if (!actionName.contains("RIGHT_CLICK_BLOCK") && !actionName.contains("LEFT_CLICK_BLOCK")) return;
374 if (!actionName.contains("RIGHT_CLICK_BLOCK") && !actionName.contains("LEFT_CLICK_BLOCK")) return;
369 Object clicked = call(event, "getClickedBlock");
375 Object clicked = call(event, "getClickedBlock");
370 if (clicked instanceof Block block) schedule(() -> wakeBlock(block), 1L);
376 if (clicked instanceof Block block) schedule(() -> wakeBlock(block), 1L);
377 } else if (name.endsWith("BlockDispenseEvent") || name.endsWith("BlockDispenseArmorEvent")) {
378 // Inventory replacement (bucket fill/empty) is applied after this event.
379 Block block = (Block) call(event, "getBlock");
380 schedule(() -> {
381 wakeBlock(block);
382 wakeDispenseTarget(block);
383 }, 1L);
371 } else if (name.endsWith("ChunkLoadEvent") || name.endsWith("ChunkUnloadEvent")) {
384 } else if (name.endsWith("ChunkLoadEvent") || name.endsWith("ChunkUnloadEvent")) {
372 // Double-chest canonical identities can change as either half loads.
385 // Double-chest canonical identities can change as either half loads.
373 lastConnectionCount = -1;
386 lastConnectionCount = -1;
@@ -390,6 +403,15 @@ public final class OptimizedTransferPlanner {
390 if (inventory != null) wakeInventory(inventory);
403 if (inventory != null) wakeInventory(inventory);
391 }
404 }
392
405
406 void wakeDispenseTarget(Block dispenser) {
407 if (dispenser == null) return;
408 BlockData data = dispenser.getBlockData();
409 if (!(data instanceof Directional directional)) return;
410 BlockFace facing = directional.getFacing();
411 if (facing == null) return;
412 wakeBlock(dispenser.getRelative(facing));
413 }
414
393 void schedule(Runnable runnable, long delay) throws Exception {
415 void schedule(Runnable runnable, long delay) throws Exception {
394 Object scheduler = call(call(plugin, "getServer"), "getScheduler");
416 Object scheduler = call(call(plugin, "getServer"), "getScheduler");
395 Class<?> pluginInterface = Class.forName("org.bukkit.plugin.Plugin", false, plugin.getClass().getClassLoader());
417 Class<?> pluginInterface = Class.forName("org.bukkit.plugin.Plugin", false, plugin.getClass().getClassLoader());
src/main/resources/plugin.yml +1 −1
@@ -1,5 +1,5 @@
1 1 name: ContainerPipes
2 version: '1.7.2'
2 version: '1.7.3'
3 3 main: nl.timfalken.containerpipes.ContainerPipesPlugin
4 4 api-version: '26.2'
5 5 author: Tim Falken
@@ -1,5 +1,5 @@
1name: ContainerPipes
1name: ContainerPipes
2version: '1.7.2'
2version: '1.7.3'
3main: nl.timfalken.containerpipes.ContainerPipesPlugin
3main: nl.timfalken.containerpipes.ContainerPipesPlugin
4api-version: '26.2'
4api-version: '26.2'
5author: Tim Falken
5author: Tim Falken