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,14 +1,15 @@
package dev.sillyangel.nuggetmod.fabric;
import dev.sillyangel.nuggetmod.fabric.item.ModItemGroups;
import dev.sillyangel.nuggetmod.fabric.particle.ModParticles;
import dev.sillyangel.nuggetmod.fabric.villager.ModVillagers;
import net.fabricmc.api.ModInitializer;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.item.ModItemGroups;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import dev.sillyangel.nuggetmod.fabric.sound.ModSounds;
import dev.sillyangel.nuggetmod.fabric.world.gen.ModWorldGeneration;
import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.world.ModWorldGeneration;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.ItemGroups;
import net.minecraft.text.Text;
import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradedItem;
@@ -26,56 +27,71 @@ public class NuggetMod implements ModInitializer {
@Override
public void onInitialize() {
LOGGER.info("Initializing Nugget");
LOGGER.info("Initializing Nugget (Fabric)");
// Initialize common mod
dev.sillyangel.nuggetmod.NuggetMod.init();
// Fabric-specific registrations
ModItemGroups.registerItemGroups();
ModItems.registerModItems();
ModBlocks.registerModBlocks();
ModSounds.registerSounds();
ModWorldGeneration.generateModWorldGen();
ModVillagers.registerVillagers();
ModParticles.registerParticles();
// Register tooltip for nugget item using Fabric API
ItemTooltipCallback.EVENT.register((itemStack, tooltipContext, tooltipType, list) -> {
if (itemStack.isOf(ModItems.NUGGET)) {
if (itemStack.isOf(ModItems.NUGGET.get())) {
list.add(Text.translatable("item.nuggetmod.nugget.tooltip"));
}
});
// Add items to vanilla creative tabs
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
entries.add(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get());
});
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> {
entries.add(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get());
});
// Villager trades
TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 1, factories -> {
factories.add((world,entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 3),
new ItemStack(ModItems.NUGGET, 8), 7, 2, 0.04f));
new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f));
});
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 1, factories -> {
factories.add((world,entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 5),
new ItemStack(ModItems.NUGGET, 20), 4, 7, 0.04f));
new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f));
factories.add((world,entity, random) -> new TradeOffer(
new TradedItem(ModItems.NUGGET, 16),
new ItemStack(ModItems.NUGGET_HORSE_ARMOR, 1), 4, 7, 0.04f));
new TradedItem(ModItems.NUGGET.get(), 16),
new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 4, 7, 0.04f));
});
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 2, factories -> {
factories.add((world,entity, random) -> new TradeOffer(
new TradedItem(ModItems.NUGGET, 10),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE, 1), 4, 7, 0.04f));
new TradedItem(ModItems.NUGGET.get(), 10),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 4, 7, 0.04f));
factories.add((world,entity, random) -> new TradeOffer(
new TradedItem(ModItems.NUGGET, 10),
new ItemStack(ModItems.NUGGET_MUSIC_DISC, 1), 3, 12, 0.09f));
new TradedItem(ModItems.NUGGET.get(), 10),
new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 3, 12, 0.09f));
});
TradeOfferHelper.registerWanderingTraderOffers(factories -> {
factories.addAll(Identifier.of(NuggetMod.MOD_ID, "emerald_for_nuggetsmithing"), (world, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 25),
new ItemStack(ModItems. NUGGET_SMITHING_TEMPLATE, 1), 4, 7, 0.04f));
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 4, 7, 0.04f));
factories.addAll(Identifier.of(NuggetMod.MOD_ID, "nuggets_to_musicdisc"), (world, entity, random) -> new TradeOffer(
new TradedItem(ModItems.NUGGET, 15),
new ItemStack(ModItems.NUGGET_MUSIC_DISC, 1), 3, 12, 0.09f));
new TradedItem(ModItems.NUGGET.get(), 15),
new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 3, 12, 0.09f));
});
}
}
}

View File

