diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinSkullHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinSkullHandler.java new file mode 100644 index 00000000..ea77d3da --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_13to1_12_2/MixinSkullHandler.java @@ -0,0 +1,34 @@ +/* + * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus + * Copyright (C) 2021-2023 FlorianMichael/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 . + */ +package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_13to1_12_2; + +import com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag; +import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.blockentities.SkullHandler; +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.CallbackInfoReturnable; + +@Mixin(value = SkullHandler.class, remap = false) +public class MixinSkullHandler { + + @Inject(method = "getLong", at = @At("HEAD"), cancellable = true) + public void checkIfTagExists(NumberTag tag, CallbackInfoReturnable cir) { + if (tag == null) cir.setReturnValue(0L); + } +} diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index cb6a8b51..9571ebb5 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -150,7 +150,8 @@ "fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread", "jsonwebtoken.MixinClasses", "jsonwebtoken.MixinDefaultCompressionCodecResolver", - "jsonwebtoken.MixinDefaultJwtParserBuilder" + "jsonwebtoken.MixinDefaultJwtParserBuilder", + "fixes.viaversion.protocol1_13to1_12_2.MixinSkullHandler" ], "injectors": { "defaultRequire": 1