Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
77a5779e24
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2ec53f49 PR-1050: Fix empty result check for Complex Recipes 10671012 PR-1044: Add CrafterCraftEvent 4d87ffe0 Use correct method in JavaDoc ae5e5817 SPIGOT-7850: Add API for Bogged shear state 46b6d445 SPIGOT-7837: Support data pack banner patterns d5d0cefc Fix JavaDoc error b3c2b83d PR-1036: Add API for InventoryView derivatives 1fe2c75a SPIGOT-7809: Add ShieldMeta CraftBukkit Changes: 8ee6fd1b8 SPIGOT-7857: Improve ItemMeta block data deserialization 8f26c30c6 SPIGOT-7857: Fix spurious internal NBT tag when deserializing BlockStateMeta 759061b93 SPIGOT-7855: Fire does not spread or burn blocks 00fc9fb64 SPIGOT-7853: AnvilInventory#getRepairCost() always returns 0 7501e2e04 PR-1450: Add CrafterCraftEvent 8c51673e7 SPIGOT-5731: PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel d53d0d0b1 PR-1456: Fix inverted logic in CraftCrafterView#setSlotDisabled 682a678c8 SPIGOT-7850: Add API for Bogged shear state fccf5243a SPIGOT-7837: Support data pack banner patterns 9c3bd4390 PR-1431: Add API for InventoryView derivatives 0cc6acbc4 SPIGOT-7849: Fix FoodComponent serialize with "using-converts-to" using null 2c5474952 Don't rely on tags for CraftItemMetas 20d107e46 SPIGOT-7846: Fix ItemMeta for hanging signs 76f59e315 Remove redundant clone in Dropper InventoryMoveItemEvent e61a53d25 SPIGOT-7817: Call InventoryMoveItemEvent for Crafters 894682e2d SPIGOT-7839: Remove redundant Java version checks 2c12b2187 SPIGOT-7809: Add ShieldMeta and fix setting shield base colours Spigot Changes: fb8fb722 Rebuild patches 34bd42b7 SPIGOT-7835: Fix issue with custom hopper settings
101 Zeilen
4.6 KiB
Diff
101 Zeilen
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Thu, 23 Sep 2021 10:40:09 -0700
|
|
Subject: [PATCH] More CommandBlock API
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..0b42306f17bf8850a13a51067c2d19e7583187e5
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java
|
|
@@ -0,0 +1,33 @@
|
|
+package io.papermc.paper.commands;
|
|
+
|
|
+import io.papermc.paper.adventure.PaperAdventure;
|
|
+import io.papermc.paper.command.CommandBlockHolder;
|
|
+import net.kyori.adventure.text.Component;
|
|
+import net.minecraft.world.level.BaseCommandBlock;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+public interface PaperCommandBlockHolder extends CommandBlockHolder {
|
|
+
|
|
+ BaseCommandBlock getCommandBlockHandle();
|
|
+
|
|
+ @Override
|
|
+ default @NotNull Component lastOutput() {
|
|
+ return PaperAdventure.asAdventure(getCommandBlockHandle().getLastOutput());
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ default void lastOutput(@Nullable Component lastOutput) {
|
|
+ getCommandBlockHandle().setLastOutput(PaperAdventure.asVanilla(lastOutput));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ default int getSuccessCount() {
|
|
+ return getCommandBlockHandle().getSuccessCount();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ default void setSuccessCount(int successCount) {
|
|
+ getCommandBlockHandle().setSuccessCount(successCount);
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
|
index f5b0bec4c1164fe7ef6da1f19a6ce9bb3d6864d0..138e6539a7786ded482a24aa88a367da7beaabf9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
|
|
@@ -6,7 +6,7 @@ import org.bukkit.World;
|
|
import org.bukkit.block.CommandBlock;
|
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
|
|
|
-public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock {
|
|
+public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock, io.papermc.paper.commands.PaperCommandBlockHolder {
|
|
|
|
public CraftCommandBlock(World world, CommandBlockEntity tileEntity) {
|
|
super(world, tileEntity);
|
|
@@ -56,5 +56,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
|
|
public void name(net.kyori.adventure.text.Component name) {
|
|
getSnapshot().getCommandBlock().setCustomName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
|
+ return getSnapshot().getCommandBlock();
|
|
+ }
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
|
index 9ea1537408ff2d790747b6e5a681d9171a4233ae..f34fa6715e477936097367a7aefd1a2bf87d3d90 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java
|
|
@@ -13,7 +13,7 @@ import org.bukkit.permissions.PermissionAttachment;
|
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
-public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart {
|
|
+public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart, io.papermc.paper.commands.PaperCommandBlockHolder {
|
|
private final PermissibleBase perm = new PermissibleBase(this);
|
|
|
|
public CraftMinecartCommand(CraftServer server, MinecartCommandBlock entity) {
|
|
@@ -64,6 +64,17 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
|
|
public net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component name() {
|
|
return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().getCommandBlock().getName());
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() {
|
|
+ return getHandle().getCommandBlock();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void lastOutput(net.kyori.adventure.text.Component lastOutput) {
|
|
+ io.papermc.paper.commands.PaperCommandBlockHolder.super.lastOutput(lastOutput);
|
|
+ getCommandBlockHandle().onUpdated();
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|