-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always allow eating heating/cooling consumables
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
common/src/generated/resources/.cache/9dc2e1bbb6dbc88d629e62ed955e4c156b6652a3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/******************************************************************************* | ||
* Copyright 2023, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package toughasnails.mixin; | ||
|
||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import toughasnails.init.ModTags; | ||
|
||
@Mixin(Item.class) | ||
public class MixinItem | ||
{ | ||
@Redirect(method="use", at=@At(value = "INVOKE", target="Lnet/minecraft/world/entity/player/Player;canEat(Z)Z")) | ||
public boolean onUse(Player player, boolean canAlwaysEat, Level level, Player player2, InteractionHand hand) | ||
{ | ||
ItemStack stack = player.getItemInHand(hand); | ||
return stack.is(ModTags.Items.HEATING_CONSUMED_ITEMS) || stack.is(ModTags.Items.COOLING_CONSUMED_ITEMS) || player.canEat(canAlwaysEat); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters