mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
updated Via*, removed outdated fixes
added classic protocol extensions to debug hud
This commit is contained in:
parent
45500b23c0
commit
debc4bb864
@ -16,7 +16,7 @@ archives_base_name=viafabricplus
|
||||
vialoadingbase_version=9d1d77d16e
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.6.0-1.19.4-pre3-SNAPSHOT
|
||||
viaversion_version=4.6.0-1.19.4-rc1-SNAPSHOT
|
||||
viabackwards_version=4.6.0-1.19.4-pre3-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
||||
|
@ -25,8 +25,8 @@ import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.hud.DebugHud;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.EntityTracker;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -36,7 +36,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(DebugHud.class)
|
||||
public class MixinDebugHud {
|
||||
@ -72,6 +71,12 @@ public class MixinDebugHud {
|
||||
if (seedStorage != null) {
|
||||
information.add("World Seed (" + LegacyProtocolVersion.r1_1.getName() + "): " + seedStorage.seed);
|
||||
}
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isEqualTo(LegacyProtocolVersion.c0_30cpe)) {
|
||||
final ExtensionProtocolMetadataStorage extensionProtocolMetadataStorage = userConnection.get(ExtensionProtocolMetadataStorage.class);
|
||||
if (extensionProtocolMetadataStorage != null) {
|
||||
information.add("Classic extensions (" + LegacyProtocolVersion.c0_30cpe.getName() + "): " + extensionProtocolMetadataStorage.getExtensionCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) 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 de.florianmichael.viafabricplus.injection.mixin.fixes.vialegacy;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ClientboundPacketsb1_8;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ServerboundPacketsb1_8;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ClientboundPacketsb1_7;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.Protocolb1_8_0_1tob1_7_0_3;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.ServerboundPacketsb1_7;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value = Protocolb1_8_0_1tob1_7_0_3.class, remap = false)
|
||||
public class MixinProtocolb1_8_0_1tob1_7_0_3 extends AbstractProtocol<ClientboundPacketsb1_7, ClientboundPacketsb1_8, ServerboundPacketsb1_7, ServerboundPacketsb1_8> {
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
public void betterKeepAliveHandling(CallbackInfo ci) {
|
||||
this.registerServerbound(ServerboundPacketsb1_8.KEEP_ALIVE, ServerboundPacketsb1_7.KEEP_ALIVE, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
handler(wrapper -> {
|
||||
if (!(MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen)) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ public abstract class MixinProtocolVersion {
|
||||
protocolhack_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
|
||||
protocolhack_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
|
||||
protocolhack_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
|
||||
protocolhack_remaps.put("1.19.4", new Pair<>("1.19.4-pre3", null));
|
||||
protocolhack_remaps.put("1.19.4", new Pair<>("1.19.4-rc1", null));
|
||||
}
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) 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 de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_13to1_12_2;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockFace;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider;
|
||||
import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(value = ConnectionData.class, remap = false)
|
||||
public class MixinConnectionData {
|
||||
|
||||
@Shadow private static Int2ObjectMap<ConnectionHandler> connectionHandlerMap;
|
||||
|
||||
@Shadow public static BlockConnectionProvider blockConnectionProvider;
|
||||
|
||||
/**
|
||||
* @author FlorianMichael
|
||||
* @reason prevent block spam
|
||||
*/
|
||||
@Overwrite
|
||||
public static void update(UserConnection user, Position position) {
|
||||
for (BlockFace face : BlockFace.values()) {
|
||||
Position pos = position.getRelative(face);
|
||||
int blockState = blockConnectionProvider.getBlockData(user, pos.x(), pos.y(), pos.z());
|
||||
ConnectionHandler handler = connectionHandlerMap.get(blockState);
|
||||
if (handler == null) continue;
|
||||
|
||||
final int newBlockState = handler.connect(user, pos, blockState);
|
||||
if (DebugSettings.getClassWrapper().cancelEqualBlockChangeUpdates.getValue()) {
|
||||
if (blockState == newBlockState) continue;
|
||||
}
|
||||
PacketWrapper blockUpdatePacket = PacketWrapper.create(ClientboundPackets1_13.BLOCK_CHANGE, null, user);
|
||||
blockUpdatePacket.write(Type.POSITION, pos);
|
||||
blockUpdatePacket.write(Type.VAR_INT, newBlockState);
|
||||
try {
|
||||
blockUpdatePacket.send(Protocol1_13To1_12_2.class);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) 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 de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_13to1_12_2;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler;
|
||||
import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// Copyright RaphiMC/RK_01 - LICENSE file
|
||||
@Mixin(value = ConnectionData.NeighbourUpdater.class, remap = false)
|
||||
public class MixinConnectionData_NeighbourUpdater {
|
||||
|
||||
@Inject(method = "updateBlock", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void preventBlockSpam(int x, int y, int z, List<BlockChangeRecord1_8> records, CallbackInfo ci, int blockState, ConnectionHandler handler, Position position, int newBlockState) {
|
||||
if (!DebugSettings.getClassWrapper().cancelEqualBlockChangeUpdates.getValue()) return;
|
||||
if (blockState == newBlockState) ci.cancel();
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ public class DebugSettings extends SettingGroup {
|
||||
// 1.13 -> 1.12.2
|
||||
public final ProtocolSyncBooleanSetting executeInputsInSync = new ProtocolSyncBooleanSetting(this, "Execute inputs in sync", ProtocolRange.andOlder(ProtocolVersion.v1_12_2));
|
||||
public final ProtocolSyncBooleanSetting sneakInstant = new ProtocolSyncBooleanSetting(this, "Sneak instant", new ProtocolRange(ProtocolVersion.v1_12_2, ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting cancelEqualBlockChangeUpdates = new ProtocolSyncBooleanSetting(this, "Cancel equal block change updates", ProtocolRange.andOlder(ProtocolVersion.v1_12_2));
|
||||
|
||||
// 1.12 -> 1.11.1-1.11.2
|
||||
public final ProtocolSyncBooleanSetting sendOpenInventoryPacket = new ProtocolSyncBooleanSetting(this, "Send open inventory packet", ProtocolRange.andOlder(ProtocolVersion.v1_11_1));
|
||||
|
@ -3,7 +3,7 @@
|
||||
"minVersion": "0.8",
|
||||
"package": "de.florianmichael.viafabricplus.injection.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"client": [
|
||||
"base.MixinClientConnection",
|
||||
"base.MixinClientConnection_1",
|
||||
"base.MixinClientLoginNetworkHandler",
|
||||
@ -101,7 +101,6 @@
|
||||
"fixes.vialegacy.MixinClientboundPacketsc0_30cpe",
|
||||
"fixes.vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
|
||||
"fixes.vialegacy.MixinProtocolb1_8_0_1tob1_7_0_3",
|
||||
"fixes.vialegacy.MixinProtocolc0_30toc0_30cpe",
|
||||
"fixes.vialoadingbase.MixinVLBViaConfig",
|
||||
"fixes.viaversion.MixinCommonBoss",
|
||||
@ -109,8 +108,6 @@
|
||||
"fixes.viaversion.protocol1_11to1_10.MixinProtocol1_11To1_10",
|
||||
"fixes.viaversion.protocol1_12to1_11_1.MixinChatItemRewriter",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinAbstractFenceConnectionHandler",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinConnectionData",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinConnectionData_NeighbourUpdater",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinGlassConnectionHandler",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinWorldPackets1_13",
|
||||
"fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets_2",
|
||||
@ -130,12 +127,7 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMetadataRewriter1_9To1_8",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMovementTracker",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"client": [
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"bridge.MixinConnectScreen",
|
||||
"bridge.MixinDownloadingTerrainScreen",
|
||||
"bridge.MixinOptionsScreen",
|
||||
@ -147,5 +139,8 @@
|
||||
"fixes.screen.MixinCreativeInventoryScreen",
|
||||
"fixes.screen.MixinJigsawBlockScreen",
|
||||
"fixes.screen.hud.MixinChatHud"
|
||||
]
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user