diff --git a/LICENSE.md b/LICENSE.md index 7b1f8a1d63..775ad48bdc 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -48,4 +48,5 @@ Camotoy <20743703+Camotoy@users.noreply.github.com> Bjarne Koll MeFisto94 Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +LemonCaramel ``` diff --git a/Spigot-API-Patches/More-Lidded-Block-API.patch b/Spigot-API-Patches/More-Lidded-Block-API.patch new file mode 100644 index 0000000000..158d560b90 --- /dev/null +++ b/Spigot-API-Patches/More-Lidded-Block-API.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LemonCaramel +Date: Sun, 23 May 2021 17:49:31 +0900 +Subject: [PATCH] More Lidded Block API + + +diff --git a/src/main/java/org/bukkit/block/EnderChest.java b/src/main/java/org/bukkit/block/EnderChest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/EnderChest.java ++++ b/src/main/java/org/bukkit/block/EnderChest.java +@@ -0,0 +0,0 @@ package org.bukkit.block; + /** + * Represents a captured state of an ender chest. + */ +-public interface EnderChest extends TileState { } ++public interface EnderChest extends TileState, Lidded { } // Paper - More Lidded Block API +diff --git a/src/main/java/org/bukkit/block/Lidded.java b/src/main/java/org/bukkit/block/Lidded.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/Lidded.java ++++ b/src/main/java/org/bukkit/block/Lidded.java +@@ -0,0 +0,0 @@ public interface Lidded { + * viewing this block. + */ + void close(); ++ ++ // Paper start - More Lidded Block API ++ /** ++ * Checks if the block's animation state. ++ * ++ * @return true if the block's animation state is set to open. ++ */ ++ boolean isOpen(); ++ // Paper end - More Lidded Block API + } diff --git a/Spigot-Server-Patches/More-Lidded-Block-API.patch b/Spigot-Server-Patches/More-Lidded-Block-API.patch new file mode 100644 index 0000000000..19fee18204 --- /dev/null +++ b/Spigot-Server-Patches/More-Lidded-Block-API.patch @@ -0,0 +1,127 @@ +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/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickab + + public float a; + public float b; +- public int c; ++ public int c; public int getViewerCount() { return c; } // Paper - OBFHELPER + private int g; ++ public boolean opened; // Paper - More Lidded Block API + + public TileEntityEnderChest() { + super(TileEntityTypes.ENDER_CHEST); +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickab + + public void d() { + ++this.c; ++ if (opened) return; // Paper - More Lidded Block API + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c); + doOpenLogic(); // Paper + } + + public void f() { + --this.c; ++ if (opened) return; // Paper - More Lidded Block API + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c); + doCloseLogic(); // Paper + } +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +@@ -0,0 +0,0 @@ public class CraftBarrel extends CraftLootable implements Barr + } + getTileEntity().opened = false; + } ++ ++ // Paper start - More Lidded Block API ++ @Override ++ public boolean isOpen() { ++ return getTileEntity().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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +@@ -0,0 +0,0 @@ public class CraftChest extends CraftLootable implements Chest, + } + getTileEntity().opened = false; + } ++ ++ // Paper start - More Lidded Block API ++ @Override ++ public boolean isOpen() { ++ return getTileEntity().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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java +@@ -0,0 +0,0 @@ public class CraftEnderChest extends CraftBlockEntityState + public CraftEnderChest(final Material material, final TileEntityEnderChest te) { + super(material, te); + } ++ ++ // Paper start - More Lidded Block API ++ @Override ++ public void open() { ++ requirePlaced(); ++ if (!getTileEntity().opened) { ++ net.minecraft.world.level.World world = getTileEntity().getWorld(); ++ world.playBlockAction(getTileEntity().getPosition(), getTileEntity().getBlock().getBlock(), 1, getTileEntity().getViewerCount() + 1); ++ world.playSound(null, getPosition(), net.minecraft.sounds.SoundEffects.BLOCK_ENDER_CHEST_OPEN, net.minecraft.sounds.SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ getTileEntity().opened = true; ++ } ++ ++ @Override ++ public void close() { ++ requirePlaced(); ++ if (getTileEntity().opened) { ++ net.minecraft.world.level.World world = getTileEntity().getWorld(); ++ world.playBlockAction(getTileEntity().getPosition(), getTileEntity().getBlock().getBlock(), 1, 0); ++ world.playSound(null, getPosition(), net.minecraft.sounds.SoundEffects.BLOCK_ENDER_CHEST_CLOSE, net.minecraft.sounds.SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ getTileEntity().opened = false; ++ } ++ ++ @Override ++ public boolean isOpen() { ++ return getTileEntity().opened; ++ } ++ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java +@@ -0,0 +0,0 @@ public class CraftShulkerBox extends CraftLootable impleme + if (getTileEntity().opened) { + World world = getTileEntity().getWorld(); + world.playBlockAction(getPosition(), getTileEntity().getBlock().getBlock(), 1, 0); +- world.playSound(null, getPosition(), SoundEffects.BLOCK_SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); ++ world.playSound(null, getPosition(), SoundEffects.BLOCK_SHULKER_BOX_CLOSE, SoundCategory.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 + }