@@ -3,11 +3,11 @@ package dev.sillyangel.nuggetmod.fabric;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import dev.sillyangel.nuggetmod.fabric.datagen.*;
import dev.sillyangel.nuggetmod.fabric.trim.ModTrimMaterials;
import dev.sillyangel.nuggetmod.fabric.trim.ModTrimPatterns;
import dev.sillyangel.nuggetmod.trim.ModTrimMaterials;
import dev.sillyangel.nuggetmod.trim.ModTrimPatterns;
import net.minecraft.registry.RegistryBuilder;
import dev.sillyangel.nuggetmod.fabric.world.ModConfiguredFeatures;
import dev.sillyangel.nuggetmod.fabric.world.ModPlacedFeatures;
import dev.sillyangel.nuggetmod.worldgen.ModConfiguredFeatures;
import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures;
import net.minecraft.registry.RegistryKeys;
public class NuggetModDataGenerator implements DataGeneratorEntrypoint {

View File

@@ -1,57 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.block;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.block.*;
import net.minecraft.block.enums.NoteBlockInstrument;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import java.util.function.Function;
public class ModBlocks {
public static final Block NUGGET_BLOCK = registerBlock("nugget_block",
properties -> new Block(properties.strength(4f)
.requiresTool().sounds(BlockSoundGroup.AMETHYST_BLOCK)));
public static final Block RAW_NUGGET_BLOCK = registerBlock("raw_nugget_block",
properties -> new Block(properties.strength(4f)
.requiresTool()));
public static final Block NUGGET_ORE = registerBlock("nugget_ore",
properties -> new ExperienceDroppingBlock(UniformIntProvider.create(2, 5),
properties.strength(3f).requiresTool()));
public static final Block NUGGET_DEEPSLATE_ORE = registerBlock("nugget_deepslate_ore",
properties -> new ExperienceDroppingBlock(UniformIntProvider.create(3, 6),
properties.strength(4f).requiresTool().sounds(BlockSoundGroup.DEEPSLATE)));
private static Block registerBlock(String name, Function<AbstractBlock.Settings, Block> function) {
Block toRegister = function.apply(AbstractBlock.Settings.create().registryKey(RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name))));
registerBlockItem(name, toRegister);
return Registry.register(Registries.BLOCK, Identifier.of(NuggetMod.MOD_ID, name), toRegister);
}
private static void registerBlockItem(String name, Block block) {
Registry.register(Registries.ITEM, Identifier.of(NuggetMod.MOD_ID, name),
new BlockItem(block, new Item.Settings().useBlockPrefixedTranslationKey()
.registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)))));
}
public static void registerModBlocks() {
NuggetMod.LOGGER.info("Registering Mod Blocks for " + NuggetMod.MOD_ID);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> {
entries.add(NUGGET_BLOCK);
entries.add(RAW_NUGGET_BLOCK);
});
}
}

View File

@@ -2,10 +2,10 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.util.ModTags;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
import dev.sillyangel.nuggetmod.fabric.util.ModTags;
import java.util.concurrent.CompletableFuture;
@@ -17,21 +17,22 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
@Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
valueLookupBuilder(BlockTags.PICKAXE_MINEABLE)
.add(ModBlocks.NUGGET_BLOCK)
.add(ModBlocks.RAW_NUGGET_BLOCK)
.add(ModBlocks.NUGGET_ORE)
.add(ModBlocks.NUGGET_DEEPSLATE_ORE);
.add(ModBlocks.NUGGET_BLOCK.get())
.add(ModBlocks.RAW_NUGGET_BLOCK.get())
.add(ModBlocks.NUGGET_ORE.get())
.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
valueLookupBuilder(BlockTags.NEEDS_STONE_TOOL)
.add(ModBlocks.NUGGET_DEEPSLATE_ORE)
.add(ModBlocks.NUGGET_BLOCK)
.add(ModBlocks.RAW_NUGGET_BLOCK);
.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get())
.add(ModBlocks.NUGGET_BLOCK.get())
.add(ModBlocks.RAW_NUGGET_BLOCK.get());
valueLookupBuilder(BlockTags.NEEDS_DIAMOND_TOOL)
.add(ModBlocks.NUGGET_BLOCK);
.add(ModBlocks.NUGGET_BLOCK.get());
valueLookupBuilder(ModTags.Blocks.NEEDS_NUGGET_TOOL)
.addTag(BlockTags.NEEDS_DIAMOND_TOOL)
.add(ModBlocks.NUGGET_BLOCK);
.add(ModBlocks.NUGGET_BLOCK.get());
}
}
}

