aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/inventory/ContainerLevelAccess.java.patch
blob: dce50df107659993b7a0d80a605e60497314ab0f (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
--- a/net/minecraft/world/inventory/ContainerLevelAccess.java
+++ b/net/minecraft/world/inventory/ContainerLevelAccess.java
@@ -7,6 +7,21 @@
 import net.minecraft.world.level.Level;
 
 public interface ContainerLevelAccess {
+
+    // CraftBukkit start
+    default Level getWorld() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    default BlockPos getPosition() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    default org.bukkit.Location getLocation() {
+        return new org.bukkit.Location(getWorld().getWorld(), getPosition().getX(), getPosition().getY(), getPosition().getZ());
+    }
+    // CraftBukkit end
+
     ContainerLevelAccess NULL = new ContainerLevelAccess() {
         @Override
         public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> levelPosConsumer) {
@@ -16,7 +31,19 @@
 
     static ContainerLevelAccess create(final Level level, final BlockPos pos) {
         return new ContainerLevelAccess() {
+            // CraftBukkit start
             @Override
+            public Level getWorld() {
+                return level;
+            }
+
+            @Override
+            public BlockPos getPosition() {
+                return pos;
+            }
+            // CraftBukkit end
+
+            @Override
             public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> levelPosConsumer) {
                 return Optional.of(levelPosConsumer.apply(level, pos));
             }