mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
Use Local annotation in mixins instead of capture locals
This commit is contained in:
parent
98e9d9b2c1
commit
b0c8e96cc0
@ -19,6 +19,7 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base.perserverversion;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.save.impl.SettingsSave;
|
||||
@ -48,15 +49,15 @@ public abstract class MixinServerInfo implements IServerInfo {
|
||||
@Unique
|
||||
private ProtocolVersion viaFabricPlus$translatingVersion;
|
||||
|
||||
@Inject(method = "toNbt", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void saveForcedVersion(CallbackInfoReturnable<NbtCompound> cir, NbtCompound nbtCompound) {
|
||||
@Inject(method = "toNbt", at = @At("TAIL"))
|
||||
private void saveForcedVersion(CallbackInfoReturnable<NbtCompound> cir, @Local NbtCompound nbtCompound) {
|
||||
if (viaFabricPlus$forcedVersion != null) {
|
||||
nbtCompound.putString("viafabricplus_forcedversion", viaFabricPlus$forcedVersion.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "fromNbt", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private static void loadForcedVersion(NbtCompound root, CallbackInfoReturnable<ServerInfo> cir, ServerInfo serverInfo) {
|
||||
@Inject(method = "fromNbt", at = @At("TAIL"))
|
||||
private static void loadForcedVersion(NbtCompound root, CallbackInfoReturnable<ServerInfo> cir, @Local ServerInfo serverInfo) {
|
||||
if (root.contains("viafabricplus_forcedversion")) {
|
||||
final ProtocolVersion version = SettingsSave.protocolVersionByName(root.getString("viafabricplus_forcedversion"));
|
||||
if (version != null) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.versioned.visual.BoatRenderer1_8;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
@ -42,8 +43,8 @@ public abstract class MixinEntityRenderDispatcher {
|
||||
@Unique
|
||||
private BoatRenderer1_8 viaFabricPlus$boatRenderer;
|
||||
|
||||
@Inject(method = "reload", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void createBoatRenderer1_8(ResourceManager manager, CallbackInfo ci, EntityRendererFactory.Context context) {
|
||||
@Inject(method = "reload", at = @At("TAIL"))
|
||||
private void createBoatRenderer1_8(ResourceManager manager, CallbackInfo ci, @Local EntityRendererFactory.Context context) {
|
||||
viaFabricPlus$boatRenderer = new BoatRenderer1_8(context);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
@ -59,8 +60,8 @@ public abstract class MixinItemPacketRewriter1_14 extends ItemRewriter<Clientbou
|
||||
this.protocol.registerServerbound(ServerboundPackets1_14.SELECT_TRADE, ServerboundPackets1_13.SELECT_TRADE, null, true);
|
||||
}
|
||||
|
||||
@Inject(method = "lambda$registerPackets$0", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/util/ProtocolLogger;warning(Ljava/lang/String;)V", remap = false), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
|
||||
private void supportLargeContainers(PacketWrapper wrapper, CallbackInfo ci, Short windowId, String type, JsonElement title, Short slots) {
|
||||
@Inject(method = "lambda$registerPackets$0", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/util/ProtocolLogger;warning(Ljava/lang/String;)V", remap = false), cancellable = true)
|
||||
private void supportLargeContainers(PacketWrapper wrapper, CallbackInfo ci, @Local(ordinal = 0) Short windowId, @Local String type, @Local JsonElement title, @Local(ordinal = 1) Short slots) {
|
||||
if ((type.equals("minecraft:container") || type.equals("minecraft:chest")) && (slots > 54 || slots <= 0)) {
|
||||
ci.cancel();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user