2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/inventory/ContainerAccess.java
|
|
|
|
+++ b/net/minecraft/world/inventory/ContainerAccess.java
|
|
|
|
@@ -8,6 +8,20 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
+
|
2021-06-11 07:00:00 +02:00
|
|
|
ContainerAccess NULL = new ContainerAccess() {
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public <T> Optional<T> evaluate(BiFunction<World, BlockPosition, T> bifunction) {
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -17,6 +31,18 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
static ContainerAccess create(final World world, final BlockPosition blockposition) {
|
2019-04-23 04:00:00 +02:00
|
|
|
return new ContainerAccess() {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
|
|
|
+ public World getWorld() {
|
|
|
|
+ return world;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public BlockPosition getPosition() {
|
|
|
|
+ return blockposition;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public <T> Optional<T> evaluate(BiFunction<World, BlockPosition, T> bifunction) {
|
2019-04-23 04:00:00 +02:00
|
|
|
return Optional.of(bifunction.apply(world, blockposition));
|