PaperMC/patches/server/0608-More-Lidded-Block-API.patch

80 lines
3.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: LemonCaramel <admin@caramel.moe>
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
2021-06-11 14:02:28 +02:00
--- 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<BarrelBlockEntity> implements Bar
public CraftBarrel copy() {
return new CraftBarrel(this);
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start - More Lidded Block API
+ @Override
+ public boolean isOpen() {
2021-06-15 04:59:31 +02:00
+ return getTileEntity().openersCounter.opened;
2021-06-11 14:02:28 +02:00
+ }
+ // 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
2021-06-11 14:02:28 +02:00
--- 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<ChestBlockEntity> implements Chest
public CraftChest copy() {
return new CraftChest(this);
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start - More Lidded Block API
+ @Override
+ public boolean isOpen() {
2021-06-15 04:59:31 +02:00
+ return getTileEntity().openersCounter.opened;
2021-06-11 14:02:28 +02:00
+ }
+ // 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
2021-06-11 14:02:28 +02:00
--- 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<EnderChestBlockEntity
public CraftEnderChest copy() {
return new CraftEnderChest(this);
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start - More Lidded Block API
+ @Override
+ public boolean isOpen() {
2021-06-15 04:59:31 +02:00
+ return getTileEntity().openersCounter.opened;
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end - More Lidded Block API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
index 823b9f42b20724a0780af03ffef3d0271d660a95..97e34bef95bc839c136db2cff39eaf66566c90b9 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
@@ -59,7 +59,7 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.Level) {
net.minecraft.world.level.Level world = getTileEntity().getLevel();
2021-06-11 14:02:28 +02:00
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<ShulkerBoxBlockEntity> implem
public CraftShulkerBox copy() {
return new CraftShulkerBox(this);
}
2021-06-11 14:02:28 +02:00
+
+ // Paper start - More Lidded Block API
+ @Override
+ public boolean isOpen() {
+ return getTileEntity().opened;
+ }
+ // Paper end - More Lidded Block API
}