Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2025-01-11 23:51:04 +01:00
1.18.2-pre3
Dieser Commit ist enthalten in:
Ursprung
afe3584b70
Commit
6a1b0e044a
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
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."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2;
|
|||||||
|
|
||||||
import com.viaversion.viabackwards.ViaBackwards;
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
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.Via;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
@ -38,6 +39,8 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
|
new CommandRewriter1_18_2(this).registerDeclareCommands(ClientboundPackets1_18.DECLARE_COMMANDS);
|
||||||
|
|
||||||
final PacketHandler entityEffectIdHandler = wrapper -> {
|
final PacketHandler entityEffectIdHandler = wrapper -> {
|
||||||
final int id = wrapper.read(Type.VAR_INT);
|
final int id = wrapper.read(Type.VAR_INT);
|
||||||
if ((byte) id != id) {
|
if ((byte) id != id) {
|
||||||
@ -78,8 +81,6 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
|
|||||||
map(Type.NBT); // Current dimension data
|
map(Type.NBT); // Current dimension data
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||||
registry.remove("minecraft:worldgen/configured_feature");
|
|
||||||
|
|
||||||
final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type");
|
final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type");
|
||||||
final ListTag dimensions = dimensionsHolder.get("value");
|
final ListTag dimensions = dimensionsHolder.get("value");
|
||||||
for (final Tag dimension : dimensions) {
|
for (final Tag dimension : dimensions) {
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren