1.18.2-pre3

This commit is contained in:
Nassim Jahnke 2022-02-23 18:12:15 +01:00
parent afe3584b70
commit 6a1b0e044a
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 52 additions and 3 deletions

View File

@ -5,7 +5,7 @@ plugins {
allprojects {
group = "com.viaversion"
version = "4.2.0-1.18.2-pre1-SNAPSHOT"
version = "4.2.0-1.18.2-pre3-SNAPSHOT"
description = "Allow older clients to join newer server versions."
}

View File

@ -19,6 +19,7 @@ package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.protocol.protocol1_18to1_18_2.data.CommandRewriter1_18_2;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
@ -38,6 +39,8 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
@Override
protected void registerPackets() {
new CommandRewriter1_18_2(this).registerDeclareCommands(ClientboundPackets1_18.DECLARE_COMMANDS);
final PacketHandler entityEffectIdHandler = wrapper -> {
final int id = wrapper.read(Type.VAR_INT);
if ((byte) id != id) {
@ -78,8 +81,6 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
map(Type.NBT); // Current dimension data
handler(wrapper -> {
final CompoundTag registry = wrapper.get(Type.NBT, 0);
registry.remove("minecraft:worldgen/configured_feature");
final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type");
final ListTag dimensions = dimensionsHolder.get("value");
for (final Tag dimension : dimensions) {

View File

@ -0,0 +1,48 @@
/*
* 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_18to1_18_2.data;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.rewriter.CommandRewriter;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class CommandRewriter1_18_2 extends CommandRewriter {
public CommandRewriter1_18_2(Protocol protocol) {
super(protocol);
// Uncompletable without the full list
this.parserHandlers.put("minecraft:resource", wrapper -> {
wrapper.read(Type.STRING);
wrapper.write(Type.VAR_INT, 1); // Quotable string
});
this.parserHandlers.put("minecraft:resource_or_tag", wrapper -> {
wrapper.read(Type.STRING);
wrapper.write(Type.VAR_INT, 1); // Quotable string
});
}
@Override
protected @Nullable String handleArgumentType(String argumentType) {
if (argumentType.equals("minecraft:resource") || argumentType.equals("minecraft:resource_or_tag")) {
return "brigadier:string";
}
return super.handleArgumentType(argumentType);
}
}