Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/ContainerAccess.patch

43 Zeilen
1.4 KiB
Diff

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/ContainerAccess.java
+++ b/net/minecraft/server/ContainerAccess.java
@@ -6,6 +6,20 @@
public interface ContainerAccess {
+ // CraftBukkit start
+ default World getWorld() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ default BlockPosition 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
+
ContainerAccess a = new ContainerAccess() {
@Override
public <T> Optional<T> a(BiFunction<World, BlockPosition, T> bifunction) {
@@ -15,6 +29,18 @@
static ContainerAccess at(final World world, final BlockPosition blockposition) {
return new ContainerAccess() {
+ // CraftBukkit start
+ @Override
+ public World getWorld() {
+ return world;
+ }
+
+ @Override
+ public BlockPosition getPosition() {
+ return blockposition;
+ }
+ // CraftBukkit end
+
@Override
public <T> Optional<T> a(BiFunction<World, BlockPosition, T> bifunction) {
return Optional.of(bifunction.apply(world, blockposition));