View File

@@ -2,7 +2,7 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.ItemTags;
@@ -15,30 +15,25 @@ public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider {
@Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
// getOrCreateTagBuilder(ModTags.Items.TRANSFORMABLE_ITEMS)
// .add(ModItems.NUGGET)
// .add(ModItems.RAW_NUGGET)
// .add(Items.COAL)
// .add(Items.STICK)
// .add(Items.APPLE);
valueLookupBuilder(ItemTags.SWORDS)
.add(ModItems.NUGGET_SWORD);
.add(ModItems.NUGGET_SWORD.get());
valueLookupBuilder(ItemTags.PICKAXES)
.add(ModItems.NUGGET_PICKAXE);
.add(ModItems.NUGGET_PICKAXE.get());
valueLookupBuilder(ItemTags.SHOVELS)
.add(ModItems.NUGGET_SHOVEL);
.add(ModItems.NUGGET_SHOVEL.get());
valueLookupBuilder(ItemTags.AXES)
.add(ModItems.NUGGET_AXE);
.add(ModItems.NUGGET_AXE.get());
valueLookupBuilder(ItemTags.HOES)
.add(ModItems.NUGGET_HOE);
.add(ModItems.NUGGET_HOE.get());
valueLookupBuilder(ItemTags.SPEARS)
.add(ModItems.NUGGET_SPEAR);
.add(ModItems.NUGGET_SPEAR.get());
valueLookupBuilder(ItemTags.TRIMMABLE_ARMOR)
.add(ModItems.NUGGET_HELMET)
.add(ModItems.NUGGET_CHESTPLATE)
.add(ModItems.NUGGET_LEGGINGS)
.add(ModItems.NUGGET_BOOTS);
.add(ModItems.NUGGET_HELMET.get())
.add(ModItems.NUGGET_CHESTPLATE.get())
.add(ModItems.NUGGET_LEGGINGS.get())
.add(ModItems.NUGGET_BOOTS.get());
valueLookupBuilder(ItemTags.TRIM_MATERIALS)
.add(ModItems.NUGGET);
.add(ModItems.NUGGET.get());
}
}
}

View File

@@ -2,8 +2,8 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
@@ -26,11 +26,11 @@ public class ModLootTableProvider extends FabricBlockLootTableProvider {
@Override
public void generate() {
addDrop(ModBlocks.NUGGET_BLOCK);
addDrop(ModBlocks.RAW_NUGGET_BLOCK);
addDrop(ModBlocks.NUGGET_BLOCK.get());
addDrop(ModBlocks.RAW_NUGGET_BLOCK.get());
addDrop(ModBlocks.NUGGET_ORE, oreDrops(ModBlocks.NUGGET_ORE, ModItems.RAW_NUGGET));
addDrop(ModBlocks.NUGGET_DEEPSLATE_ORE, multipleOreDrops(ModBlocks.NUGGET_DEEPSLATE_ORE, ModItems.RAW_NUGGET, 2, 6));
addDrop(ModBlocks.NUGGET_ORE.get(), oreDrops(ModBlocks.NUGGET_ORE.get(), ModItems.RAW_NUGGET.get()));
addDrop(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), multipleOreDrops(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), ModItems.RAW_NUGGET.get(), 2, 6));
}
public LootTable.Builder multipleOreDrops(Block drop, Item item, float minDrops, float maxDrops) {
@@ -39,4 +39,5 @@ public class ModLootTableProvider extends FabricBlockLootTableProvider {
ItemEntry.builder(item).apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(minDrops, maxDrops))))
.apply(ApplyBonusLootFunction.oreDrops(impl.getOrThrow(Enchantments.FORTUNE)))));
}
}
}

View File

