3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Actually everything from 22w11a

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-03-16 23:06:58 +01:00
Ursprung 15a5e6f710
Commit d56921b611
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
4 geänderte Dateien mit 130 neuen und 95 gelöschten Zeilen

Datei anzeigen

@ -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.data.BackwardsMappings;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.BlockItemPackets1_19; 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.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.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types; import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
@ -124,7 +123,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
@Override @Override
public void init(final UserConnection user) { public void init(final UserConnection user) {
user.put(new BlockAckStorage());
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER)); addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
} }

Datei anzeigen

@ -19,7 +19,6 @@ package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets;
import com.viaversion.viabackwards.api.rewriters.ItemRewriter; import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19; import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.BlockAckStorage;
import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
@ -31,7 +30,6 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
@ -93,23 +91,8 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
protocol.registerClientbound(ClientboundPackets1_19.BLOCK_CHANGED_ACK, null, new PacketRemapper() { protocol.registerClientbound(ClientboundPackets1_19.BLOCK_CHANGED_ACK, null, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { read(Type.VAR_INT); // Sequence
wrapper.read(Type.VAR_INT); // Sequence handler(PacketWrapper::cancel); // This is fine:tm:
// 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();
});
} }
}); });
@ -176,13 +159,6 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
map(Type.POSITION1_14); // Block position map(Type.POSITION1_14); // Block position
map(Type.UNSIGNED_BYTE); // Direction map(Type.UNSIGNED_BYTE); // Direction
create(Type.VAR_INT, 0); // Sequence create(Type.VAR_INT, 0); // Sequence
handler(wrapper -> {
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() { protocol.registerServerbound(ServerboundPackets1_17.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {

Datei anzeigen

@ -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 <http://www.gnu.org/licenses/>.
*/
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<BlockAction> 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;
}
}
}

Datei anzeigen

@ -161,6 +161,134 @@
"minecraft:reinforced_deepslate": { "minecraft:reinforced_deepslate": {
"id": "minecraft:obsidian", "id": "minecraft:obsidian",
"name": "1.19 Reinforced Deepslate" "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": { "particles": {