From d56921b611cb4628bb7a11cc0d583ac322e85f88 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 16 Mar 2022 23:06:58 +0100 Subject: [PATCH] Actually everything from 22w11a --- .../Protocol1_18_2To1_19.java | 2 - .../packets/BlockItemPackets1_19.java | 28 +--- .../storage/BlockAckStorage.java | 67 --------- .../viabackwards/data/mapping-1.18to1.19.json | 128 ++++++++++++++++++ 4 files changed, 130 insertions(+), 95 deletions(-) delete mode 100644 common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/BlockAckStorage.java diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java index 45941c11..af704181 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java @@ -24,7 +24,6 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.data.BackwardsMappings; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.BlockItemPackets1_19; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.EntityPackets1_19; -import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.BlockAckStorage; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; @@ -124,7 +123,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol { - wrapper.read(Type.VAR_INT); // Sequence - - // The server only sends one a tick - /*final BlockAckStorage storage = wrapper.user().get(BlockAckStorage.class); - BlockAckStorage.BlockAction action; - while ((action = storage.poll()) != null) { - final PacketWrapper ackPacket = wrapper.create(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING); - ackPacket.write(Type.POSITION1_14, blockPosition); - ackPacket.write(Type.VAR_INT, action.action()); - ackPacket.write(Type.VAR_INT, (int) action.action()); - ackPacket.write(Type.BOOLEAN, true); // Approved - ackPacket.send(Protocol1_18_2To1_19.class); - }*/ - - wrapper.cancel(); - }); + read(Type.VAR_INT); // Sequence + handler(PacketWrapper::cancel); // This is fine:tm: } }); @@ -176,13 +159,6 @@ public final class BlockItemPackets1_19 extends ItemRewriter { - final int action = wrapper.get(Type.VAR_INT, 0); - if (action < 3) { - final BlockAckStorage storage = wrapper.user().get(BlockAckStorage.class); - storage.add(wrapper.get(Type.POSITION1_14, 0), action, wrapper.get(Type.UNSIGNED_BYTE, 0)); - } - }); } }); protocol.registerServerbound(ServerboundPackets1_17.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/BlockAckStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/BlockAckStorage.java deleted file mode 100644 index ffa5a95d..00000000 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/BlockAckStorage.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards - * Copyright (C) 2016-2022 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage; - -import com.viaversion.viaversion.api.connection.StorableObject; -import com.viaversion.viaversion.api.minecraft.Position; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.LinkedList; -import java.util.Queue; - -public final class BlockAckStorage implements StorableObject { - - private final Queue actions = new LinkedList<>(); - - public void add(final Position position, final int action, final short direction) { - actions.add(new BlockAction(position, (byte) action, direction)); - - // Some actions may be left unacknowledged by modded servers - if (actions.size() > 100) { - actions.poll(); - } - } - - public @Nullable BlockAction poll() { - return actions.poll(); - } - - public static final class BlockAction { - private final Position position; - private final byte action; - private final short direction; - - public BlockAction(final Position position, final byte action, final short direction) { - this.position = position; - this.action = action; - this.direction = direction; - } - - public Position position() { - return position; - } - - public byte action() { - return action; - } - - public short direction() { - return direction; - } - } -} diff --git a/common/src/main/resources/assets/viabackwards/data/mapping-1.18to1.19.json b/common/src/main/resources/assets/viabackwards/data/mapping-1.18to1.19.json index c285c881..85c1aee9 100644 --- a/common/src/main/resources/assets/viabackwards/data/mapping-1.18to1.19.json +++ b/common/src/main/resources/assets/viabackwards/data/mapping-1.18to1.19.json @@ -161,6 +161,134 @@ "minecraft:reinforced_deepslate": { "id": "minecraft:obsidian", "name": "1.19 Reinforced Deepslate" + }, + "minecraft:mud": { + "id": "minecraft:coarse_dirt", + "name": "1.19 Mud" + }, + "minecraft:mangrove_planks": { + "id": "minecraft:acacia_planks", + "name": "1.19 Mangrove Planks" + }, + "minecraft:mangrove_propagule": { + "id": "minecraft:fern", + "name": "1.19 Mangrove Propagule" + }, + "minecraft:mangrove_log": { + "id": "minecraft:acacia_log", + "name": "1.19 Mangrove Log" + }, + "minecraft:mangrove_roots": { + "id": "minecraft:oak_wood", + "name": "1.19 Mangrove Roots" + }, + "minecraft:muddy_mangrove_roots": { + "id": "minecraft:coarse_dirt", + "name": "1.19 Muddy Mangrove Roots" + }, + "minecraft:stripped_mangrove_log": { + "id": "minecraft:stripped_acacia_log", + "name": "1.19 Stripped Mangrove Log" + }, + "minecraft:stripped_mangrove_wood": { + "id": "minecraft:stripped_acacia_wood", + "name": "1.19 Stripped Mangrove Wood" + }, + "minecraft:mangrove_wood": { + "id": "minecraft:acacia_wood", + "name": "1.19 Mangrove Wood" + }, + "minecraft:mangrove_leaves": { + "id": "minecraft:acacia_leaves", + "name": "1.19 Mangrove Leaves" + }, + "minecraft:mangrove_slab": { + "id": "minecraft:acacia_slab", + "name": "1.19 Mangrove Slab" + }, + "minecraft:mud_brick_slab": { + "id": "minecraft:brick_slab", + "name": "1.19 Mud Brick Slab" + }, + "minecraft:mangrove_fence": { + "id": "minecraft:acacia_fence", + "name": "1.19 Mangrove Fence" + }, + "minecraft:packed_mud": { + "id": "minecraft:bricks", + "name": "1.19 Packed Mud" + }, + "minecraft:mud_bricks": { + "id": "minecraft:bricks", + "name": "1.19 Mud Bricks" + }, + "minecraft:mud_brick_stairs": { + "id": "minecraft:brick_stairs", + "name": "1.19 Mud Brick Stairs" + }, + "minecraft:mud_brick_wall": { + "id": "minecraft:brick_wall", + "name": "1.19 Mud Brick Wall" + }, + "minecraft:mangrove_stairs": { + "id": "minecraft:acacia_stairs", + "name": "1.19 Mangrove Stairs" + }, + "minecraft:mangrove_button": { + "id": "minecraft:acacia_button", + "name": "1.19 Mangrove Button" + }, + "minecraft:mangrove_pressure_plate": { + "id": "minecraft:acacia_pressure_plate", + "name": "1.19 Mangrove Pressure Plate" + }, + "minecraft:mangrove_door": { + "id": "minecraft:acacia_door", + "name": "1.19 Mangrove Door" + }, + "minecraft:mangrove_trapdoor": { + "id": "minecraft:acacia_trapdoor", + "name": "1.19 Mangrove Trapdoor" + }, + "minecraft:mangrove_fence_gate": { + "id": "minecraft:acacia_fence_gate", + "name": "1.19 Mangrove Fence Gate" + }, + "minecraft:mangrove_boat": { + "id": "minecraft:acacia_boat", + "name": "1.19 Mangrove Boat" + }, + "minecraft:mangrove_sign": { + "id": "minecraft:acacia_sign", + "name": "1.19 Mangrove Sign" + }, + "minecraft:tadpole_bucket": { + "id": "minecraft:pufferfish_bucket", + "name": "1.19 Tadpole Bucket" + }, + "minecraft:frog_spawn_egg": { + "id": "minecraft:tropical_fish_spawn_egg", + "name": "1.19 Frog Spawn Egg" + }, + "minecraft:tadpole_spawn_egg": { + "id": "minecraft:donkey_spawn_egg", + "name": "1.19 Tadpole Spawn Egg" + }, + "minecraft:ochre_froglight": { + "id": "minecraft:sea_lantern", + "name": "1.19 Ochre Froglight" + }, + "minecraft:verdant_froglight": { + "id": "minecraft:sea_lantern", + "name": "1.19 Verdant Froglight" + }, + "minecraft:pearlescent_froglight": { + "id": "minecraft:sea_lantern", + "name": "1.19 Pearlescent Froglight" + }, + "minecraft:frogspawn": { + "id": "minecraft:glow_lichen", + "name": "1.19 Frogspawn" } }, "particles": {