geforkt von Mirrors/Paper
Add More Lidded Block API (#5707)
Dieser Commit ist enthalten in:
Ursprung
41e6073ced
Commit
b7976b9568
@ -48,4 +48,5 @@ Camotoy <20743703+Camotoy@users.noreply.github.com>
|
||||
Bjarne Koll <lynxplay101@gmail.com>
|
||||
MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
LemonCaramel <admin@caramel.moe>
|
||||
```
|
||||
|
34
Spigot-API-Patches/0311-More-Lidded-Block-API.patch
Normale Datei
34
Spigot-API-Patches/0311-More-Lidded-Block-API.patch
Normale Datei
@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LemonCaramel <admin@caramel.moe>
|
||||
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 17843e338f2cbccfa9342b420c62d0e4d6eec31d..ebae4e660244df15bf93a78d41f8c0c5c7083b27 100644
|
||||
--- a/src/main/java/org/bukkit/block/EnderChest.java
|
||||
+++ b/src/main/java/org/bukkit/block/EnderChest.java
|
||||
@@ -3,4 +3,4 @@ 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 9da2566e02e63be1a0188deaa27b841fa61688ea..30c7df0021df44a411e50636d906d4a1d30fd927 100644
|
||||
--- a/src/main/java/org/bukkit/block/Lidded.java
|
||||
+++ b/src/main/java/org/bukkit/block/Lidded.java
|
||||
@@ -13,4 +13,13 @@ 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
|
||||
}
|
127
Spigot-Server-Patches/0745-More-Lidded-Block-API.patch
Normale Datei
127
Spigot-Server-Patches/0745-More-Lidded-Block-API.patch
Normale Datei
@ -0,0 +1,127 @@
|
||||
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/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
|
||||
index 2bc4213c70be47ca8bbc24898cc92e43f4228821..d03c4d100783b5d9f882c010a63dda3451db3c2e 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
|
||||
@@ -10,8 +10,9 @@ 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);
|
||||
@@ -106,12 +107,14 @@ 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 e27f5d689d689d4f65c285802bf327e96c113c46..f47fd41981bd89879627c2f0bb05d0ff70cc20fe 100644
|
||||
--- 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<TileEntityBarrel> 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 54eb170fd533b0e91572601268fcbc167ed9bb5c..374034e659f856895843f3e33cce750d5cca0244 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||
@@ -78,4 +78,11 @@ public class CraftChest extends CraftLootable<TileEntityChest> 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 3c0b28faa86fb2ebb6165ff9efb0e7e41230c5e4..01192a3a1354d36c1d5541ddcf4037e983fd3cf9 100644
|
||||
--- 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<TileEntityEnderChest>
|
||||
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 fcf2a1810729fda56e4064702f5f3b4d2b3f1523..ffd10dfdaf348625e1653e2fd8add5e58f895bdd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
|
||||
@@ -62,8 +62,15 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> 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
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren