Fix die advancements
This commit is contained in:
parent
113f5117b1
commit
ac274ad9f4
1 changed files with 5 additions and 0 deletions
|
@ -2,13 +2,17 @@ package su.a71.new_soviet.items;
|
||||||
|
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.FoodComponents;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.stat.Stats;
|
import net.minecraft.stat.Stats;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
import net.minecraft.util.UseAction;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -30,6 +34,7 @@ public class DiceItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||||
|
user.setCurrentHand(hand); // This fixes advancements
|
||||||
ItemStack itemStack = user.getStackInHand(hand);
|
ItemStack itemStack = user.getStackInHand(hand);
|
||||||
user.getItemCooldownManager().set(this, 20 * itemStack.getCount());
|
user.getItemCooldownManager().set(this, 20 * itemStack.getCount());
|
||||||
if (!world.isClient) {
|
if (!world.isClient) {
|
||||||
|
|
Loading…
Reference in a new issue