mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-25 12:25:22 +01:00
Update sword blocking fix mixins
This commit is contained in:
parent
19f2264bd2
commit
4e9276fcd8
@ -23,9 +23,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
|||||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.SwordItem;
|
import net.minecraft.item.SwordItem;
|
||||||
import net.minecraft.item.consume.UseAction;
|
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -49,13 +47,4 @@ public abstract class MixinSwordItem extends Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UseAction getUseAction(ItemStack stack) {
|
|
||||||
if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) {
|
|
||||||
return UseAction.BLOCK;
|
|
||||||
} else {
|
|
||||||
return super.getUseAction(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||||
|
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||||
|
* Copyright (C) 2023-2024 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;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
|
import com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2;
|
||||||
|
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(value = BlockItemPacketRewriter1_21_2.class, remap = false)
|
||||||
|
public abstract class MixinBlockItemPacketRewriter1_21_2 {
|
||||||
|
|
||||||
|
@Redirect(method = "appendItemDataFixComponents", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;olderThanOrEqualTo(Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;)Z"))
|
||||||
|
private boolean changeSwordFixVersionRange(ProtocolVersion instance, ProtocolVersion other) {
|
||||||
|
if (other == ProtocolVersion.v1_8) {
|
||||||
|
return instance.betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8);
|
||||||
|
} else {
|
||||||
|
return instance.olderThanOrEqualTo(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -142,6 +142,7 @@
|
|||||||
"fixes.minecraft.item.MixinItemRenderer",
|
"fixes.minecraft.item.MixinItemRenderer",
|
||||||
"fixes.minecraft.item.MixinItemStack",
|
"fixes.minecraft.item.MixinItemStack",
|
||||||
"fixes.minecraft.item.MixinKnowledgeBookItem",
|
"fixes.minecraft.item.MixinKnowledgeBookItem",
|
||||||
|
"fixes.minecraft.item.MixinLeadItem",
|
||||||
"fixes.minecraft.item.MixinShovelItem",
|
"fixes.minecraft.item.MixinShovelItem",
|
||||||
"fixes.minecraft.item.MixinSwordItem",
|
"fixes.minecraft.item.MixinSwordItem",
|
||||||
"fixes.minecraft.network.MixinChatMessageC2SPacket",
|
"fixes.minecraft.network.MixinChatMessageC2SPacket",
|
||||||
@ -184,6 +185,7 @@
|
|||||||
"fixes.vialegacy.MixinProtocolc0_30cpeToc0_28_30",
|
"fixes.vialegacy.MixinProtocolc0_30cpeToc0_28_30",
|
||||||
"fixes.vialegacy.MixinProtocolr1_7_6_10Tor1_8",
|
"fixes.vialegacy.MixinProtocolr1_7_6_10Tor1_8",
|
||||||
"fixes.viaversion.MixinBlockItemPacketRewriter1_20_5",
|
"fixes.viaversion.MixinBlockItemPacketRewriter1_20_5",
|
||||||
|
"fixes.viaversion.MixinBlockItemPacketRewriter1_21_2",
|
||||||
"fixes.viaversion.MixinCommandBlockProvider",
|
"fixes.viaversion.MixinCommandBlockProvider",
|
||||||
"fixes.viaversion.MixinCommonBoss",
|
"fixes.viaversion.MixinCommonBoss",
|
||||||
"fixes.viaversion.MixinEntityPacketRewriter1_12",
|
"fixes.viaversion.MixinEntityPacketRewriter1_12",
|
||||||
@ -212,8 +214,7 @@
|
|||||||
"fixes.viaversion.MixinWorldPacketRewriter1_19",
|
"fixes.viaversion.MixinWorldPacketRewriter1_19",
|
||||||
"viabedrock.MixinJoinPackets",
|
"viabedrock.MixinJoinPackets",
|
||||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||||
"vialegacy.MixinViaLegacyConfig",
|
"vialegacy.MixinViaLegacyConfig"
|
||||||
"fixes.minecraft.item.MixinLeadItem"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
Loading…
Reference in New Issue
Block a user