@@ -1,10 +1,10 @@
package dev.sillyangel.nuggetmod.fabric.datagen;
import dev.sillyangel.nuggetmod.fabric.item.ModArmorMaterials;
import dev.sillyangel.nuggetmod.item.ModArmorMaterials;
import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.client.data.*;
public class ModModelProvider extends FabricModelProvider {
@@ -14,35 +14,36 @@ public class ModModelProvider extends FabricModelProvider {
// Blocks are generated here
@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_BLOCK);
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.RAW_NUGGET_BLOCK);
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_ORE);
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_DEEPSLATE_ORE);
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.RAW_NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_ORE.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}
// Items are generated here
@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(ModItems.NUGGET, Models.GENERATED);
itemModelGenerator.register(ModItems.RAW_NUGGET, Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET.get(), Models.GENERATED);
itemModelGenerator.register(ModItems.RAW_NUGGET.get(), Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_SWORD, Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_PICKAXE, Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_SHOVEL, Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_AXE, Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_HOE, Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_SWORD.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_PICKAXE.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_SHOVEL.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_AXE.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_HOE.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_SPEAR, Models.SPEAR_IN_HAND);
itemModelGenerator.register(ModItems.NUGGET_SPEAR.get(), Models.SPEAR_IN_HAND);
itemModelGenerator.registerArmor(ModItems.NUGGET_HELMET, ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.HELMET_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_CHESTPLATE, ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.CHESTPLATE_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_LEGGINGS, ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.LEGGINGS_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_BOOTS, ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.BOOTS_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.HELMET_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.CHESTPLATE_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.LEGGINGS_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.BOOTS_TRIM_ID_PREFIX, false);
itemModelGenerator.register(ModItems.NUGGET_HORSE_ARMOR, Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_HORSE_ARMOR.get(), Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_SMITHING_TEMPLATE, Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_SMITHING_TEMPLATE.get(), Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_MUSIC_DISC, Models.GENERATED);
itemModelGenerator.register(ModItems.NUGGET_MUSIC_DISC.get(), Models.GENERATED);
}
}
}

View File

@@ -4,9 +4,9 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.item.Items;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import dev.sillyangel.nuggetmod.fabric.trim.ModTrimPatterns;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.trim.ModTrimPatterns;
import net.minecraft.data.recipe.RecipeExporter;
import net.minecraft.data.recipe.RecipeGenerator;
import net.minecraft.item.ItemConvertible;
@@ -29,115 +29,115 @@ public class ModRecipeProvider extends FabricRecipeProvider {
return new RecipeGenerator(wrapperLookup, recipeExporter) {
@Override
public void generate() {
List<ItemConvertible> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET, ModBlocks.NUGGET_ORE,
ModBlocks.NUGGET_DEEPSLATE_ORE);
List<ItemConvertible> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(),
ModBlocks.NUGGET_DEEPSLATE_ORE.get());
offerSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET, 0.25f, 200, "nugget");
offerBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET, 0.25f, 100, "nugget");
offerSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
offerBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
offerReversibleCompactingRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET, RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK);
offerReversibleCompactingRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET.get(), RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK.get());
// RAW_NUGGET_BLOCK
createShaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK)
createShaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
.pattern("RRR")
.pattern("RRR")
.pattern("RRR")
.input('R', ModItems.RAW_NUGGET)
.criterion(hasItem(ModItems.RAW_NUGGET), conditionsFromItem(ModItems.RAW_NUGGET))
.input('R', ModItems.RAW_NUGGET.get())
.criterion(hasItem(ModItems.RAW_NUGGET.get()), conditionsFromItem(ModItems.RAW_NUGGET.get()))
.offerTo(exporter);
createShapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET, 9)
.input(ModBlocks.RAW_NUGGET_BLOCK)
.criterion(hasItem(ModBlocks.RAW_NUGGET_BLOCK), conditionsFromItem(ModBlocks.RAW_NUGGET_BLOCK))
createShapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.input(ModBlocks.RAW_NUGGET_BLOCK.get())
.criterion(hasItem(ModBlocks.RAW_NUGGET_BLOCK.get()), conditionsFromItem(ModBlocks.RAW_NUGGET_BLOCK.get()))
.offerTo(exporter);
// TOOLS
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get())
.pattern(" N ")
.pattern(" N ")
.pattern(" S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE)
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get())
.pattern("NNN")
.pattern(" S ")
.pattern(" S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE)
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get())
.pattern(" NN")
.pattern(" SN")
.pattern(" S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL)
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get())
.pattern(" N ")
.pattern(" S ")
.pattern(" S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE)
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get())
.pattern(" NN")
.pattern(" S ")
.pattern(" S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get())
.pattern(" N")
.pattern(" S ")
.pattern("S ")
.input('N', ModItems.NUGGET)
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
// ARMOR
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get())
.pattern("NNN")
.pattern("N N")
.input('N', ModItems.NUGGET)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get())
.pattern("N N")
.pattern("NNN")
.pattern("NNN")
.input('N', ModItems.NUGGET)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get())
.pattern("NNN")
.pattern("N N")
.pattern("N N")
.input('N', ModItems.NUGGET)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS)
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get())
.pattern("N N")
.pattern("N N")
.input('N', ModItems.NUGGET)
.criterion(hasItem(ModItems.NUGGET), conditionsFromItem(ModItems.NUGGET))
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
offerSmithingTrimRecipe(ModItems.NUGGET_SMITHING_TEMPLATE, ModTrimPatterns.NUGGET,
offerSmithingTrimRecipe(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET,
RegistryKey.of(RegistryKeys.RECIPE, Identifier.of(NuggetMod.MOD_ID, "nugget_smithing_template")));
}
};

