From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: LemonCaramel Date: Sun, 23 May 2021 17:49:51 +0900 Subject: [PATCH] More Lidded Block API diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java index d1046001f0c994174e5ead9e9bf423e61f4ae5c7..3ee3bbb2231d8fcdd6ff9610ec38d40ac5dd219d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java @@ -67,4 +67,11 @@ public class CraftBarrel extends CraftLootable implements Bar public CraftBarrel copy() { return new CraftBarrel(this); } + + // Paper start - More Lidded Block API + @Override + public boolean isOpen() { + return getTileEntity().openersCounter.opened; + } + // Paper end - More Lidded Block API } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 51b5edd8adf029041da69a33da0423da8f6803c8..09dc268cf5a6ba675ed198e03f252c944f4f7117 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -87,4 +87,11 @@ public class CraftChest extends CraftLootable implements Chest public CraftChest copy() { return new CraftChest(this); } + + // Paper start - More Lidded Block API + @Override + public boolean isOpen() { + return getTileEntity().openersCounter.opened; + } + // Paper end - More Lidded Block API } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java index aeaf0dc35ffa230664f7e6a45e1881fa093fdac6..89f95b39a4e655ed6999e3de2f0d928ba9bace70 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java @@ -45,4 +45,11 @@ public class CraftEnderChest extends CraftBlockEntityState implem if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.Level) { net.minecraft.world.level.Level world = getTileEntity().getLevel(); world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 0); - world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); + world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound) } getTileEntity().opened = false; } @@ -68,4 +68,11 @@ public class CraftShulkerBox extends CraftLootable implem public CraftShulkerBox copy() { return new CraftShulkerBox(this); } + + // Paper start - More Lidded Block API + @Override + public boolean isOpen() { + return getTileEntity().opened; + } + // Paper end - More Lidded Block API }