Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
43 Zeilen
1.4 KiB
Diff
43 Zeilen
1.4 KiB
Diff
|
--- 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));
|