View File

@@ -1,27 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.item;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.util.ModTags;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentAsset;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import java.util.EnumMap;
public class ModArmorMaterials {
static RegistryKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = RegistryKey.ofRegistry(Identifier.ofVanilla("equipment_asset"));
public static final RegistryKey<EquipmentAsset> NUGGET_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static final ArmorMaterial NUGGET_ARMOR_MATERIAL = new ArmorMaterial(500, Util.make(new EnumMap<>(EquipmentType.class), map -> {
map.put(EquipmentType.BOOTS, 3);
map.put(EquipmentType.LEGGINGS, 6);
map.put(EquipmentType.CHESTPLATE, 8);
map.put(EquipmentType.HELMET, 3);
map.put(EquipmentType.BODY, 19);
}), 20, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 4.0F, 0.1F, ModTags.Items.REPAIRS_NUGGET_ARMOR, NUGGET_KEY);
}

View File

@@ -1,8 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.item;
import net.minecraft.component.type.FoodComponent;
public class ModFoodComponents {
public static final FoodComponent NUGGET = new FoodComponent.Builder().nutrition(5).saturationModifier(0.5f).build();
}

View File

@@ -1,7 +1,8 @@
package dev.sillyangel.nuggetmod.fabric.item;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@@ -14,40 +15,42 @@ public class ModItemGroups {
public static final ItemGroup NUGGET_BLOCKS_GROUP = Registry.register(Registries.ITEM_GROUP,
Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"),
FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK))
FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks"))
.entries((displayContext, entries) -> {
entries.add(ModBlocks.NUGGET_BLOCK);
entries.add(ModBlocks.RAW_NUGGET_BLOCK);
entries.add(ModBlocks.NUGGET_ORE);
entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE);
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 ItemGroup NUGGET_ITEMS_GROUP = Registry.register(Registries.ITEM_GROUP,
Identifier.of(NuggetMod.MOD_ID, "nugget_items"),
FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET))
FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_items"))
.entries((displayContext, entries) -> {
entries.add(ModItems.NUGGET);
entries.add(ModItems.RAW_NUGGET);
entries.add(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get());
// Tool Set
entries.add(ModItems.NUGGET_SWORD);
entries.add(ModItems.NUGGET_PICKAXE);
entries.add(ModItems.NUGGET_AXE);
entries.add(ModItems.NUGGET_SHOVEL);
entries.add(ModItems.NUGGET_HOE);
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());
// Armor
entries.add(ModItems.NUGGET_HELMET);
entries.add(ModItems.NUGGET_CHESTPLATE);
entries.add(ModItems.NUGGET_LEGGINGS);
entries.add(ModItems.NUGGET_BOOTS);
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);
entries.add(ModItems.NUGGET_HORSE_ARMOR.get());
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE);
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.add(ModItems.NUGGET_MUSIC_DISC);
entries.add(ModItems.NUGGET_MUSIC_DISC.get());
}).build());
public static void registerItemGroups() {

View File

@@ -1,81 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.item;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.sound.ModSounds;
import net.minecraft.item.*;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import java.util.function.Function;
public class ModItems {
public static final Item NUGGET = registerItem("nugget", setting -> new Item(setting
.food(ModFoodComponents.NUGGET)));
public static final Item RAW_NUGGET = registerItem("raw_nugget", Item::new);
// Tools
public static final Item NUGGET_SWORD = registerItem("nugget_sword",
setting -> new Item(setting.sword(ModToolMaterials.NUGGET, 3.0F, -2.4F)));
public static final Item NUGGET_PICKAXE = registerItem("nugget_pickaxe",
setting -> new Item(setting.pickaxe(ModToolMaterials.NUGGET, 1.0F, -2.8F)));
public static final Item NUGGET_SHOVEL = registerItem("nugget_shovel",
settings -> new ShovelItem(ModToolMaterials.NUGGET, 1.5F, -3.0F, settings));
public static final Item NUGGET_AXE = registerItem("nugget_axe",
settings -> new AxeItem(ModToolMaterials.NUGGET, 6.0F, -3.2F, settings));
public static final Item NUGGET_HOE = registerItem("nugget_hoe",
settings -> new HoeItem(ModToolMaterials.NUGGET, -3.0F, 0.0F, settings));
public static final Item NUGGET_SPEAR = registerItem("nugget_spear",
settings -> new Item(settings.spear(ModToolMaterials.NUGGET, 1F, 1.08F, 0.2F, 3.5F, 5.5F, 6.5F, 5.1F, 10.0F, 4.6F)));
// unreleased items
// bow, crossbow, trident, shield , shears, flint and steel, fishing rod
// Armor
public static final Item NUGGET_HELMET = registerItem("nugget_helmet",
setting -> new Item(setting.armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.HELMET)));
public static final Item NUGGET_CHESTPLATE = registerItem("nugget_chestplate",
setting -> new Item(setting.armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.CHESTPLATE)));
public static final Item NUGGET_LEGGINGS = registerItem("nugget_leggings",
setting -> new Item(setting.armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.LEGGINGS)));
public static final Item NUGGET_BOOTS = registerItem("nugget_boots",
setting -> new Item(setting.armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.BOOTS)));
public static final Item NUGGET_HORSE_ARMOR = registerItem("nugget_horse_armor",
setting -> new Item(setting.horseArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL)));
public static final Item NUGGET_SMITHING_TEMPLATE = registerItem("nugget_armor_trim_smithing_template",
SmithingTemplateItem::of);
public static final Item NUGGET_MUSIC_DISC = registerItem("nugget_music_disc",
setting -> new Item(setting.jukeboxPlayable(ModSounds.NUGGET_THEME_KEY).maxCount(1)));
private static Item registerItem(String name, Function<Item.Settings, Item> function) {
return Registry.register(Registries.ITEM, Identifier.of(NuggetMod.MOD_ID, name),
function.apply(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)))));
}
public static void registerModItems() {
NuggetMod.LOGGER.info("Registering Mod Items for " + NuggetMod.MOD_ID);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
entries.add(NUGGET);
entries.add(RAW_NUGGET);
});
}
}

