mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-29 13:06:00 +01:00
Revert equipment/creative condition in <= 1.20.1
This commit is contained in:
parent
f8f3975600
commit
c518eccfd5
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Equipment;
|
||||||
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(Equipment.class)
|
||||||
|
public interface MixinEquipment {
|
||||||
|
|
||||||
|
@Redirect(method = "equipAndSwap", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isCreative()Z"))
|
||||||
|
default boolean removeCreativeCondition(PlayerEntity instance) {
|
||||||
|
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_20tor1_20_1)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return instance.isCreative();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user