mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-28 12:56:51 +01:00
Fixup knowledge book interactions in <= 1.20.6
This commit is contained in:
parent
dc189976a4
commit
d2b765c60d
@ -42,17 +42,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
*
|
||||
* TODO | Port 1.21
|
||||
* - ClientPlayerEntity#tickMovement nether portal logic has new screen conditions and changed
|
||||
* - Entity#interact now handles leashables interface which was previously handled in MobEntity
|
||||
* - shouldCancelInteraction condition in ChestBoatEntity#interact is new
|
||||
* - HangingEntity/ItemFrame/Painting bounding box calculation changed
|
||||
* - PlayerEntity#attack got refactored (?)
|
||||
* - LivingEntity#takeKnockback with 1.0E-5F for loop is new
|
||||
* - KnowledgeBookItem#use decrementUnlessCreative is new
|
||||
* - JukeboxBlock#onUse override is new (added state.get(HAS_RECORD) condition)
|
||||
* - BoatEntity#updateVelocity isSpaceEmpty condition new
|
||||
* - LivingEntity#remove -> added activeEffects.clear call
|
||||
* - PlayerEntity#tickMovement getSaturationLevel/setSaturationLevel handling is new
|
||||
* - Check WorldBorder bounds check
|
||||
*
|
||||
* TODO | General
|
||||
* - Make recipe fixes dynamic instead of a data dump in java classes
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.minecraft.item;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.KnowledgeBookItem;
|
||||
import net.minecraft.util.Hand;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(KnowledgeBookItem.class)
|
||||
public abstract class MixinKnowledgeBookItem {
|
||||
|
||||
@Redirect(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;decrementUnlessCreative(ILnet/minecraft/entity/LivingEntity;)V"))
|
||||
private void removeFullStack(ItemStack instance, int amount, LivingEntity entity, @Local(argsOnly = true) Hand hand) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
if (!entity.isInCreativeMode()) {
|
||||
entity.setStackInHand(hand, ItemStack.EMPTY);
|
||||
}
|
||||
} else {
|
||||
instance.decrementUnlessCreative(amount, entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -205,7 +205,8 @@
|
||||
"fixes.viaversion.MixinWorldPacketRewriter1_19",
|
||||
"viabedrock.MixinJoinPackets",
|
||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"vialegacy.MixinViaLegacyConfig"
|
||||
"vialegacy.MixinViaLegacyConfig",
|
||||
"fixes.minecraft.item.MixinKnowledgeBookItem"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user