View File

@@ -1,15 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.item;
import dev.sillyangel.nuggetmod.fabric.util.ModTags;
import net.minecraft.item.ToolMaterial;
public class ModToolMaterials {
public static final ToolMaterial NUGGET = new ToolMaterial(
ModTags.Blocks.INCORRECT_FOR_NUGGET_TOOL,
1500,
8.0F,
3.5F,
22,
ModTags.Items.NUGGET_TOOL_MATERIALS
);
}

View File

@@ -1,27 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.sound;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.jukebox.JukeboxSong;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
public class ModSounds {
public static final SoundEvent NUGGET_THEME = registerSoundEvent("nugget_theme");
public static final RegistryKey<JukeboxSong> NUGGET_THEME_KEY =
RegistryKey.of(RegistryKeys.JUKEBOX_SONG, Identifier.of(NuggetMod.MOD_ID, "nugget_theme"));
private static SoundEvent registerSoundEvent(String name) {
Identifier id = Identifier.of(NuggetMod.MOD_ID, name);
return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id));
}
public static void registerSounds() {
NuggetMod.LOGGER.info("Registering Mod Sounds for " + NuggetMod.MOD_ID);
}
}

View File

@@ -1,37 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.trim;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import net.minecraft.item.Item;
import net.minecraft.item.equipment.trim.ArmorTrimAssets;
import net.minecraft.item.equipment.trim.ArmorTrimMaterial;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
public class ModTrimMaterials {
public static final RegistryKey<ArmorTrimMaterial> NUGGET = RegistryKey.of(RegistryKeys.TRIM_MATERIAL,
Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static void bootstrap(Registerable<ArmorTrimMaterial> registerable) {
register(registerable, NUGGET, Registries.ITEM.getEntry(ModItems.NUGGET),
Style.EMPTY.withColor(TextColor.parse("#f9b042").getOrThrow()));
}
private static void register(Registerable<ArmorTrimMaterial> registerable, RegistryKey<ArmorTrimMaterial> armorTrimKey,
RegistryEntry<Item> item, Style style) {
ArmorTrimMaterial trimMaterial = new ArmorTrimMaterial(ArmorTrimAssets.of("nugget"),
Text.translatable(Util.createTranslationKey("trim_material", armorTrimKey.getValue())).fillStyle(style));
registerable.register(armorTrimKey, trimMaterial);
}
}

View File

@@ -1,28 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.trim;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.item.ModItems;
import net.minecraft.item.Item;
import net.minecraft.item.equipment.trim.ArmorTrimPattern;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
public class ModTrimPatterns {
public static final RegistryKey<ArmorTrimPattern> NUGGET = RegistryKey.of(RegistryKeys.TRIM_PATTERN,
Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static void bootstrap(Registerable<ArmorTrimPattern> context) {
register(context, ModItems.NUGGET_SMITHING_TEMPLATE, NUGGET);
}
private static void register(Registerable<ArmorTrimPattern> context, Item item, RegistryKey<ArmorTrimPattern> key) {
ArmorTrimPattern trimPattern = new ArmorTrimPattern(key.getValue(),
Text.translatable(Util.createTranslationKey("trim_pattern", key.getValue())), false);
context.register(key, trimPattern);
}
}

View File

@@ -1,29 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.util;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
public class ModTags {
public static class Blocks {
public static final TagKey<Block> NEEDS_NUGGET_TOOL = createTag("needs_nugget_tool");
public static final TagKey<Block> INCORRECT_FOR_NUGGET_TOOL = createTag("incorrect_for_nugget_tool");
private static TagKey<Block> createTag(String name) {
return TagKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name));
}
}
public static class Items {
// public static final TagKey<Item> TRANSFORMABLE_ITEMS = createTag("transformable_items");
public static final TagKey<Item> NUGGET_TOOL_MATERIALS = createTag("nugget_tool_materials");
public static final TagKey<Item> REPAIRS_NUGGET_ARMOR = createTag("repairs_nugget_armor");
private static TagKey<Item> createTag(String name) {
return TagKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name));
}
}
}

