added tooltips for arrows & texture for carpet bomb arrow

This commit is contained in:
Jenny 2025-01-24 20:55:42 +01:00
parent 3ae85cb1c1
commit 347edb43f5
Signed by: Jenny
GPG Key ID: 4A98012FB1C39311
6 changed files with 47 additions and 8 deletions

View File

@ -21,6 +21,7 @@ public class ModItemModelProvider extends ItemModelProvider {
protected void registerModels() {
simpleItem(items.TNT_ARROW);
simpleItem(items.CONCUSSIVE_ARROW);
simpleItem(items.CARPET_ARROW);
}
private ItemModelBuilder simpleItem(RegistryObject<Item> item) {

View File

@ -0,0 +1,38 @@
package com.jenny.compressedtnt.items;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
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 org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import static com.jenny.compressedtnt.Compressedtnt.MODID;
public abstract class ArrowAbstract extends ArrowItem {
public ArrowAbstract(Item.Properties properties){
super(properties);
}
@Override
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) {
String key = String.format("tooltip.%s.%s", MODID, this);
MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
}
}
@Override
@NotNull
public abstract AbstractArrow createArrow(@NotNull Level pLevel, @NotNull ItemStack pStack, @NotNull LivingEntity pShooter);
}

View File

@ -1,15 +1,13 @@
package com.jenny.compressedtnt.items;
import com.jenny.compressedtnt.entities.arrows.carpetArrow;
import com.jenny.compressedtnt.entities.arrows.tntArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
public class ArrowCarpet extends ArrowItem {
public class ArrowCarpet extends ArrowAbstract {
public ArrowCarpet(Properties properties){
super(properties);
}

View File

@ -3,13 +3,12 @@ package com.jenny.compressedtnt.items;
import com.jenny.compressedtnt.entities.arrows.concussiveArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
public class ArrowConcussive extends ArrowItem {
public class ArrowConcussive extends ArrowAbstract {
public ArrowConcussive(Item.Properties properties){
super(properties);
}

View File

@ -3,13 +3,12 @@ package com.jenny.compressedtnt.items;
import com.jenny.compressedtnt.entities.arrows.tntArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
public class ArrowTNT extends ArrowItem {
public class ArrowTNT extends ArrowAbstract {
public ArrowTNT(Item.Properties properties){
super(properties);
}

View File

@ -13,5 +13,9 @@
"item.compressedtnt.arrow_tnt": "TNT Arrow",
"item.compressedtnt.arrow_concussive": "Concussive Arrow",
"item.compressedtnt.arrow_carpet": "Carpet Bombing Arrow"
"item.compressedtnt.arrow_carpet": "Carpet Bombing Arrow",
"tooltip.compressedtnt.arrow_tnt": "explodes on impact",
"tooltip.compressedtnt.arrow_concussive": "explodes on impact without block damage",
"tooltip.compressedtnt.arrow_carpet": "splits into multiple TNT arrows when it starts falling"
}