3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/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));