From 939423a8f120f22851d7ee98d71b46ea24e86fb8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 30 Jun 2016 13:33:26 +1000 Subject: [PATCH] SPIGOT-1181: Ensure Minecart command updates visually --- nms-patches/EntityMinecartCommandBlock.patch | 8 ++++++-- .../craftbukkit/entity/CraftMinecartCommand.java | 14 ++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/nms-patches/EntityMinecartCommandBlock.patch b/nms-patches/EntityMinecartCommandBlock.patch index 55a49cc0c7..7d98421eaa 100644 --- a/nms-patches/EntityMinecartCommandBlock.patch +++ b/nms-patches/EntityMinecartCommandBlock.patch @@ -1,7 +1,11 @@ --- a/net/minecraft/server/EntityMinecartCommandBlock.java +++ b/net/minecraft/server/EntityMinecartCommandBlock.java -@@ -7,6 +7,9 @@ - private static final DataWatcherObject a = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.d); +@@ -4,9 +4,12 @@ + + public class EntityMinecartCommandBlock extends EntityMinecartAbstract { + +- private static final DataWatcherObject a = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.d); ++ public static final DataWatcherObject a = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.d); // PAIL: private -> public private static final DataWatcherObject b = DataWatcher.a(EntityMinecartCommandBlock.class, DataWatcherRegistry.e); private final CommandBlockListenerAbstract c = new CommandBlockListenerAbstract() { + { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java index 813b080a2f..3e4f03a7bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java @@ -22,19 +22,25 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca super(server, entity); } + @Override + public EntityMinecartCommandBlock getHandle() { + return (EntityMinecartCommandBlock) entity; + } + @Override public String getCommand() { - return ((EntityMinecartCommandBlock) getHandle()).getCommandBlock().getCommand(); + return getHandle().getCommandBlock().getCommand(); } @Override public void setCommand(String command) { - ((EntityMinecartCommandBlock) getHandle()).getCommandBlock().setCommand(command != null ? command : ""); + getHandle().getCommandBlock().setCommand(command != null ? command : ""); + getHandle().getDataWatcher().set(EntityMinecartCommandBlock.a, getHandle().getCommandBlock().getCommand()); // PAIL: rename } @Override public void setName(String name) { - ((EntityMinecartCommandBlock) getHandle()).getCommandBlock().setName(name != null ? name : "@"); + getHandle().getCommandBlock().setName(name != null ? name : "@"); } @Override @@ -52,7 +58,7 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca @Override public String getName() { - return ((EntityMinecartCommandBlock) getHandle()).getCommandBlock().getName(); + return getHandle().getCommandBlock().getName(); } @Override