From 4b843638ea8f10752363eb97e455174dfef19d46 Mon Sep 17 00:00:00 2001 From: Parker Hawke Date: Sun, 16 Dec 2018 18:21:29 -0500 Subject: Add BlockData#getAsString(boolean) to hide unspecified states --- nms-patches/ArgumentBlock.patch | 40 ++++++++++++++++++++++++++++++++++++++++ nms-patches/Block.patch | 9 --------- 2 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 nms-patches/ArgumentBlock.patch (limited to 'nms-patches') diff --git a/nms-patches/ArgumentBlock.patch b/nms-patches/ArgumentBlock.patch new file mode 100644 index 00000000..1c33861f --- /dev/null +++ b/nms-patches/ArgumentBlock.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/server/ArgumentBlock.java ++++ b/net/minecraft/server/ArgumentBlock.java +@@ -41,7 +41,7 @@ + private static final Function> h = SuggestionsBuilder::buildFuture; + private final StringReader i; + private final boolean j; +- private final Map, Comparable> k = Maps.newHashMap(); ++ private final Map, Comparable> k = Maps.newLinkedHashMap(); // CraftBukkit - stable + private final Map l = Maps.newHashMap(); + private MinecraftKey m = new MinecraftKey(""); + private BlockStateList n; +@@ -222,7 +222,7 @@ + if (comparable instanceof Integer) { + suggestionsbuilder.suggest((Integer) comparable); + } else { +- suggestionsbuilder.suggest(iblockstate.a(comparable)); ++ suggestionsbuilder.suggest(iblockstate.a((T) comparable)); // CraftBukkit - decompile error + } + } + +@@ -488,8 +488,8 @@ + Optional optional = iblockstate.b(s); + + if (optional.isPresent()) { +- this.o = (IBlockData) this.o.set(iblockstate, (Comparable) optional.get()); +- this.k.put(iblockstate, optional.get()); ++ this.o = (IBlockData) this.o.set(iblockstate, (T) optional.get()); // CraftBukkit - decompile error ++ this.k.put(iblockstate, (Comparable) optional.get()); // CraftBukkit - decompile error + } else { + this.i.setCursor(i); + throw ArgumentBlock.e.createWithContext(this.i, this.m.toString(), iblockstate.a(), s); +@@ -526,7 +526,7 @@ + private static > void a(StringBuilder stringbuilder, IBlockState iblockstate, Comparable comparable) { + stringbuilder.append(iblockstate.a()); + stringbuilder.append('='); +- stringbuilder.append(iblockstate.a(comparable)); ++ stringbuilder.append(iblockstate.a((T) comparable)); // CraftBukkit - decompile error + } + + public CompletableFuture a(SuggestionsBuilder suggestionsbuilder) { diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch index ee800c52..cbf78665 100644 --- a/nms-patches/Block.patch +++ b/nms-patches/Block.patch @@ -43,15 +43,6 @@ } } -@@ -646,7 +653,7 @@ - } - - public String toString() { -- return "Block{" + IRegistry.BLOCK.getKey(this) + "}"; -+ return IRegistry.BLOCK.getKey(this).toString(); // CraftBukkit - cheap hack - } - - public static boolean c(Block block) { @@ -1395,8 +1402,14 @@ } -- cgit v1.2.3