minecraft-source/src/net/minecraft/world/item/TippedArrowItem.java

46 lines
1.5 KiB
Java

package net.minecraft.world.item;
import net.minecraft.network.chat.Component;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.world.level.Level;
import java.util.Iterator;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.core.Registry;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
public class TippedArrowItem extends ArrowItem {
public TippedArrowItem(final Properties a) {
super(a);
}
@Override
public ItemStack getDefaultInstance() {
return PotionUtils.setPotion(super.getDefaultInstance(), Potions.POISON);
}
@Override
public void fillItemCategory(final CreativeModeTab bda, final NonNullList<ItemStack> fy) {
if (this.allowdedIn(bda)) {
for (final Potion bga5 : Registry.POTION) {
if (!bga5.getEffects().isEmpty()) {
fy.add(PotionUtils.setPotion(new ItemStack(this), bga5));
}
}
}
}
@Override
public void appendHoverText(final ItemStack bek, @Nullable final Level bjt, final List<Component> list, final TooltipFlag bft) {
PotionUtils.addPotionTooltip(bek, list, 0.125f);
}
@Override
public String getDescriptionId(final ItemStack bek) {
return PotionUtils.getPotion(bek).getName(this.getDescriptionId() + ".effect.");
}
}