Fixed Crossbow damage offset in 1.18 -> 1.17.1

This commit is contained in:
FlorianMichael 2023-11-11 16:25:33 +01:00
parent b9cecbfbf3
commit 4f5ce22d0c
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 62 additions and 18 deletions

View File

@ -0,0 +1,43 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.item.CrossbowItem;
import net.minecraft.item.Item;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(Item.class)
public class MixinItem {
@Shadow @Final private int maxDamage;
@Redirect(method = { "getMaxDamage", "isDamageable", "getItemBarStep", "getItemBarColor" }, at = @At(value = "FIELD", target = "Lnet/minecraft/item/Item;maxDamage:I"))
public int changeCrossbowDamage(Item instance) {
if (instance instanceof CrossbowItem && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1)) {
return 326;
}
return maxDamage;
}
}

View File

@ -147,32 +147,33 @@
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
"fixes.vialegacy.MixinProtocolc0_30toc0_30cpe",
"fixes.vialegacy.MixinViaLegacyConfig",
"fixes.viaversion.MixinCommonBoss",
"fixes.viaversion.MixinNamedCompoundTagType",
"viaversion.MixinProtocolVersion",
"fixes.viaversion.MixinEntityIdRewriter",
"fixes.viaversion.MixinProtocol1_11To1_10",
"fixes.viaversion.MixinChatItemRewriter",
"viaversion.MixinAbstractFenceConnectionHandler",
"viaversion.MixinGlassConnectionHandler",
"fixes.viaversion.MixinSkullHandler",
"fixes.viaversion.MixinWorldPackets1_13",
"fixes.viaversion.MixinInventoryPackets",
"fixes.viaversion.MixinMetadataRewriter1_15To1_14_4",
"fixes.viaversion.MixinWorldPackets1_16_2",
"fixes.viaversion.MixinEntityPackets1_17",
"fixes.viaversion.MixinInventoryAcknowledgements",
"fixes.viaversion.MixinWorldPackets1_17",
"fixes.viaversion.MixinWorldPackets1_19",
"fixes.viaversion.MixinChunkType1_8",
"fixes.viaversion.MixinCommandBlockProvider",
"fixes.viaversion.MixinCommonBoss",
"fixes.viaversion.MixinEntityIdRewriter",
"fixes.viaversion.MixinEntityPackets1_17",
"fixes.viaversion.MixinEntityPackets_6_1",
"fixes.viaversion.MixinEntityTracker1_9",
"fixes.viaversion.MixinInventoryAcknowledgements",
"fixes.viaversion.MixinInventoryPackets",
"fixes.viaversion.MixinMetadataRewriter1_15To1_14_4",
"fixes.viaversion.MixinMetadataRewriter1_9To1_8",
"fixes.viaversion.MixinNamedCompoundTagType",
"fixes.viaversion.MixinProtocol1_11To1_10",
"fixes.viaversion.MixinProtocol1_12To1_11_1_3",
"fixes.viaversion.MixinSkullHandler",
"fixes.viaversion.MixinWorldPackets1_13",
"fixes.viaversion.MixinWorldPackets1_16_2",
"fixes.viaversion.MixinWorldPackets1_17",
"fixes.viaversion.MixinWorldPackets1_19",
"jsonwebtoken.MixinClasses",
"jsonwebtoken.MixinDefaultJwtParserBuilder",
"fixes.viaversion.MixinProtocol1_12To1_11_1_3",
"viaversion.MixinProtocol1_13To1_12_2"
"viaversion.MixinAbstractFenceConnectionHandler",
"viaversion.MixinGlassConnectionHandler",
"viaversion.MixinProtocol1_13To1_12_2",
"viaversion.MixinProtocolVersion",
"fixes.minecraft.item.MixinItem"
],
"injectors": {
"defaultRequire": 1