View File

@@ -1,53 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.world;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.structure.rule.BlockMatchRuleTest;
import net.minecraft.structure.rule.RuleTest;
import net.minecraft.structure.rule.TagMatchRuleTest;
import dev.sillyangel.nuggetmod.fabric.block.ModBlocks;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import java.util.List;
public class ModConfiguredFeatures {
public static final RegistryKey<ConfiguredFeature<?, ?>> NUGGET_ORE_KEY = registerKey("nugget_ore");
// public static final RegistryKey<ConfiguredFeature<?, ?>> NETHER_NUGGET_ORE_KEY = registerKey("nether_nugget_ore");
// public static final RegistryKey<ConfiguredFeature<?, ?>> END_NUGGET_ORE_KEY = registerKey("end_nugget_ore");
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
RuleTest stoneReplaceables = new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES);
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
// RuleTest netherReplaceables = new TagMatchRuleTest(BlockTags.BASE_STONE_NETHER);
// RuleTest endReplaceables = new BlockMatchRuleTest(Blocks.END_STONE);
List<OreFeatureConfig.Target> overworldPinkGarnetOres =
List.of(OreFeatureConfig.createTarget(stoneReplaceables, ModBlocks.NUGGET_ORE.getDefaultState()),
OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.NUGGET_DEEPSLATE_ORE.getDefaultState()));
// List<OreFeatureConfig.Target> netherPinkGarnetOres =
// List.of(OreFeatureConfig.createTarget(netherReplaceables, ModBlocks.NUGGET_NETHER_ORE.getDefaultState()));
// List<OreFeatureConfig.Target> endPinkGarnetOres =
// List.of(OreFeatureConfig.createTarget(endReplaceables, ModBlocks.NUGGET_END_ORE.getDefaultState()));
register(context, NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldPinkGarnetOres, 12));
// register(context, NETHER_NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(netherPinkGarnetOres, 9));
// register(context, END_NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(endPinkGarnetOres, 9));
}
public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name));
}
private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context,
RegistryKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
context.register(key, new ConfiguredFeature<>(feature, configuration));
}
}

