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
|
2021-06-15 04:59:31 +02:00
|
|
|
index dcae26b698d31a8b0107b0f9757efa34f53b030a..c0e7ae7ae38d55088e1b6ae6c80b849fd740cb1a 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
|
|
|
|
@@ -59,4 +59,11 @@ public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Bar
|
|
|
|
}
|
2021-06-15 04:59:31 +02:00
|
|
|
getTileEntity().openersCounter.opened = false;
|
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
|
2021-07-18 09:41:53 +02:00
|
|
|
index 79edaefe8f6c027b5ad67c6bdcc0bb84a0582887..3b90bee227ebfc1b6436319d002b5fd35e4eeda8 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
|
2021-06-15 04:59:31 +02:00
|
|
|
@@ -79,4 +79,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2021-06-15 04:59:31 +02:00
|
|
|
getTileEntity().openersCounter.opened = false;
|
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
|
2021-06-15 06:16:18 +02:00
|
|
|
index 25add8bee6ea35beeb205dd828759304346e4f48..599f6747dfa140e40fef26ed4d8244bfe87b7cdf 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
|
|
|
|
@@ -14,4 +14,33 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
|
|
|
|
public CraftEnderChest(final Material material, final EnderChestBlockEntity te) {
|
|
|
|
super(material, te);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start - More Lidded Block API
|
|
|
|
+ @Override
|
|
|
|
+ public void open() {
|
|
|
|
+ requirePlaced();
|
2021-06-15 04:59:31 +02:00
|
|
|
+ if (!getTileEntity().openersCounter.opened) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ net.minecraft.world.level.Level world = getTileEntity().getLevel();
|
2021-06-15 06:16:18 +02:00
|
|
|
+ world.blockEvent(getTileEntity().getBlockPos(), getTileEntity().getBlockState().getBlock(), 1, getTileEntity().openersCounter.getOpenerCount() + 1);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ world.playSound(null, getPosition(), net.minecraft.sounds.SoundEvents.ENDER_CHEST_OPEN, net.minecraft.sounds.SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
|
|
|
+ }
|
2021-06-15 04:59:31 +02:00
|
|
|
+ getTileEntity().openersCounter.opened = true;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void close() {
|
|
|
|
+ requirePlaced();
|
2021-06-15 04:59:31 +02:00
|
|
|
+ if (getTileEntity().openersCounter.opened) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ net.minecraft.world.level.Level world = getTileEntity().getLevel();
|
|
|
|
+ world.blockEvent(getTileEntity().getBlockPos(), getTileEntity().getBlockState().getBlock(), 1, 0);
|
|
|
|
+ world.playSound(null, getPosition(), net.minecraft.sounds.SoundEvents.ENDER_CHEST_CLOSE, net.minecraft.sounds.SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
|
|
|
+ }
|
2021-06-15 04:59:31 +02:00
|
|
|
+ getTileEntity().openersCounter.opened = false;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @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 60f2394547153b2d2553fb88470a00ff99ac2f2d..f3f95aaac02007b5f67ba64df1b5b9b7e82e3325 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
|
|
|
@@ -61,8 +61,15 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
|
|
|
|
if (getTileEntity().opened) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start - More Lidded Block API
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isOpen() {
|
|
|
|
+ return getTileEntity().opened;
|
|
|
|
+ }
|
|
|
|
+ // Paper end - More Lidded Block API
|
|
|
|
}
|