Updated Via*

This commit is contained in:
RaphiMC 2023-03-09 18:25:32 +01:00
parent 0cb63c3e24
commit 3edef445f1
4 changed files with 3 additions and 90 deletions

View file

@ -59,8 +59,8 @@ repositories {
dependencies { dependencies {
compileOnly sourceSets.java17compat.output compileOnly sourceSets.java17compat.output
include "com.viaversion:viaversion:4.6.0-1.19.4-pre3-SNAPSHOT" include "com.viaversion:viaversion:4.6.0-1.19.4-rc1-SNAPSHOT"
include("com.viaversion:viabackwards-common:4.6.0-1.19.4-pre3-SNAPSHOT") { include("com.viaversion:viabackwards-common:4.6.0-1.19.4-pre4-SNAPSHOT") {
exclude group: "com.viaversion", module: "viaversion" exclude group: "com.viaversion", module: "viaversion"
exclude group: "io.netty", module: "netty-all" exclude group: "io.netty", module: "netty-all"
exclude group: "com.google.guava", module: "guava" exclude group: "com.google.guava", module: "guava"

View file

@ -45,13 +45,12 @@ public abstract class MixinProtocolVersion {
private static void initMaps(CallbackInfo ci) { private static void initMaps(CallbackInfo ci) {
skips = ImmutableSet.of("1.4.6/7", "1.5.1", "1.5.2", "1.6.1", "1.6.2", "1.6.3", "1.6.4"); skips = ImmutableSet.of("1.4.6/7", "1.5.1", "1.5.2", "1.6.1", "1.6.2", "1.6.3", "1.6.4");
remaps = new HashMap<>(); remaps = new HashMap<>();
remaps.put("1.7-1.7.5", new Pair<>("1.7.2-1.7.5", new VersionRange("1.7", 2, 5)));
remaps.put("1.9.3/4", new Pair<>("1.9.3-1.9.4", null)); remaps.put("1.9.3/4", new Pair<>("1.9.3-1.9.4", null));
remaps.put("1.11.1/2", new Pair<>("1.11.1-1.11.2", null)); remaps.put("1.11.1/2", new Pair<>("1.11.1-1.11.2", null));
remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null)); remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null)); remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null)); remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
remaps.put("1.19.4", new Pair<>("1.19.4-pre3", null)); 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;")) @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;"))

View file

@ -1,51 +0,0 @@
/*
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
* Copyright (C) 2023 RK_01/RaphiMC 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 net.raphimc.viaproxy.injection.transformer;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
import net.lenni0451.classtransform.annotations.CTransformer;
import net.lenni0451.classtransform.annotations.injection.CASM;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.*;
@CTransformer(ConnectionData.class)
public abstract class ConnectionDataTransformer {
@CASM("update")
public static void preventBlockChangeSpam(MethodNode method) {
LabelNode continueLabel = new LabelNode();
InsnList checkCode = new InsnList();
checkCode.add(new VarInsnNode(Opcodes.ILOAD, 7));
checkCode.add(new VarInsnNode(Opcodes.ILOAD, 9));
checkCode.add(new JumpInsnNode(Opcodes.IF_ICMPEQ, continueLabel));
for (AbstractInsnNode insn : method.instructions.toArray()) {
if (checkCode != null && insn.getOpcode() == Opcodes.ISTORE) {
VarInsnNode varInsn = (VarInsnNode) insn;
if (varInsn.var == 9) {
method.instructions.insert(insn, checkCode);
checkCode = null;
}
} else if (continueLabel != null && insn.getOpcode() == Opcodes.IINC) {
method.instructions.insertBefore(insn, continueLabel);
continueLabel = null;
}
}
}
}

View file

@ -1,35 +0,0 @@
/*
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
* Copyright (C) 2023 RK_01/RaphiMC 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 net.raphimc.viaproxy.injection.transformer;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
import net.lenni0451.classtransform.InjectionCallback;
import net.lenni0451.classtransform.annotations.CLocalVariable;
import net.lenni0451.classtransform.annotations.CTarget;
import net.lenni0451.classtransform.annotations.CTransformer;
import net.lenni0451.classtransform.annotations.injection.CInject;
@CTransformer(ConnectionData.NeighbourUpdater.class)
public class ConnectionData_NeighbourUpdaterTransformer {
@CInject(method = "updateBlock", target = @CTarget(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", shift = CTarget.Shift.BEFORE), cancellable = true)
public void preventBlockChangeSpam(InjectionCallback ic, @CLocalVariable(name = "blockState") int blockState, @CLocalVariable(name = "newBlockState") int newBlockState) {
if (blockState == newBlockState) ic.setCancelled(true);
}
}