neoforge stable 1.3.0+1.21.11

This commit is contained in:
2026-01-07 01:22:30 -06:00
parent c04c6d1e6e
commit 5218221bf8
34 changed files with 601 additions and 387 deletions

View File

@@ -1,13 +0,0 @@
package dev.sillyangel.nuggetmod.neoforge;
import net.neoforged.fml.common.Mod;
import dev.sillyangel.nuggetmod.ExampleMod;
@Mod(ExampleMod.MOD_ID)
public final class ExampleModNeoForge {
public ExampleModNeoForge() {
// Run our common setup.
ExampleMod.init();
}
}

View File

@@ -0,0 +1,19 @@
package dev.sillyangel.nuggetmod.neoforge;
import dev.sillyangel.nuggetmod.neoforge.item.ModItemGroups;
import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles;
import dev.sillyangel.nuggetmod.neoforge.villager.ModVillagers;
import net.neoforged.fml.common.Mod;
@Mod(dev.sillyangel.nuggetmod.NuggetMod.MOD_ID)
public final class NuggetMod {
public NuggetMod() {
// Run our common setup.
dev.sillyangel.nuggetmod.NuggetMod.init();
// Register NeoForge-specific features
ModParticles.registerParticles();
ModVillagers.registerVillagers();
ModItemGroups.registerItemGroups();
}
}

View File

@@ -0,0 +1,19 @@
package dev.sillyangel.nuggetmod.neoforge.client;
import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles;
import dev.sillyangel.nuggetmod.neoforge.particle.NuggetParticle;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
@EventBusSubscriber(modid = NuggetMod.MOD_ID, value = Dist.CLIENT)
public class NuggetModClient {
@SubscribeEvent
public static void registerParticleFactories(RegisterParticleProvidersEvent event) {
event.registerSpriteSet(ModParticles.NUGGET_PARTICLE, NuggetParticle.Factory::new);
}
}

View File

@@ -0,0 +1,64 @@
package dev.sillyangel.nuggetmod.neoforge.item;
import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
public class ModItemGroups {
public static final RegistryKey<ItemGroup> NUGGET_BLOCKS_GROUP_KEY = RegistryKey.of(RegistryKeys.ITEM_GROUP,
Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"));
public static final ItemGroup NUGGET_BLOCKS_GROUP = Registry.register(Registries.ITEM_GROUP,
NUGGET_BLOCKS_GROUP_KEY,
ItemGroup.create(ItemGroup.Row.TOP, -1)
.icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks"))
.entries((displayContext, entries) -> {
entries.add(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.add(ModBlocks.NUGGET_ORE.get());
entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build());
public static final RegistryKey<ItemGroup> NUGGET_ITEMS_GROUP_KEY = RegistryKey.of(RegistryKeys.ITEM_GROUP,
Identifier.of(NuggetMod.MOD_ID, "nugget_items"));
public static final ItemGroup NUGGET_ITEMS_GROUP = Registry.register(Registries.ITEM_GROUP,
NUGGET_ITEMS_GROUP_KEY,
ItemGroup.create(ItemGroup.Row.TOP, -1)
.icon(() -> new ItemStack(ModItems.NUGGET.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_items"))
.entries((displayContext, entries) -> {
entries.add(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get());
entries.add(ModItems.NUGGET_SWORD.get());
entries.add(ModItems.NUGGET_PICKAXE.get());
entries.add(ModItems.NUGGET_AXE.get());
entries.add(ModItems.NUGGET_SHOVEL.get());
entries.add(ModItems.NUGGET_HOE.get());
entries.add(ModItems.NUGGET_SPEAR.get());
entries.add(ModItems.NUGGET_HELMET.get());
entries.add(ModItems.NUGGET_CHESTPLATE.get());
entries.add(ModItems.NUGGET_LEGGINGS.get());
entries.add(ModItems.NUGGET_BOOTS.get());
entries.add(ModItems.NUGGET_HORSE_ARMOR.get());
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.add(ModItems.NUGGET_MUSIC_DISC.get());
}).build());
public static void registerItemGroups() {
}
}

View File

@@ -0,0 +1,20 @@
package dev.sillyangel.nuggetmod.neoforge.particle;
import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class ModParticles {
public static final SimpleParticleType NUGGET_PARTICLE =
registerParticle("nugget_particle", new SimpleParticleType(false));
private static SimpleParticleType registerParticle(String name, SimpleParticleType particleType) {
return Registry.register(Registries.PARTICLE_TYPE, Identifier.of(NuggetMod.MOD_ID, name), particleType);
}
public static void registerParticles() {
}
}

View File

@@ -0,0 +1,41 @@
package dev.sillyangel.nuggetmod.neoforge.particle;
import net.minecraft.client.particle.*;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.util.math.random.Random;
import org.jetbrains.annotations.Nullable;
public class NuggetParticle extends BillboardParticle {
public NuggetParticle(ClientWorld clientWorld, double x, double y, double z,
SpriteProvider spriteProvider, double xSpeed, double ySpeed, double zSpeed) {
super(clientWorld, x, y, z, xSpeed, ySpeed, zSpeed, spriteProvider.getFirst());
this.velocityMultiplier = 0.8f;
this.maxAge = 40;
this.red = 1f;
this.green = 1f;
this.blue = 1f;
}
@Override
protected RenderType getRenderType() {
return RenderType.PARTICLE_ATLAS_TRANSLUCENT;
}
public static class Factory implements ParticleFactory<SimpleParticleType> {
private final SpriteProvider spriteProvider;
public Factory(SpriteProvider spriteProvider) {
this.spriteProvider = spriteProvider;
}
@Nullable
@Override
public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z,
double velocityX, double velocityY, double velocityZ, Random random) {
return new NuggetParticle(world, x, y, z, this.spriteProvider, velocityX, velocityY, velocityZ);
}
}
}

View File

@@ -0,0 +1,36 @@
package dev.sillyangel.nuggetmod.neoforge.villager;
import com.google.common.collect.ImmutableSet;
import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType;
public class ModVillagers {
public static final RegistryKey<PointOfInterestType> NUGGETER_POI_KEY = registerPoiKey("nuggeter_poi");
public static final RegistryKey<VillagerProfession> NUGGETER_KEY =
RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, "nuggeter"));
public static final VillagerProfession NUGGETER = registerProfession("nuggeter", NUGGETER_POI_KEY);
private static VillagerProfession registerProfession(String name, RegistryKey<PointOfInterestType> type) {
return Registry.register(Registries.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, name),
new VillagerProfession(Text.literal("Nuggeter"), entry -> entry.matchesKey(type), entry -> entry.matchesKey(type),
ImmutableSet.of(), ImmutableSet.of(), SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN));
}
private static RegistryKey<PointOfInterestType> registerPoiKey(String name) {
return RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, Identifier.of(NuggetMod.MOD_ID, name));
}
public static void registerVillagers() {
}
}