View File

@@ -1,8 +1,8 @@
package dev.sillyangel.nuggetmod.fabric.world.gen;
package dev.sillyangel.nuggetmod.fabric.world;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import dev.sillyangel.nuggetmod.fabric.world.ModPlacedFeatures;
import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures;
import net.minecraft.world.gen.GenerationStep;
public class ModOreGeneration {

View File

@@ -1,19 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.world;
import net.minecraft.world.gen.placementmodifier.*;
import java.util.List;
public class ModOrePlacement {
public static List<PlacementModifier> modifiers(PlacementModifier countModifier, PlacementModifier heightModifier) {
return List.of(countModifier, SquarePlacementModifier.of(), heightModifier, BiomePlacementModifier.of());
}
public static List<PlacementModifier> modifiersWithCount(int count, PlacementModifier heightModifier) {
return modifiers(CountPlacementModifier.of(count), heightModifier);
}
public static List<PlacementModifier> modifiersWithRarity(int chance, PlacementModifier heightModifier) {
return modifiers(RarityFilterPlacementModifier.of(chance), heightModifier);
}
}

View File

@@ -1,53 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.world;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
import net.minecraft.world.gen.placementmodifier.PlacementModifier;
import java.util.List;
public class ModPlacedFeatures {
public static final RegistryKey<PlacedFeature> NUGGET_ORE_PLACED_KEY = registerKey("nugget_ore_placed");
// public static final RegistryKey<PlacedFeature> NETHER_NUGGET_ORE_PLACED_KEY = registerKey("nether_nugget_ore_placed");
// public static final RegistryKey<PlacedFeature> END_NUGGET_ORE_PLACED_KEY = registerKey("end_nugget_ore_placed");
public static void bootstrap(Registerable<PlacedFeature> context) {
var configuredFeatures = context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE);
register(context, NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.NUGGET_ORE_KEY),
ModOrePlacement.modifiersWithCount(14,
HeightRangePlacementModifier.uniform(YOffset.fixed(-64), YOffset.fixed(80))));
// register(context, NETHER_NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.NETHER_NUGGET_ORE_KEY),
// ModOrePlacement.modifiersWithCount(14,
// HeightRangePlacementModifier.uniform(YOffset.fixed(-80), YOffset.fixed(80))));
// register(context, END_NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.END_NUGGET_ORE_KEY),
// ModOrePlacement.modifiersWithCount(14,
// HeightRangePlacementModifier.uniform(YOffset.fixed(-80), YOffset.fixed(80))));
}
public static RegistryKey<PlacedFeature> registerKey(String name) {
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name));
}
private static void register(Registerable<PlacedFeature> context, RegistryKey<PlacedFeature> key, RegistryEntry<ConfiguredFeature<?, ?>> configuration,
List<PlacementModifier> modifiers) {
context.register(key, new PlacedFeature(configuration, List.copyOf(modifiers)));
}
private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<PlacedFeature> context, RegistryKey<PlacedFeature> key,
RegistryEntry<ConfiguredFeature<?, ?>> configuration,
PlacementModifier... modifiers) {
register(context, key, configuration, List.of(modifiers));
}
}

View File

@@ -1,4 +1,4 @@
package dev.sillyangel.nuggetmod.fabric.world.gen;
package dev.sillyangel.nuggetmod.fabric.world;
public class ModWorldGeneration {
public static void generateModWorldGen() {