GlowInkSacItem .java

net.minecraft.world.item.GlowInkSacItem (class, 25 lines): members: tryApplyToSign. imports: SignTextSlot, SignBlockEntity, SoundSource, SoundEvents.

net.minecraft.world.itemclass25 linescommonextends Item870 B

Implements

API Surface (1)

boolean tryApplyToSign(final Level level, final SignBlockEntity sign, final SignTextSlot slot, final ItemStack item, final Player player)

Full Source

GlowInkSacItem.java25 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item;
2
3
import net.minecraft.sounds.SoundEvents;
4
import net.minecraft.sounds.SoundSource;
5
import net.minecraft.world.entity.player.Player;
6
import net.minecraft.world.level.Level;
7
import net.minecraft.world.level.block.entity.SignBlockEntity;
8
import net.minecraft.world.level.block.entity.SignTextSlot;
9
10
public class GlowInkSacItem extends Item implements SignApplicator {
11
	public GlowInkSacItem(final Item.Properties properties) {
12
		super(properties);
13
	}
14
15
	@Override
16
	public boolean tryApplyToSign(final Level level, final SignBlockEntity sign, final SignTextSlot slot, final ItemStack item, final Player player) {
17
		if (sign.updateText(text -> text.withGlowingText(true), slot)) {
18
			level.playSound(null, sign.getBlockPos(), SoundEvents.GLOW_INK_SAC_USE, SoundSource.BLOCKS, 1.0F, 1.0F);
19
			return true;
20
		} else {
21
			return false;
22
		}
23
	}
24
}
25

Decompiled Minecraft 26.3 source of GlowInkSacItem (net/minecraft/world/item/GlowInkSacItem.java) with Mojang official mappings, stored verbatim on the site.