Fix die advancements

This commit is contained in:
Andrew-71 2023-10-23 21:20:57 +03:00
parent 113f5117b1
commit ac274ad9f4

View file

@ -2,13 +2,17 @@ package su.a71.new_soviet.items;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.FoodComponents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundCategory;
import net.minecraft.stat.Stats;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
@ -30,6 +34,7 @@ public class DiceItem extends Item {
}
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
user.setCurrentHand(hand); // This fixes advancements
ItemStack itemStack = user.getStackInHand(hand);
user.getItemCooldownManager().set(this, 20 * itemStack.getCount());
if (!world.isClient) {