mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-31 12:23:51 -07:00
42
paper-server/nms-patches/ContainerAccess.patch
Normal file
42
paper-server/nms-patches/ContainerAccess.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
--- 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));
|
Reference in New Issue
Block a user