添加部分物品的文本描述
This commit is contained in:
parent
d6495e5b7d
commit
58198e1c3e
9 changed files with 42 additions and 1 deletions
|
@ -95,7 +95,7 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> RIFLE_AMMO_BOX = AMMO.register("rifle_ammo_box", RifleAmmoBox::new);
|
||||
public static final RegistryObject<Item> SNIPER_AMMO_BOX = AMMO.register("sniper_ammo_box", SniperAmmoBox::new);
|
||||
public static final RegistryObject<Item> SHOTGUN_AMMO_BOX = AMMO.register("shotgun_ammo_box", ShotgunAmmoBox::new);
|
||||
public static final RegistryObject<Item> CREATIVE_AMMO_BOX = AMMO.register("creative_ammo_box", () -> new Item(new Item.Properties().rarity(Rarity.EPIC).stacksTo(1)));
|
||||
public static final RegistryObject<Item> CREATIVE_AMMO_BOX = AMMO.register("creative_ammo_box", CreativeAmmoBox::new);
|
||||
public static final RegistryObject<Item> AMMO_BOX = AMMO.register("ammo_box", AmmoBox::new);
|
||||
public static final RegistryObject<Item> TASER_ELECTRODE = AMMO.register("taser_electrode", () -> new Item(new Item.Properties()));
|
||||
public static final RegistryObject<Item> GRENADE_40MM = AMMO.register("grenade_40mm", () -> new Item(new Item.Properties()));
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.init.ModItems;
|
|||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
@ -11,8 +12,11 @@ import net.minecraft.world.InteractionResultHolder;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AmmoSupplierItem extends Item {
|
||||
|
||||
public final AmmoType type;
|
||||
|
@ -24,6 +28,11 @@ public class AmmoSupplierItem extends Item {
|
|||
this.ammoToAdd = ammoToAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
list.add(Component.translatable("des.superbwarfare.ammo_supplier").withStyle(ChatFormatting.AQUA));
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.item.common.ammo;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreativeAmmoBox extends Item {
|
||||
|
||||
public CreativeAmmoBox() {
|
||||
super(new Item.Properties().rarity(Rarity.EPIC).stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltipComponents, TooltipFlag pIsAdvanced) {
|
||||
pTooltipComponents.add(Component.translatable("des.superbwarfare.creative_ammo_box").withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ public class HandgunAmmoBox extends AmmoSupplierItem {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
super.appendHoverText(itemstack, world, list, flag);
|
||||
list.add(Component.translatable("des.superbwarfare.handgun_ammo_box").withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class RifleAmmoBox extends AmmoSupplierItem {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
super.appendHoverText(itemstack, world, list, flag);
|
||||
list.add(Component.translatable("des.superbwarfare.rifle_ammo_box").withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class ShotgunAmmoBox extends AmmoSupplierItem {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
super.appendHoverText(itemstack, world, list, flag);
|
||||
list.add(Component.translatable("des.superbwarfare.shotgun_ammo_box").withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class SniperAmmoBox extends AmmoSupplierItem {
|
|||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
|
||||
super.appendHoverText(itemstack, world, list, flag);
|
||||
list.add(Component.translatable("des.superbwarfare.sniper_ammo_box").withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,9 @@
|
|||
"item.superbwarfare.handgun_ammo_box": "Handgun Ammo Box",
|
||||
"des.superbwarfare.handgun_ammo_box": "Handgun Ammo *30",
|
||||
"item.superbwarfare.heavy_ammo": "Heavy Ammo",
|
||||
"des.superbwarfare.ammo_supplier": "Right Click to Supply Ammo",
|
||||
"item.superbwarfare.creative_ammo_box": "Creative Ammo Box",
|
||||
"des.superbwarfare.creative_ammo_box": "Provide infinite ammo when placed in inventory",
|
||||
"item.superbwarfare.ammo_supplier.supply": "%1$s Ammo +%2$s",
|
||||
"item.superbwarfare.he_5_inches": "HE Shell",
|
||||
"item.superbwarfare.ap_5_inches": "AP Shell",
|
||||
|
|
|
@ -152,7 +152,9 @@
|
|||
"item.superbwarfare.handgun_ammo_box": "盒装手枪弹药",
|
||||
"des.superbwarfare.handgun_ammo_box": "手枪弹药 *30",
|
||||
"item.superbwarfare.heavy_ammo": "重型弹药",
|
||||
"des.superbwarfare.ammo_supplier": "右击使用以补充弹药",
|
||||
"item.superbwarfare.creative_ammo_box": "创造弹药盒",
|
||||
"des.superbwarfare.creative_ammo_box": "放置在背包中以提供无限的弹药",
|
||||
"item.superbwarfare.ammo_supplier.supply": "%1$s弹药 +%2$s",
|
||||
"item.superbwarfare.he_5_inches": "高爆弹",
|
||||
"item.superbwarfare.ap_5_inches": "穿甲弹",
|
||||
|
|
Loading…
Add table
Reference in a new issue