aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1056-Expanded-Hopper-API.patch
blob: 67efc0d7a26946efe8fbcccb40bfb2fd86ee6717 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: vicisacat <victor.branchu@gmail.com>
Date: Fri, 15 Mar 2024 17:35:40 +0100
Subject: [PATCH] Expanded Hopper API

== AT ==
public net.minecraft.world.level.block.entity.HopperBlockEntity setCooldown(I)V
public net.minecraft.world.level.block.entity.HopperBlockEntity cooldownTime

diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
index d446f18df647484e2f05ab642b73e914b06fdfed..af5f27fb5ebad1e05da2b7d1a0710a2ef9c6ebbe 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
@@ -34,4 +34,17 @@ public class CraftHopper extends CraftLootable<HopperBlockEntity> implements Hop
     public CraftHopper copy() {
         return new CraftHopper(this);
     }
+
+    // Paper start - Expanded Hopper API
+    @Override
+    public void setTransferCooldown(final int cooldown) {
+        com.google.common.base.Preconditions.checkArgument(cooldown >= 0, "Hooper transfer cooldown cannot be negative (" + cooldown + ")");
+        getSnapshot().setCooldown(cooldown);
+    }
+
+    @Override
+    public int getTransferCooldown() {
+        return getSnapshot().cooldownTime;
+    }
+    // Paper end - Expanded Hopper API
 }