You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
754 B
Java

package net.fabricmc.example;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
public class TutorialBook extends Item {
public TutorialBook(Settings settings) {
super(settings);
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
playerEntity.playSound(SoundEvents.ENTITY_PLAYER_HURT, 1.0F, 1.0F);
return new TypedActionResult<>(ActionResult.SUCCESS, playerEntity.getStackInHand(hand));
}
}