From f33c694dd3d1a2fcca2cafde450f70ce7eed680e Mon Sep 17 00:00:00 2001 From: Matsv Date: Thu, 1 Jun 2017 15:03:27 +0200 Subject: [PATCH] Cancel Shulker Decleration @ Update Block Entity & rewrite some sounds --- .../packets/BlockItemPackets.java | 22 ++++++++++++++++++- .../packets/SoundPackets.java | 6 ++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets.java index af68a2c8..1a657e74 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/BlockItemPackets.java @@ -237,6 +237,26 @@ public class BlockItemPackets extends BlockItemRewriter { } ); + // Update Block Entity + protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.POSITION); // 0 - Position + map(Type.UNSIGNED_BYTE); // 1 - Action + map(Type.NBT); // 2 - NBT + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + // Remove on shulkerbox decleration TODO convert to normal chest to make it work correctly? + if (wrapper.get(Type.UNSIGNED_BYTE, 0) == 10) { + wrapper.cancel(); + } + } + }); + } + }); + protocol.getEntityPackets().registerMetaHandler().handle(e -> { Metadata data = e.getData(); @@ -253,7 +273,7 @@ public class BlockItemPackets extends BlockItemRewriter { for (int i = 219; i < 235; i++) rewriteBlockItem(i, new Item((short) 54, (byte) 1, (short) 0, getNamedTag("1.11 Shulker Box (Color #" + (i - 219) + ")")), - new Block(i, 1)); + new Block(54, 1)); // Observer to Dispenser TODO facing position? rewriteBlockItem(218, new Item((short) 23, (byte) 1, (short) 0, getNamedTag("1.11 Observer")), new Block(23, 0)); diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/SoundPackets.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/SoundPackets.java index b36fd05f..eb9a7c81 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/SoundPackets.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_10to1_11/packets/SoundPackets.java @@ -69,10 +69,10 @@ public class SoundPackets extends SoundRewriter { protected void registerRewrites() { // TODO find good replacement sounds // Automatically generated from PAaaS - added(85, -1); // block.shulker_box.close - added(86, -1); // block.shulker_box.open + added(85, 121, 0.5f); // block.shulker_box.close -> block.wooden_trapdoor.close + added(86, 122, 0.5f); // block.shulker_box.open -> block.wooden_trapdoor.open - added(176, -1); // entity.elder_guardian.flop + added(176, 227); // entity.elder_guardian.flop -> entity.guardian.flop removed(196); // entity.experience_orb.touch