Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Oct 31, 2024
1 parent 2b16e7d commit 19d7803
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/generated/resources/data/minecraft/tags/item/arrows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"nmt:obsidian_tipped_arrow"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.nova.nmt.client.renderer.entity;

import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.projectile.Arrow;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class ObsidianTippableArrowRenderer extends ArrowRenderer<Arrow> {
public static final ResourceLocation NORMAL_ARROW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/arrow.png");
public static final ResourceLocation TIPPED_ARROW_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/projectiles/tipped_arrow.png");

public ObsidianTippableArrowRenderer(EntityRendererProvider.Context context) {
super(context);
}

public ResourceLocation getTextureLocation(Arrow entity) {
return entity.getColor() > 0 ? TIPPED_ARROW_LOCATION : NORMAL_ARROW_LOCATION;
}
}
2 changes: 2 additions & 0 deletions src/main/java/net/nova/nmt/data/DataGenerators.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.nova.nmt.data.loot.NMTLootTableProvider;
import net.nova.nmt.data.recipe.NMTRecipeProvider;
import net.nova.nmt.data.tags.NMTBlockTagsProvider;
import net.nova.nmt.data.tags.NMTItemTagsProvider;

import java.util.concurrent.CompletableFuture;

Expand All @@ -35,6 +36,7 @@ public static void gatherData(GatherDataEvent event) {

NMTBlockTagsProvider modBlockTagsProvider = new NMTBlockTagsProvider(output, lookupProvider, existingFileHelper);
generator.addProvider(true, modBlockTagsProvider);
generator.addProvider(true, new NMTItemTagsProvider(output, lookupProvider, modBlockTagsProvider, existingFileHelper));

generator.addProvider(true, new NMTLootTableProvider(output, lookupProvider));

Expand Down
23 changes: 23 additions & 0 deletions src/main/java/net/nova/nmt/data/tags/NMTItemTagsProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.nova.nmt.data.tags;

import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.tags.ItemTags;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.nova.nmt.init.NMTItems;

import java.util.concurrent.CompletableFuture;

import static net.nova.nmt.NoMoreThings.MODID;

public class NMTItemTagsProvider extends ItemTagsProvider {
public NMTItemTagsProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, NMTBlockTagsProvider provider, ExistingFileHelper existingFileHelper) {
super(output, lookupProvider, provider.contentsGetter(), MODID, existingFileHelper);
}

@Override
protected void addTags(HolderLookup.Provider provider) {
tag(ItemTags.ARROWS).add(NMTItems.OBSIDIAN_TIPPED_ARROW.get());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.nova.nmt.entity.projectile;

import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.level.Level;

public class ObsidianTippedArrow extends Arrow {
public ObsidianTippedArrow(EntityType<? extends Arrow> entityType, Level level) {
super(entityType, level);
}
}
5 changes: 1 addition & 4 deletions src/main/java/net/nova/nmt/event/NMTEventBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import net.minecraft.stats.Stats;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemUtils;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.*;
import net.minecraft.world.item.alchemy.PotionContents;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DispenserBlock;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/nova/nmt/init/NMTItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemNameBlockItem;
import net.minecraft.world.item.TippedArrowItem;
import net.minecraft.world.item.alchemy.PotionContents;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;
Expand All @@ -24,4 +23,5 @@ public class NMTItems {
public static final DeferredItem<Item> SPLASH_OBSIDIAN_POTION = ITEMS.register("splash_obsidian_potion", () -> new SplashObsidianPotionItem(new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, new PotionContents(NMTPotions.LAVA)).fireResistant()));
public static final DeferredItem<Item> LINGERING_OBSIDIAN_POTION = ITEMS.register("lingering_obsidian_potion", () -> new LingeringObsidianPotionItem(new Item.Properties().stacksTo(1).component(DataComponents.POTION_CONTENTS, new PotionContents(NMTPotions.LAVA)).fireResistant()));
public static final DeferredItem<Item> OBSIDIAN_TIPPED_ARROW = ITEMS.register("obsidian_tipped_arrow", () -> new ObsidianTippedArrowItem(new Item.Properties().component(DataComponents.POTION_CONTENTS, new PotionContents(NMTPotions.LAVA))));

}

0 comments on commit 19d7803

Please sign in to comment.