Compare commits

14 Commits

Author SHA1 Message Date
2a5f50ec69 chore: update from java 21 to 25 inside of the workflow
Some checks failed
Build and Artifact / build (pull_request) Failing after 2m37s
2026-03-27 05:20:52 -05:00
61bf365d13 fix a bunch of errors and have to wait for architectury api version 20 or something that will support 26.1 since i am currently getting Expected offical namespace for access widener entry, found: intermadiary in mod: architectury-19.0.1.jar
Some checks failed
Build and Artifact / build (pull_request) Has been cancelled
2026-03-27 05:12:11 -05:00
02b8a19bed Update fabric/src/main/java/dev/sillyangel/nuggetmod/fabric/datagen/ModRecipeProvider.java
Some checks failed
Build and Artifact / build (pull_request) Failing after 1m7s
a
2026-03-24 12:47:51 -05:00
c1b828157c Update fabric/src/main/java/dev/sillyangel/nuggetmod/fabric/datagen/ModRecipeProvider.java
Some checks failed
Build and Artifact / build (pull_request) Failing after 55s
2026-03-24 12:46:26 -05:00
7868c03db2 Update fabric/src/main/java/dev/sillyangel/nuggetmod/fabric/datagen/ModRecipeProvider.java
Some checks failed
Build and Artifact / build (pull_request) Failing after 1m7s
2026-03-24 12:44:39 -05:00
6e70a80804 Update fabric/src/main/java/dev/sillyangel/nuggetmod/fabric/datagen/ModRecipeProvider.java
Some checks failed
Build and Artifact / build (pull_request) Failing after 1m6s
whoops
2026-03-24 12:43:22 -05:00
ca86720db1 Update fabric/src/main/java/dev/sillyangel/nuggetmod/fabric/datagen/ModRecipeProvider.java
Some checks failed
Build and Artifact / build (pull_request) Failing after 1m7s
2026-03-24 12:41:46 -05:00
115704fe79 Update common/src/main/java/dev/sillyangel/nuggetmod/item/ModFoodComponents.java
All checks were successful
Build and Artifact / build (pull_request) Successful in 1m29s
2026-03-24 12:35:05 -05:00
6396c55ae5 Update common/src/main/java/dev/sillyangel/nuggetmod/item/ModItemGroups.java
Some checks failed
Build and Artifact / build (pull_request) Has been cancelled
2026-03-24 12:33:31 -05:00
6555952e1f Update common/src/main/java/dev/sillyangel/nuggetmod/item/ModItems.java
All checks were successful
Build and Artifact / build (pull_request) Successful in 7m23s
2026-03-24 12:32:51 -05:00
7b51341e4d Merge branch 'master' into mojangmapping
All checks were successful
Build and Artifact / build (pull_request) Successful in 6m11s
2026-01-23 19:57:13 -06:00
2b2fbf0568 finished convertion to mojangmappings
All checks were successful
Build and Artifact / build (pull_request) Successful in 3m45s
2026-01-23 19:55:35 -06:00
fc81b81683 fix again 2026-01-23 15:15:42 -06:00
06d9266208 part 1, finished common. moving onto neoforge and fabric
Some checks failed
Build and Artifact / build (pull_request) Failing after 2m19s
2026-01-23 06:10:34 -06:00
55 changed files with 839 additions and 706 deletions

View File

@@ -15,11 +15,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up JDK 21 - name: Set up JDK 25
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '25'
cache: 'gradle' cache: 'gradle'
- name: Cache Gradle packages - name: Cache Gradle packages

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id 'dev.architectury.loom' version '1.13.467' apply false id 'dev.architectury.loom-no-remap' version '1.14-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4.162' id 'architectury-plugin' version '3.5-SNAPSHOT'
id 'com.gradleup.shadow' version '8.3.6' apply false id 'com.gradleup.shadow' version '8.3.6' apply false
} }
@@ -14,7 +14,7 @@ allprojects {
} }
subprojects { subprojects {
apply plugin: 'dev.architectury.loom' apply plugin: 'dev.architectury.loom-no-remap'
apply plugin: 'architectury-plugin' apply plugin: 'architectury-plugin'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
@@ -33,10 +33,6 @@ subprojects {
dependencies { dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version" minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
}
} }
java { java {
@@ -45,12 +41,12 @@ subprojects {
// If you remove this line, sources will not be generated. // If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21 sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_25
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.release = 21 it.options.release = 25
} }
// Configure Maven publishing. // Configure Maven publishing.

View File

@@ -1,8 +1,7 @@
architectury { architectury {
common rootProject.enabled_platforms.split(',') common rootProject.enabled_platforms.toString().split(',')
} }
sourceSets { sourceSets {
main { main {
resources { resources {
@@ -15,8 +14,8 @@ dependencies {
// We depend on Fabric Loader here to use the Fabric @Environment annotations, // We depend on Fabric Loader here to use the Fabric @Environment annotations,
// which get remapped to the correct annotations on each platform. // which get remapped to the correct annotations on each platform.
// Do NOT use other classes from Fabric Loader. // Do NOT use other classes from Fabric Loader.
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" implementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
// Architectury API. This is optional, and you can comment it out if you don't need it. // Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version" api "dev.architectury:architectury:$rootProject.architectury_api_version"
} }

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/spear_in_hand",
"textures": {
"layer0": "nuggetmod:item/nugget_spear_in_hand"
}
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_nugget": {
"conditions": {
"items": [
{
"items": "nuggetmod:nugget"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "nuggetmod:nugget_cake"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_nugget"
]
],
"rewards": {
"recipes": [
"nuggetmod:nugget_cake"
]
}
}

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"E": "nuggetmod:raw_nugget",
"M": "nuggetmod:nugget_block",
"S": "minecraft:sugar",
"W": "nuggetmod:nugget"
},
"pattern": [
"MMM",
"SES",
"WWW"
],
"result": {
"count": 1,
"id": "nuggetmod:nugget_cake"
}
}

View File

@@ -2,7 +2,7 @@
"type": "minecraft:ore", "type": "minecraft:ore",
"config": { "config": {
"discard_chance_on_air_exposure": 0.0, "discard_chance_on_air_exposure": 0.0,
"size": 12, "size": 9,
"targets": [ "targets": [
{ {
"state": { "state": {

View File

@@ -3,7 +3,7 @@
"placement": [ "placement": [
{ {
"type": "minecraft:count", "type": "minecraft:count",
"count": 14 "count": 12
}, },
{ {
"type": "minecraft:in_square" "type": "minecraft:in_square"

View File

@@ -1,6 +1,7 @@
package dev.sillyangel.nuggetmod; package dev.sillyangel.nuggetmod;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItemGroups;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.sound.ModSounds; import dev.sillyangel.nuggetmod.sound.ModSounds;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -17,6 +18,7 @@ public final class NuggetMod {
ModSounds.init(); ModSounds.init();
ModItems.init(); ModItems.init();
ModBlocks.init(); ModBlocks.init();
ModItemGroups.init();
LOGGER.info("Nugget Mod initialized"); LOGGER.info("Nugget Mod initialized");
} }

View File

@@ -3,59 +3,66 @@ package dev.sillyangel.nuggetmod.block;
import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier; import dev.architectury.registry.registries.RegistrySupplier;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.block.AbstractBlock; import net.minecraft.world.level.block.CakeBlock;
import net.minecraft.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.block.ExperienceDroppingBlock; import net.minecraft.world.level.block.Block;
import net.minecraft.item.BlockItem; import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.item.Item; import net.minecraft.world.item.BlockItem;
import net.minecraft.registry.RegistryKey; import net.minecraft.world.item.Item;
import net.minecraft.registry.RegistryKeys; import net.minecraft.resources.ResourceKey;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.core.registries.Registries;
import net.minecraft.util.Identifier; import net.minecraft.world.level.block.SoundType;
import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.resources.Identifier;
import net.minecraft.util.valueproviders.UniformInt;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ModBlocks { public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.BLOCK); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.BLOCK);
public static final DeferredRegister<Item> BLOCK_ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.ITEM); public static final DeferredRegister<Item> BLOCK_ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.ITEM);
public static final RegistrySupplier<Block> NUGGET_CAKE = registerBlockWithItem("nugget_cake",
() -> new CakeBlock(createBlockSettings("nugget_cake")
.strength(0.5f)
.forceSolidOn()
.sound(SoundType.WOOL)));
public static final RegistrySupplier<Block> NUGGET_BLOCK = registerBlockWithItem("nugget_block", public static final RegistrySupplier<Block> NUGGET_BLOCK = registerBlockWithItem("nugget_block",
() -> new Block(createBlockSettings("nugget_block") () -> new Block(createBlockSettings("nugget_block")
.strength(4f) .strength(4f)
.requiresTool() .requiresCorrectToolForDrops()
.sounds(BlockSoundGroup.AMETHYST_BLOCK))); .sound(SoundType.AMETHYST)));
public static final RegistrySupplier<Block> RAW_NUGGET_BLOCK = registerBlockWithItem("raw_nugget_block", public static final RegistrySupplier<Block> RAW_NUGGET_BLOCK = registerBlockWithItem("raw_nugget_block",
() -> new Block(createBlockSettings("raw_nugget_block") () -> new Block(createBlockSettings("raw_nugget_block")
.strength(4f) .strength(4f)
.requiresTool())); .requiresCorrectToolForDrops()));
public static final RegistrySupplier<Block> NUGGET_ORE = registerBlockWithItem("nugget_ore", public static final RegistrySupplier<Block> NUGGET_ORE = registerBlockWithItem("nugget_ore",
() -> new ExperienceDroppingBlock(UniformIntProvider.create(2, 5), () -> new DropExperienceBlock(UniformInt.of(2, 5),
createBlockSettings("nugget_ore") createBlockSettings("nugget_ore")
.strength(3f) .strength(3f)
.requiresTool())); .requiresCorrectToolForDrops()));
public static final RegistrySupplier<Block> NUGGET_DEEPSLATE_ORE = registerBlockWithItem("nugget_deepslate_ore", public static final RegistrySupplier<Block> NUGGET_DEEPSLATE_ORE = registerBlockWithItem("nugget_deepslate_ore",
() -> new ExperienceDroppingBlock(UniformIntProvider.create(3, 6), () -> new DropExperienceBlock(UniformInt.of(3, 6),
createBlockSettings("nugget_deepslate_ore") createBlockSettings("nugget_deepslate_ore")
.strength(4f) .strength(4f)
.requiresTool() .requiresCorrectToolForDrops()
.sounds(BlockSoundGroup.DEEPSLATE))); .sound(SoundType.DEEPSLATE)));
private static <T extends Block> RegistrySupplier<T> registerBlockWithItem(String name, Supplier<T> block) { private static <T extends Block> RegistrySupplier<T> registerBlockWithItem(String name, Supplier<T> block) {
RegistrySupplier<T> toReturn = BLOCKS.register(name, block); RegistrySupplier<T> toReturn = BLOCKS.register(name, block);
BLOCK_ITEMS.register(name, () -> new BlockItem(toReturn.get(), BLOCK_ITEMS.register(name, () -> new BlockItem(toReturn.get(),
new Item.Settings() new Item.Properties()
.useBlockPrefixedTranslationKey() .useBlockDescriptionPrefix()
.registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name))))); .setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)))));
return toReturn; return toReturn;
} }
private static AbstractBlock.Settings createBlockSettings(String name) { private static BlockBehaviour.Properties createBlockSettings(String name) {
return AbstractBlock.Settings.create() return BlockBehaviour.Properties.of()
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name))); .setId(ResourceKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)));
} }
public static void init() { public static void init() {

View File

@@ -2,27 +2,29 @@ package dev.sillyangel.nuggetmod.item;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.util.ModTags; import dev.sillyangel.nuggetmod.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 net.minecraft.util.Util;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.equipment.ArmorMaterial;
import net.minecraft.world.item.equipment.ArmorType;
import net.minecraft.world.item.equipment.EquipmentAsset;
import java.util.EnumMap; import java.util.EnumMap;
public class ModArmorMaterials { public class ModArmorMaterials {
static RegistryKey<? extends Registry<EquipmentAsset>> REGISTRY_KEY = RegistryKey.ofRegistry(Identifier.ofVanilla("equipment_asset")); public static final ResourceKey<EquipmentAsset> NUGGET_EQUIPMENT_ASSET =
public static final RegistryKey<EquipmentAsset> NUGGET_KEY = RegistryKey.of(REGISTRY_KEY, Identifier.of(NuggetMod.MOD_ID, "nugget")); ResourceKey.create(ResourceKey.createRegistryKey(Identifier.withDefaultNamespace("equipment_asset")),
Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget"));
public static final ArmorMaterial NUGGET_ARMOR_MATERIAL = new ArmorMaterial(500, Util.make(new EnumMap<>(EquipmentType.class), map -> { public static final ArmorMaterial NUGGET_ARMOR_MATERIAL = new ArmorMaterial(1200, Util.make(new EnumMap<>(ArmorType.class),
map.put(EquipmentType.BOOTS, 3); attribute -> {
map.put(EquipmentType.LEGGINGS, 6); attribute.put(ArmorType.BOOTS, 5);
map.put(EquipmentType.CHESTPLATE, 8); attribute.put(ArmorType.LEGGINGS, 7);
map.put(EquipmentType.HELMET, 3); attribute.put(ArmorType.CHESTPLATE, 9);
map.put(EquipmentType.BODY, 19); attribute.put(ArmorType.HELMET, 5);
}), 20, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 4.0F, 0.1F, ModTags.Items.REPAIRS_NUGGET_ARMOR, NUGGET_KEY); attribute.put(ArmorType.BODY, 11);
}), 20, SoundEvents.ARMOR_EQUIP_NETHERITE,
4f, 0.1f, ModTags.Items.REPAIRS_NUGGET_ARMOR, NUGGET_EQUIPMENT_ASSET);
} }

View File

@@ -1,11 +1,14 @@
package dev.sillyangel.nuggetmod.item; package dev.sillyangel.nuggetmod.item;
import net.minecraft.component.type.FoodComponent; import net.minecraft.world.food.FoodProperties;
public class ModFoodComponents { public class ModFoodComponents {
public static final FoodComponent NUGGET = new FoodComponent.Builder() public static final FoodProperties NUGGET = new FoodProperties.Builder()
.nutrition(5) .nutrition(5)
.saturationModifier(0.5f) .saturationModifier(0.5f)
.build(); .build();
} public static final FoodProperties NUGGET_CAKE = new FoodProperties.Builder()
.nutrition(3)
.saturationModifier(0.7f)
.build();
}

View File

@@ -0,0 +1,64 @@
package dev.sillyangel.nuggetmod.item;
import dev.architectury.registry.registries.RegistrySupplier;
import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTab;
//import net.neoforged.bus.api.IEventBus;
import dev.architectury.registry.registries.DeferredRegister;
import java.util.function.Supplier;
public class ModItemGroups {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
DeferredRegister.create(NuggetMod.MOD_ID, Registries.CREATIVE_MODE_TAB);
public static final RegistrySupplier<CreativeModeTab> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
.icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.title(Component.translatable("creativetab.nuggetmod.nugget_blocks"))
.displayItems((displayContext, entries) -> {
entries.accept(ModBlocks.NUGGET_BLOCK.get());
entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.accept(ModBlocks.NUGGET_ORE.get());
entries.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build());
public static final RegistrySupplier<CreativeModeTab> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
.icon(() -> new ItemStack(ModItems.NUGGET.get()))
.title(Component.translatable("creativetab.nuggetmod.nugget_items"))
.displayItems((displayContext, entries) -> {
entries.accept(ModItems.NUGGET.get());
entries.accept(ModItems.RAW_NUGGET.get());
entries.accept(ModItems.NUGGET_SWORD.get());
entries.accept(ModItems.NUGGET_PICKAXE.get());
entries.accept(ModItems.NUGGET_AXE.get());
entries.accept(ModItems.NUGGET_SHOVEL.get());
entries.accept(ModItems.NUGGET_HOE.get());
entries.accept(ModItems.NUGGET_SPEAR.get());
entries.accept(ModItems.NUGGET_HELMET.get());
entries.accept(ModItems.NUGGET_CHESTPLATE.get());
entries.accept(ModItems.NUGGET_LEGGINGS.get());
entries.accept(ModItems.NUGGET_BOOTS.get());
entries.accept(ModItems.NUGGET_HORSE_ARMOR.get());
entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.accept(ModItems.NUGGET_MUSIC_DISC.get());
entries.accept(ModBlocks.NUGGET_CAKE.get());
}).build());
public static void init() {
CREATIVE_MODE_TABS.register();
}
}

View File

@@ -4,14 +4,14 @@ import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier; import dev.architectury.registry.registries.RegistrySupplier;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.sound.ModSounds; import dev.sillyangel.nuggetmod.sound.ModSounds;
import net.minecraft.item.*; import net.minecraft.world.item.*;
import net.minecraft.item.equipment.EquipmentType; import net.minecraft.world.item.equipment.ArmorType;
import net.minecraft.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.registries.Registries;
import net.minecraft.util.Identifier; import net.minecraft.resources.Identifier;
public class ModItems { public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.ITEM); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.ITEM);
// Basic Items // Basic Items
public static final RegistrySupplier<Item> NUGGET = ITEMS.register("nugget", public static final RegistrySupplier<Item> NUGGET = ITEMS.register("nugget",
@@ -41,29 +41,29 @@ public class ModItems {
// Armor // Armor
public static final RegistrySupplier<Item> NUGGET_HELMET = ITEMS.register("nugget_helmet", public static final RegistrySupplier<Item> NUGGET_HELMET = ITEMS.register("nugget_helmet",
() -> new Item(createSettings("nugget_helmet").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.HELMET))); () -> new Item(createSettings("nugget_helmet").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.HELMET)));
public static final RegistrySupplier<Item> NUGGET_CHESTPLATE = ITEMS.register("nugget_chestplate", public static final RegistrySupplier<Item> NUGGET_CHESTPLATE = ITEMS.register("nugget_chestplate",
() -> new Item(createSettings("nugget_chestplate").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.CHESTPLATE))); () -> new Item(createSettings("nugget_chestplate").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.CHESTPLATE)));
public static final RegistrySupplier<Item> NUGGET_LEGGINGS = ITEMS.register("nugget_leggings", public static final RegistrySupplier<Item> NUGGET_LEGGINGS = ITEMS.register("nugget_leggings",
() -> new Item(createSettings("nugget_leggings").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.LEGGINGS))); () -> new Item(createSettings("nugget_leggings").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.LEGGINGS)));
public static final RegistrySupplier<Item> NUGGET_BOOTS = ITEMS.register("nugget_boots", public static final RegistrySupplier<Item> NUGGET_BOOTS = ITEMS.register("nugget_boots",
() -> new Item(createSettings("nugget_boots").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.BOOTS))); () -> new Item(createSettings("nugget_boots").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.BOOTS)));
public static final RegistrySupplier<Item> NUGGET_HORSE_ARMOR = ITEMS.register("nugget_horse_armor", public static final RegistrySupplier<Item> NUGGET_HORSE_ARMOR = ITEMS.register("nugget_horse_armor",
() -> new Item(createSettings("nugget_horse_armor").horseArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL))); () -> new Item(createSettings("nugget_horse_armor").horseArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL)));
// Special Items // Special Items
public static final RegistrySupplier<Item> NUGGET_SMITHING_TEMPLATE = ITEMS.register("nugget_armor_trim_smithing_template", public static final RegistrySupplier<Item> NUGGET_SMITHING_TEMPLATE = ITEMS.register("nugget_armor_trim_smithing_template",
() -> SmithingTemplateItem.of(createSettings("nugget_armor_trim_smithing_template"))); () -> SmithingTemplateItem.createArmorTrimTemplate(createSettings("nugget_armor_trim_smithing_template").stacksTo(1)));
public static final RegistrySupplier<Item> NUGGET_MUSIC_DISC = ITEMS.register("nugget_music_disc", public static final RegistrySupplier<Item> NUGGET_MUSIC_DISC = ITEMS.register("nugget_music_disc",
() -> new Item(createSettings("nugget_music_disc").jukeboxPlayable(ModSounds.NUGGET_THEME_KEY).maxCount(1))); () -> new Item(createSettings("nugget_music_disc").jukeboxPlayable(ModSounds.NUGGET_THEME_KEY)));
private static Item.Settings createSettings(String name) { private static Item.Properties createSettings(String name) {
return new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name))); return new Item.Properties().setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)));
} }
public static void init() { public static void init() {

View File

@@ -1,7 +1,7 @@
package dev.sillyangel.nuggetmod.item; package dev.sillyangel.nuggetmod.item;
import dev.sillyangel.nuggetmod.util.ModTags; import dev.sillyangel.nuggetmod.util.ModTags;
import net.minecraft.item.ToolMaterial; import net.minecraft.world.item.ToolMaterial;
public class ModToolMaterials { public class ModToolMaterials {
public static final ToolMaterial NUGGET = new ToolMaterial( public static final ToolMaterial NUGGET = new ToolMaterial(

View File

@@ -0,0 +1,46 @@
package dev.sillyangel.nuggetmod.particle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.SingleQuadParticle;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.util.RandomSource;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleProvider;
import org.jetbrains.annotations.Nullable;
public class NuggetParticle extends SingleQuadParticle {
protected NuggetParticle(ClientLevel level, double x, double y, double z, SpriteSet spriteSet,
double xSpeed, double ySpeed, double zSpeed) {
super(level, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet.get(RandomSource.create()));
this.gravity = 0.8f;
this.lifetime = 80;
this.rCol = 1f;
this.gCol = 1f;
this.bCol = 1f;
}
@Override
protected Layer getLayer() {
return Layer.TRANSLUCENT;
}
public static class Factory implements ParticleProvider<SimpleParticleType> {
private final SpriteSet spriteSet;
public Factory(SpriteSet spriteSet) {
this.spriteSet = spriteSet;
}
@Nullable
@Override
public Particle createParticle(SimpleParticleType simpleParticleType, ClientLevel clientLevel,
double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed, RandomSource randomSource) {
return new NuggetParticle(clientLevel, pX, pY, pZ, this.spriteSet, pXSpeed, pYSpeed, pZSpeed);
}
}
}

View File

@@ -3,20 +3,20 @@ package dev.sillyangel.nuggetmod.sound;
import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier; import dev.architectury.registry.registries.RegistrySupplier;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.block.jukebox.JukeboxSong; import net.minecraft.world.item.JukeboxSong;
import net.minecraft.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.registries.Registries;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Identifier; import net.minecraft.resources.Identifier;
public class ModSounds { public class ModSounds {
public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.SOUND_EVENT); public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.SOUND_EVENT);
public static final RegistrySupplier<SoundEvent> NUGGET_THEME = SOUND_EVENTS.register("nugget_theme", public static final RegistrySupplier<SoundEvent> NUGGET_THEME = SOUND_EVENTS.register("nugget_theme",
() -> SoundEvent.of(Identifier.of(NuggetMod.MOD_ID, "nugget_theme"))); () -> SoundEvent.createVariableRangeEvent(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_theme")));
public static final RegistryKey<JukeboxSong> NUGGET_THEME_KEY = public static final ResourceKey<JukeboxSong> NUGGET_THEME_KEY =
RegistryKey.of(RegistryKeys.JUKEBOX_SONG, Identifier.of(NuggetMod.MOD_ID, "nugget_theme")); ResourceKey.create(Registries.JUKEBOX_SONG, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_theme"));
public static void init() { public static void init() {
SOUND_EVENTS.register(); SOUND_EVENTS.register();

View File

@@ -1,37 +1,35 @@
package dev.sillyangel.nuggetmod.trim; package dev.sillyangel.nuggetmod.trim;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModArmorMaterials;
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; import net.minecraft.util.Util;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.equipment.trim.MaterialAssetGroup;
import net.minecraft.world.item.equipment.trim.TrimMaterial;
import java.util.Map;
public class ModTrimMaterials { 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) { public static final ResourceKey<TrimMaterial> NUGGET =
register(registerable, NUGGET, Registries.ITEM.getEntry(ModItems.NUGGET.get()), ResourceKey.create(Registries.TRIM_MATERIAL, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget"));
Style.EMPTY.withColor(TextColor.parse("#f9b042").getOrThrow()));
public static void bootstrap(BootstrapContext<TrimMaterial> context) {
register(context, NUGGET, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget"), Style.EMPTY.withColor(TextColor.parseColor("#f9b042").getOrThrow()));
} }
private static void register(Registerable<ArmorTrimMaterial> registerable, RegistryKey<ArmorTrimMaterial> armorTrimKey, private static void register(BootstrapContext<TrimMaterial> context, ResourceKey<TrimMaterial> trimKey,
RegistryEntry<Item> item, Style style) { Identifier assetId, Style style) {
ArmorTrimMaterial trimMaterial = new ArmorTrimMaterial(ArmorTrimAssets.of("nugget"), MaterialAssetGroup.AssetInfo assetInfo = new MaterialAssetGroup.AssetInfo(assetId.getPath());
Text.translatable(Util.createTranslationKey("trim_material", armorTrimKey.getValue())).fillStyle(style)); TrimMaterial trimmaterial = new TrimMaterial(
new MaterialAssetGroup(assetInfo, Map.of(ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, assetInfo)),
registerable.register(armorTrimKey, trimMaterial); Component.translatable(Util.makeDescriptionId("trim_material", assetId)).withStyle(style));
context.register(trimKey, trimmaterial);
} }
} }

View File

@@ -1,28 +1,28 @@
package dev.sillyangel.nuggetmod.trim; package dev.sillyangel.nuggetmod.trim;
import net.minecraft.world.item.equipment.trim.TrimPattern;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.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; import net.minecraft.util.Util;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.Item;
public class ModTrimPatterns { public class ModTrimPatterns {
public static final RegistryKey<ArmorTrimPattern> NUGGET = RegistryKey.of(RegistryKeys.TRIM_PATTERN, private static final Identifier NUGGET_LOCATION = Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget");
Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static void bootstrap(Registerable<ArmorTrimPattern> context) { public static final ResourceKey<TrimPattern> NUGGET = ResourceKey.create(Registries.TRIM_PATTERN, NUGGET_LOCATION);
register(context, ModItems.NUGGET_SMITHING_TEMPLATE.get(), NUGGET);
public static void bootstrap(BootstrapContext<TrimPattern> context) {
register(context, ModItems.NUGGET_SMITHING_TEMPLATE.get(), NUGGET, NUGGET_LOCATION);
} }
private static void register(Registerable<ArmorTrimPattern> context, Item item, RegistryKey<ArmorTrimPattern> key) { private static void register(BootstrapContext<TrimPattern> context, Item item, ResourceKey<TrimPattern> key, Identifier assetId) {
ArmorTrimPattern trimPattern = new ArmorTrimPattern(key.getValue(), TrimPattern trimPattern = new TrimPattern(assetId,
Text.translatable(Util.createTranslationKey("trim_pattern", key.getValue())), false); Component.translatable(Util.makeDescriptionId("trim_pattern", assetId)), false);
context.register(key, trimPattern); context.register(key, trimPattern);
} }
} }

View File

@@ -1,11 +1,11 @@
package dev.sillyangel.nuggetmod.util; package dev.sillyangel.nuggetmod.util;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.block.Block; import net.minecraft.resources.Identifier;
import net.minecraft.item.Item; import net.minecraft.world.level.block.Block;
import net.minecraft.registry.RegistryKeys; import net.minecraft.world.item.Item;
import net.minecraft.registry.tag.TagKey; import net.minecraft.core.registries.Registries;
import net.minecraft.util.Identifier; import net.minecraft.tags.TagKey;
public class ModTags { public class ModTags {
public static class Blocks { public static class Blocks {
@@ -13,7 +13,7 @@ public class ModTags {
public static final TagKey<Block> INCORRECT_FOR_NUGGET_TOOL = createTag("incorrect_for_nugget_tool"); public static final TagKey<Block> INCORRECT_FOR_NUGGET_TOOL = createTag("incorrect_for_nugget_tool");
private static TagKey<Block> createTag(String name) { private static TagKey<Block> createTag(String name) {
return TagKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name)); return TagKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
} }
} }
@@ -22,7 +22,7 @@ public class ModTags {
public static final TagKey<Item> REPAIRS_NUGGET_ARMOR = createTag("repairs_nugget_armor"); public static final TagKey<Item> REPAIRS_NUGGET_ARMOR = createTag("repairs_nugget_armor");
private static TagKey<Item> createTag(String name) { private static TagKey<Item> createTag(String name) {
return TagKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)); return TagKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
} }
} }
} }

View File

@@ -1,42 +1,44 @@
package dev.sillyangel.nuggetmod.worldgen; package dev.sillyangel.nuggetmod.worldgen;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
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.RuleTest;
import net.minecraft.structure.rule.TagMatchRuleTest;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import java.util.List; import java.util.List;
public class ModConfiguredFeatures { public class ModConfiguredFeatures {
public static final RegistryKey<ConfiguredFeature<?, ?>> NUGGET_ORE_KEY = registerKey("nugget_ore");
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) { public static final ResourceKey<ConfiguredFeature<?, ?>> OVERWORLD_NUGGET_ORE_KEY = registerKey("nugget_ore");
RuleTest stoneReplaceables = new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES);
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
List<OreFeatureConfig.Target> overworldNuggetOres =
List.of(OreFeatureConfig.createTarget(stoneReplaceables, ModBlocks.NUGGET_ORE.get().getDefaultState()),
OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.NUGGET_DEEPSLATE_ORE.get().getDefaultState()));
register(context, NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldNuggetOres, 12)); public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
RuleTest stoneReplaceables = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
RuleTest deepslateReplaceables = new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
List<OreConfiguration.TargetBlockState> overworldNuggetOres = List.of(
OreConfiguration.target(stoneReplaceables, ModBlocks.NUGGET_ORE.get().defaultBlockState()),
OreConfiguration.target(deepslateReplaceables, ModBlocks.NUGGET_DEEPSLATE_ORE.get().defaultBlockState()));
register(context, OVERWORLD_NUGGET_ORE_KEY, Feature.ORE, new OreConfiguration(overworldNuggetOres, 9));
} }
public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) { public static ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name)); return ResourceKey.create(Registries.CONFIGURED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
} }
private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context, private static <FC extends FeatureConfiguration, F extends Feature<FC>> void register(BootstrapContext<ConfiguredFeature<?, ?>> context,
RegistryKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) { ResourceKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
context.register(key, new ConfiguredFeature<>(feature, configuration)); context.register(key, new ConfiguredFeature<>(feature, configuration));
} }
} }

View File

@@ -1,19 +1,19 @@
package dev.sillyangel.nuggetmod.worldgen; package dev.sillyangel.nuggetmod.worldgen;
import net.minecraft.world.gen.placementmodifier.*; import net.minecraft.world.level.levelgen.placement.*;
import java.util.List; import java.util.List;
public class ModOrePlacement { public class ModOrePlacement {
public static List<PlacementModifier> modifiers(PlacementModifier countModifier, PlacementModifier heightModifier) { public static List<PlacementModifier> orePlacement(PlacementModifier pCountPlacement, PlacementModifier pHeightRange) {
return List.of(countModifier, SquarePlacementModifier.of(), heightModifier, BiomePlacementModifier.of()); return List.of(pCountPlacement, InSquarePlacement.spread(), pHeightRange, BiomeFilter.biome());
} }
public static List<PlacementModifier> modifiersWithCount(int count, PlacementModifier heightModifier) { public static List<PlacementModifier> commonOrePlacement(int pCount, PlacementModifier pHeightRange) {
return modifiers(CountPlacementModifier.of(count), heightModifier); return orePlacement(CountPlacement.of(pCount), pHeightRange);
} }
public static List<PlacementModifier> modifiersWithRarity(int chance, PlacementModifier heightModifier) { public static List<PlacementModifier> rareOrePlacement(int pChance, PlacementModifier pHeightRange) {
return modifiers(RarityFilterPlacementModifier.of(chance), heightModifier); return orePlacement(RarityFilter.onAverageOnceEvery(pChance), pHeightRange);
} }
} }

View File

@@ -1,53 +1,38 @@
package dev.sillyangel.nuggetmod.worldgen; package dev.sillyangel.nuggetmod.worldgen;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.registry.Registerable; import net.minecraft.core.Holder;
import net.minecraft.registry.RegistryKey; import net.minecraft.core.registries.Registries;
import net.minecraft.registry.RegistryKeys; import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.resources.ResourceKey;
import net.minecraft.util.Identifier; import net.minecraft.resources.Identifier;
import net.minecraft.world.gen.YOffset; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.placement.PlacementModifier;
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; import java.util.List;
public class ModPlacedFeatures { 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) { public static final ResourceKey<PlacedFeature> NUGGET_ORE_PLACED_KEY = registerKey("nugget_ore_placed");
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 void bootstrap(BootstrapContext<PlacedFeature> context) {
var configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
register(context, NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_NUGGET_ORE_KEY),
ModOrePlacement.commonOrePlacement(12,
HeightRangePlacement.uniform(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80))));
} }
public static RegistryKey<PlacedFeature> registerKey(String name) { private static ResourceKey<PlacedFeature> registerKey(String name) {
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name)); return ResourceKey.create(Registries.PLACED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
} }
private static void register(Registerable<PlacedFeature> context, RegistryKey<PlacedFeature> key, RegistryEntry<ConfiguredFeature<?, ?>> configuration, private static void register(BootstrapContext<PlacedFeature> context, ResourceKey<PlacedFeature> key, Holder<ConfiguredFeature<?, ?>> configuration,
List<PlacementModifier> modifiers) { List<PlacementModifier> modifiers) {
context.register(key, new PlacedFeature(configuration, List.copyOf(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

@@ -38,13 +38,13 @@
"item.nuggetmod.nugget.tooltip": "THE NUGGET", "item.nuggetmod.nugget.tooltip": "THE NUGGET",
"entity.minecraft.villager.nuggeter": "Nuggeter",
"trim_material.nuggetmod.nugget": "Nugget Material", "trim_material.nuggetmod.nugget": "Nugget Material",
"trim_pattern.nuggetmod.nugget_trim_material": "Nugget Trim", "trim_pattern.nuggetmod.nugget_trim_material": "Nugget Trim",
"trim_pattern.nuggetmod.nugget_armor_trim_smithing_template": "§6Nugget Armor Trim", "trim_pattern.nuggetmod.nugget_armor_trim_smithing_template": "§6Nugget Armor Trim",
"trim_pattern.nuggetmod.nugget": "Nugget Trim", "trim_pattern.nuggetmod.nugget": "Nugget Trim",
"painting.nuggetmod.nugget_painting.title": "Nugget Painting", "painting.nuggetmod.nugget_painting.title": "Nugget Painting",
"painting.nuggetmod.nugget_painting.author": "Nugget Mod" "painting.nuggetmod.nugget_painting.author": "Nugget Mod",
"entity.nuggetmod.villager.nuggeter": "Nuggeter"
} }

View File

@@ -34,5 +34,15 @@
"trim_pattern.nuggetmod.nugget": "Adorno de Nuggets", "trim_pattern.nuggetmod.nugget": "Adorno de Nuggets",
"painting.nuggetmod.nugget_painting.title": "Pintura de Nuggets", "painting.nuggetmod.nugget_painting.title": "Pintura de Nuggets",
"painting.nuggetmod.nugget_painting.author": "Mod de Nuggets" "painting.nuggetmod.nugget_painting.author": "Mod de Nuggets",
"item.nuggetmod.nugget_bow": "Arco de Nuggets",
"item.nuggetmod.nugget_crossbow": "Ballesta de Nuggets",
"item.nuggetmod.nugget_trident": "Tridente de Nuggets",
"item.nuggetmod.nugget_fishing_rod": "Caña de Pescar de Nuggets",
"item.nuggetmod.nugget_flint_and_steel": "Pedernal y Acero de Nuggets",
"item.nuggetmod.nugget_shears": "Tijeras de Nuggets",
"item.nuggetmod.nugget_shield": "Escudo de Nuggets",
"item.nuggetmod.nugget_spear": "Lanza de Nuggets",
"entity.nuggetmod.villager.nuggeter": "Nuggeter",
"trim_pattern.nuggetmod.nugget_armor_trim_smithing_template": "§6Adorno de Armadura de Nuggets",
} }

View File

@@ -18,40 +18,52 @@ configurations {
// Files in this configuration will be bundled into your mod using the Shadow plugin. // Files in this configuration will be bundled into your mod using the Shadow plugin.
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
shadowBundle { shadowCommon {
canBeResolved = true canBeResolved = true
canBeConsumed = false canBeConsumed = false
} }
apiElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
runtimeElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
} }
dependencies { dependencies {
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" api "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version" api "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
// Architectury API. This is optional, and you can comment it out if you don't need it. // Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version" api "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
common(project(path: ':common', configuration: 'namedElements')) { transitive = false } common(project(path: ':common')) { transitive = false }
shadowBundle project(path: ':common', configuration: 'transformProductionFabric') shadowCommon project(path: ':common', configuration: 'transformProductionFabric')
} }
processResources { processResources {
inputs.property 'version', project.version inputs.property "version", project.version
filesMatching('fabric.mod.json') { filesMatching("fabric.mod.json") {
expand version: inputs.properties.version expand "version": inputs.properties.version
} }
} }
shadowJar { jar {
configurations = [project.configurations.shadowBundle] archiveClassifier = "raw"
archiveClassifier = 'dev-shadow'
} }
remapJar { shadowJar {
inputFile.set shadowJar.archiveFile dependsOn(jar)
from(zipTree(jar.archiveFile))
configurations = [project.configurations.shadowCommon]
archiveClassifier = null
from rootProject.file("LICENSE.md")
} }
fabricApi { fabricApi {

View File

@@ -1,6 +1,6 @@
package dev.sillyangel.nuggetmod.fabric; package dev.sillyangel.nuggetmod.fabric;
import dev.sillyangel.nuggetmod.fabric.item.ModItemGroups; //import dev.sillyangel.nuggetmod.fabric.item.ModItemGroups;
import dev.sillyangel.nuggetmod.fabric.particle.ModParticles; import dev.sillyangel.nuggetmod.fabric.particle.ModParticles;
import dev.sillyangel.nuggetmod.fabric.villager.ModVillagers; import dev.sillyangel.nuggetmod.fabric.villager.ModVillagers;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
@@ -9,15 +9,15 @@ import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.fabric.world.ModWorldGeneration; import dev.sillyangel.nuggetmod.fabric.world.ModWorldGeneration;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.ItemGroups; import net.minecraft.network.chat.Component;
import net.minecraft.text.Text; import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradedItem;
import net.minecraft.village.VillagerProfession;
import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.item.Items; import net.minecraft.world.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.world.item.Items;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.trading.ItemCost;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ public class NuggetMod implements ModInitializer {
dev.sillyangel.nuggetmod.NuggetMod.init(); dev.sillyangel.nuggetmod.NuggetMod.init();
// Fabric-specific registrations // Fabric-specific registrations
ModItemGroups.registerItemGroups(); // ModItemGroups.registerItemGroups();
ModWorldGeneration.generateModWorldGen(); ModWorldGeneration.generateModWorldGen();
// IMPORTANT: Register villagers before trades // IMPORTANT: Register villagers before trades
@@ -43,20 +43,20 @@ public class NuggetMod implements ModInitializer {
// Register tooltip for nugget item using Fabric API // Register tooltip for nugget item using Fabric API
ItemTooltipCallback.EVENT.register((itemStack, tooltipContext, tooltipType, list) -> { ItemTooltipCallback.EVENT.register((itemStack, tooltipContext, tooltipType, list) -> {
if (itemStack.isOf(ModItems.NUGGET.get())) { if (itemStack.is(ModItems.NUGGET.get())) {
list.add(Text.translatable("item.nuggetmod.nugget.tooltip")); list.add(Component.translatable("item.nuggetmod.nugget.tooltip"));
} }
}); });
// Add items to vanilla creative tabs // Add items to vanilla creative tabs
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> { ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(entries -> {
entries.add(ModItems.NUGGET.get()); entries.accept(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get()); entries.accept(ModItems.RAW_NUGGET.get());
}); });
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> { ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(entries -> {
entries.add(ModBlocks.NUGGET_BLOCK.get()); entries.accept(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get()); entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get());
}); });
// Register trades AFTER villager registration // Register trades AFTER villager registration
@@ -68,80 +68,80 @@ public class NuggetMod implements ModInitializer {
// Villager trades - Vanilla Farmer // Villager trades - Vanilla Farmer
TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 1, factories -> { TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 1, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 3), new ItemCost(Items.EMERALD, 3),
new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f)); new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f));
}); });
// Custom Nuggeter Villager Trades - Level 1 (Novice) // Custom Nuggeter Villager Trades - Level 1 (Novice)
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 1, factories -> { TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 1, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 5), new ItemCost(Items.EMERALD, 5),
new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f)); new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f));
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 2), new ItemCost(Items.DIAMOND, 2),
new ItemStack(ModItems.RAW_NUGGET.get(), 12), 6, 5, 0.05f)); new ItemStack(ModItems.RAW_NUGGET.get(), 12), 6, 5, 0.05f));
}); });
// Custom Nuggeter Villager Trades - Level 2 (Apprentice) // Custom Nuggeter Villager Trades - Level 2 (Apprentice)
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 2, factories -> { TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 2, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.GOLD_INGOT, 8), new ItemCost(Items.GOLD_INGOT, 8),
new ItemStack(ModItems.NUGGET_SWORD.get(), 1), 3, 10, 0.05f)); new ItemStack(ModItems.NUGGET_SWORD.get(), 1), 3, 10, 0.05f));
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 10), new ItemCost(Items.EMERALD, 10),
new ItemStack(ModItems.NUGGET_PICKAXE.get(), 1), 3, 10, 0.05f)); new ItemStack(ModItems.NUGGET_PICKAXE.get(), 1), 3, 10, 0.05f));
}); });
// Custom Nuggeter Villager Trades - Level 3 (Journeyman) // Custom Nuggeter Villager Trades - Level 3 (Journeyman)
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 3, factories -> { TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 3, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 15), new ItemCost(Items.EMERALD, 15),
new ItemStack(ModItems.NUGGET_HELMET.get(), 1), 2, 15, 0.05f)); new ItemStack(ModItems.NUGGET_HELMET.get(), 1), 2, 15, 0.05f));
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 20), new ItemCost(Items.EMERALD, 20),
new ItemStack(ModItems.NUGGET_CHESTPLATE.get(), 1), 2, 15, 0.05f)); new ItemStack(ModItems.NUGGET_CHESTPLATE.get(), 1), 2, 15, 0.05f));
}); });
// Custom Nuggeter Villager Trades - Level 4 (Expert) // Custom Nuggeter Villager Trades - Level 4 (Expert)
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 4, factories -> { TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 4, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 5), new ItemCost(Items.DIAMOND, 5),
new ItemStack(ModItems.NUGGET_LEGGINGS.get(), 1), 2, 20, 0.05f)); new ItemStack(ModItems.NUGGET_LEGGINGS.get(), 1), 2, 20, 0.05f));
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 12), new ItemCost(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET_BOOTS.get(), 1), 2, 20, 0.05f)); new ItemStack(ModItems.NUGGET_BOOTS.get(), 1), 2, 20, 0.05f));
}); });
// Custom Nuggeter Villager Trades - Level 5 (Master) // Custom Nuggeter Villager Trades - Level 5 (Master)
TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 5, factories -> { TradeOfferHelper.registerVillagerOffers(ModVillagers.NUGGETER_KEY, 5, factories -> {
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 30), new ItemCost(Items.EMERALD, 30),
new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 1, 30, 0.1f)); new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 1, 30, 0.1f));
factories.add((world,entity, random) -> new TradeOffer( factories.add((world,entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 10), new ItemCost(Items.DIAMOND, 10),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 30, 0.1f)); new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 30, 0.1f));
}); });
// Wandering Trader Trades // Wandering Trader Trades
TradeOfferHelper.registerWanderingTraderOffers(factories -> { TradeOfferHelper.registerWanderingTraderOffers(factories -> {
// Generic trades // Generic trades
factories.addAll(Identifier.of(NuggetMod.MOD_ID, "emerald_for_nugget"), (world, entity, random) -> new TradeOffer( factories.addAll(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "emerald_for_nugget"), (world, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 12), new ItemCost(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET.get(), 3), 2, 8, 0.2f)); new ItemStack(ModItems.NUGGET.get(), 3), 2, 8, 0.2f));
// Rare trades // Rare trades
factories.addAll(Identifier.of(NuggetMod.MOD_ID, "diamond_for_musicdisc"), (world, entity, random) -> new TradeOffer( factories.addAll(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "diamond_for_musicdisc"), (world, entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 8), new ItemCost(Items.DIAMOND, 8),
new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 1, 12, 0.2f)); new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 1, 12, 0.2f));
factories.addAll(Identifier.of(NuggetMod.MOD_ID, "emerald_for_smithingtemplate"), (world, entity, random) -> new TradeOffer( factories.addAll(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "emerald_for_smithingtemplate"), (world, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 25), new ItemCost(Items.EMERALD, 25),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 12, 0.2f)); new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 12, 0.2f));
}); });
} }

View File

@@ -5,10 +5,10 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import dev.sillyangel.nuggetmod.fabric.datagen.*; import dev.sillyangel.nuggetmod.fabric.datagen.*;
import dev.sillyangel.nuggetmod.trim.ModTrimMaterials; import dev.sillyangel.nuggetmod.trim.ModTrimMaterials;
import dev.sillyangel.nuggetmod.trim.ModTrimPatterns; import dev.sillyangel.nuggetmod.trim.ModTrimPatterns;
import net.minecraft.registry.RegistryBuilder; import net.minecraft.core.RegistrySetBuilder;
import dev.sillyangel.nuggetmod.worldgen.ModConfiguredFeatures; import dev.sillyangel.nuggetmod.worldgen.ModConfiguredFeatures;
import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures; import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.registries.Registries;
public class NuggetModDataGenerator implements DataGeneratorEntrypoint { public class NuggetModDataGenerator implements DataGeneratorEntrypoint {
@Override @Override
@@ -23,10 +23,10 @@ public class NuggetModDataGenerator implements DataGeneratorEntrypoint {
pack.addProvider(ModRegistryDataGenerator::new); pack.addProvider(ModRegistryDataGenerator::new);
} }
@Override @Override
public void buildRegistry(RegistryBuilder registryBuilder) { public void buildRegistry(RegistrySetBuilder registryBuilder) {
registryBuilder.addRegistry(RegistryKeys.TRIM_MATERIAL, ModTrimMaterials::bootstrap); registryBuilder.add(Registries.TRIM_MATERIAL, ModTrimMaterials::bootstrap);
registryBuilder.addRegistry(RegistryKeys.TRIM_PATTERN, ModTrimPatterns::bootstrap); registryBuilder.add(Registries.TRIM_PATTERN, ModTrimPatterns::bootstrap);
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap); registryBuilder.add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap);
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, ModPlacedFeatures::bootstrap); registryBuilder.add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap);
} }
} }

View File

@@ -1,9 +1,9 @@
package dev.sillyangel.nuggetmod.fabric.client; package dev.sillyangel.nuggetmod.fabric.client;
import dev.sillyangel.nuggetmod.fabric.particle.ModParticles; import dev.sillyangel.nuggetmod.fabric.particle.ModParticles;
import dev.sillyangel.nuggetmod.particle.NuggetParticle;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import dev.sillyangel.nuggetmod.fabric.particle.NuggetParticle;
public class NuggetModClient implements ClientModInitializer { public class NuggetModClient implements ClientModInitializer {
@Override @Override

View File

@@ -4,19 +4,19 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.util.ModTags; import dev.sillyangel.nuggetmod.util.ModTags;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.core.HolderLookup;
import net.minecraft.registry.tag.BlockTags; import net.minecraft.tags.BlockTags;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider { public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) { protected void addTags(HolderLookup.Provider wrapperLookup) {
valueLookupBuilder(BlockTags.PICKAXE_MINEABLE) valueLookupBuilder(BlockTags.MINEABLE_WITH_PICKAXE)
.add(ModBlocks.NUGGET_BLOCK.get()) .add(ModBlocks.NUGGET_BLOCK.get())
.add(ModBlocks.RAW_NUGGET_BLOCK.get()) .add(ModBlocks.RAW_NUGGET_BLOCK.get())
.add(ModBlocks.NUGGET_ORE.get()) .add(ModBlocks.NUGGET_ORE.get())

View File

@@ -3,18 +3,18 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.core.HolderLookup;
import net.minecraft.registry.tag.ItemTags; import net.minecraft.tags.ItemTags;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider { public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider {
public ModItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) { public ModItemTagProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> completableFuture) {
super(output, completableFuture); super(output, completableFuture);
} }
@Override @Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) { protected void addTags(HolderLookup.Provider wrapperLookup) {
valueLookupBuilder(ItemTags.SWORDS) valueLookupBuilder(ItemTags.SWORDS)
.add(ModItems.NUGGET_SWORD.get()); .add(ModItems.NUGGET_SWORD.get());
valueLookupBuilder(ItemTags.PICKAXES) valueLookupBuilder(ItemTags.PICKAXES)

View File

@@ -4,40 +4,40 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.block.Block; import net.minecraft.core.HolderLookup;
import net.minecraft.enchantment.Enchantment; import net.minecraft.core.registries.Registries;
import net.minecraft.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.item.Item; import net.minecraft.world.level.block.Block;
import net.minecraft.loot.LootTable; import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.world.item.Item;
import net.minecraft.loot.entry.LeafEntry; import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.loot.function.ApplyBonusLootFunction; import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.loot.function.SetCountLootFunction; import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer;
import net.minecraft.loot.provider.number.UniformLootNumberProvider; import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.registry.RegistryKeys; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class ModLootTableProvider extends FabricBlockLootTableProvider { public class ModLootTableProvider extends FabricBlockLootTableProvider {
public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) { public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
super(dataOutput, registryLookup); super(dataOutput, registryLookup);
} }
@Override @Override
public void generate() { public void generate() {
addDrop(ModBlocks.NUGGET_BLOCK.get()); dropSelf(ModBlocks.NUGGET_BLOCK.get());
addDrop(ModBlocks.RAW_NUGGET_BLOCK.get()); dropSelf(ModBlocks.RAW_NUGGET_BLOCK.get());
addDrop(ModBlocks.NUGGET_ORE.get(), oreDrops(ModBlocks.NUGGET_ORE.get(), ModItems.RAW_NUGGET.get())); add(ModBlocks.NUGGET_ORE.get(), createOreDrop(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)); add(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) { public LootTable.Builder multipleOreDrops(Block drop, Item item, float minDrops, float maxDrops) {
RegistryWrapper.Impl<Enchantment> impl = this.registries.getOrThrow(RegistryKeys.ENCHANTMENT); HolderLookup.RegistryLookup<Enchantment> impl = this.registries.lookupOrThrow(Registries.ENCHANTMENT);
return this.dropsWithSilkTouch(drop, this.applyExplosionDecay(drop, ((LeafEntry.Builder<?>) return this.createSilkTouchDispatchTable(drop, this.applyExplosionDecay(drop, ((LootPoolSingletonContainer.Builder<?>)
ItemEntry.builder(item).apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(minDrops, maxDrops)))) LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(UniformGenerator.between(minDrops, maxDrops))))
.apply(ApplyBonusLootFunction.oreDrops(impl.getOrThrow(Enchantments.FORTUNE))))); .apply(ApplyBonusCount.addOreBonusCount(impl.getOrThrow(Enchantments.FORTUNE)))));
} }
} }

View File

@@ -5,7 +5,10 @@ import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.client.data.*; import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.ModelProvider;
import net.minecraft.client.data.models.model.ModelTemplates;
public class ModModelProvider extends FabricModelProvider { public class ModModelProvider extends FabricModelProvider {
public ModModelProvider(FabricDataOutput output) { public ModModelProvider(FabricDataOutput output) {
@@ -13,36 +16,37 @@ public class ModModelProvider extends FabricModelProvider {
} }
// Blocks are generated here // Blocks are generated here
@Override @Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_BLOCK.get()); blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.RAW_NUGGET_BLOCK.get()); blockStateModelGenerator.createTrivialCube(ModBlocks.RAW_NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_ORE.get()); blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_ORE.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
// blockStateModelGenerator.blockStateOutput.accept();
} }
// Items are generated here // Items are generated here
@Override @Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) { public void generateItemModels(ItemModelGenerators itemModelGenerator) {
itemModelGenerator.register(ModItems.NUGGET.get(), Models.GENERATED); itemModelGenerator.generateFlatItem(ModItems.NUGGET.get(), ModelTemplates.FLAT_ITEM);
itemModelGenerator.register(ModItems.RAW_NUGGET.get(), Models.GENERATED); itemModelGenerator.generateFlatItem(ModItems.RAW_NUGGET.get(), ModelTemplates.FLAT_ITEM);
itemModelGenerator.register(ModItems.NUGGET_SWORD.get(), Models.HANDHELD); itemModelGenerator.generateFlatItem(ModItems.NUGGET_SWORD.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_PICKAXE.get(), Models.HANDHELD); itemModelGenerator.generateFlatItem(ModItems.NUGGET_PICKAXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_SHOVEL.get(), Models.HANDHELD); itemModelGenerator.generateFlatItem(ModItems.NUGGET_SHOVEL.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_AXE.get(), Models.HANDHELD); itemModelGenerator.generateFlatItem(ModItems.NUGGET_AXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_HOE.get(), Models.HANDHELD); itemModelGenerator.generateFlatItem(ModItems.NUGGET_HOE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_SPEAR.get(), Models.SPEAR_IN_HAND); itemModelGenerator.generateSpear(ModItems.NUGGET_SPEAR.get());
itemModelGenerator.registerArmor(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.HELMET_TRIM_ID_PREFIX, false); itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_HELMET, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.CHESTPLATE_TRIM_ID_PREFIX, false); itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_CHESTPLATE, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.LEGGINGS_TRIM_ID_PREFIX, false); itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_LEGGINGS, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.BOOTS_TRIM_ID_PREFIX, false); itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_BOOTS, false);
itemModelGenerator.register(ModItems.NUGGET_HORSE_ARMOR.get(), Models.GENERATED); itemModelGenerator.generateFlatItem(ModItems.NUGGET_HORSE_ARMOR.get(), ModelTemplates.FLAT_ITEM);
itemModelGenerator.register(ModItems.NUGGET_SMITHING_TEMPLATE.get(), Models.GENERATED); itemModelGenerator.generateFlatItem(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModelTemplates.FLAT_ITEM);
itemModelGenerator.register(ModItems.NUGGET_MUSIC_DISC.get(), Models.GENERATED); itemModelGenerator.generateFlatItem(ModItems.NUGGET_MUSIC_DISC.get(), ModelTemplates.MUSIC_DISC);
} }
} }

View File

@@ -2,143 +2,154 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.item.Items; import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.Items;
import dev.sillyangel.nuggetmod.fabric.NuggetMod; import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.trim.ModTrimPatterns; import dev.sillyangel.nuggetmod.trim.ModTrimPatterns;
import net.minecraft.data.recipe.RecipeExporter; import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipe.RecipeGenerator; import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.item.ItemConvertible; import net.minecraft.world.level.ItemLike;
import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.registry.RegistryKey; import net.minecraft.resources.Identifier;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.Identifier;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class ModRecipeProvider extends FabricRecipeProvider { public class ModRecipeProvider extends FabricRecipeProvider {
public ModRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { public ModRecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { protected RecipeProvider createRecipeProvider(HolderLookup.Provider wrapperLookup, RecipeOutput recipeExporter) {
return new RecipeGenerator(wrapperLookup, recipeExporter) { return new RecipeProvider(wrapperLookup, recipeExporter) {
@Override @Override
public void generate() { public void buildRecipes() {
List<ItemConvertible> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(), List<ItemLike> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(),
ModBlocks.NUGGET_DEEPSLATE_ORE.get()); ModBlocks.NUGGET_DEEPSLATE_ORE.get());
offerSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget"); oreSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
offerBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget"); oreBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
offerReversibleCompactingRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET.get(), RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK.get()); nineBlockStorageRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET.get(), RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK.get());
// RAW_NUGGET_BLOCK // RAW_NUGGET_BLOCK
createShaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get()) shaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
.pattern("RRR") .pattern("RRR")
.pattern("RRR") .pattern("RRR")
.pattern("RRR") .pattern("RRR")
.input('R', ModItems.RAW_NUGGET.get()) .define('R', ModItems.RAW_NUGGET.get())
.criterion(hasItem(ModItems.RAW_NUGGET.get()), conditionsFromItem(ModItems.RAW_NUGGET.get())) .unlockedBy(getHasName(ModItems.RAW_NUGGET.get()), has(ModItems.RAW_NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9) shapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.input(ModBlocks.RAW_NUGGET_BLOCK.get()) .requires(ModBlocks.RAW_NUGGET_BLOCK.get())
.criterion(hasItem(ModBlocks.RAW_NUGGET_BLOCK.get()), conditionsFromItem(ModBlocks.RAW_NUGGET_BLOCK.get())) .unlockedBy(getHasName(ModBlocks.RAW_NUGGET_BLOCK.get()), has(ModBlocks.RAW_NUGGET_BLOCK.get()))
.offerTo(exporter); .save(recipeExporter);
// cake is a lie
shaped(RecipeCategory.FOOD, ModBlocks.NUGGET_CAKE.get())
.pattern("MMM")
.pattern("SES")
.pattern("WWW")
.define('M', ModBlocks.NUGGET_BLOCK.get())
.define('S', Items.SUGAR)
.define('E', ModItems.RAW_NUGGET.get())
.define('W', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(output);
// TOOLS // TOOLS
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get())
.pattern(" N ") .pattern(" N ")
.pattern(" N ") .pattern(" N ")
.pattern(" S ") .pattern(" S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get()) shaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get())
.pattern("NNN") .pattern("NNN")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get()) shaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get())
.pattern(" NN") .pattern(" NN")
.pattern(" SN") .pattern(" SN")
.pattern(" S ") .pattern(" S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get()) shaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get())
.pattern(" N ") .pattern(" N ")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get()) shaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get())
.pattern(" NN") .pattern(" NN")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get())
.pattern(" N") .pattern(" N")
.pattern(" S ") .pattern(" S ")
.pattern("S ") .pattern("S ")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.input('S', Items.STICK) .define('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
// ARMOR // ARMOR
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get())
.pattern("NNN") .pattern("NNN")
.pattern("N N") .pattern("N N")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get())
.pattern("N N") .pattern("N N")
.pattern("NNN") .pattern("NNN")
.pattern("NNN") .pattern("NNN")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get())
.pattern("NNN") .pattern("NNN")
.pattern("N N") .pattern("N N")
.pattern("N N") .pattern("N N")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get()) shaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get())
.pattern("N N") .pattern("N N")
.pattern("N N") .pattern("N N")
.input('N', ModItems.NUGGET.get()) .define('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get())) .unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.offerTo(exporter); .save(recipeExporter);
offerSmithingTrimRecipe(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET, trimSmithing(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET,
RegistryKey.of(RegistryKeys.RECIPE, Identifier.of(NuggetMod.MOD_ID, "nugget_smithing_template"))); ResourceKey.create(Registries.RECIPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_smithing_template")));
} }
}; };
} }

View File

@@ -2,22 +2,22 @@ package dev.sillyangel.nuggetmod.fabric.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.HolderLookup;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.core.registries.Registries;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class ModRegistryDataGenerator extends FabricDynamicRegistryProvider { public class ModRegistryDataGenerator extends FabricDynamicRegistryProvider {
public ModRegistryDataGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { public ModRegistryDataGenerator(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { protected void configure(HolderLookup.Provider registries, Entries entries) {
entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_MATERIAL)); entries.addAll(registries.lookupOrThrow(Registries.TRIM_MATERIAL));
entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_PATTERN)); entries.addAll(registries.lookupOrThrow(Registries.TRIM_PATTERN));
entries.addAll(registries.getOrThrow(RegistryKeys.CONFIGURED_FEATURE)); entries.addAll(registries.lookupOrThrow(Registries.CONFIGURED_FEATURE));
entries.addAll(registries.getOrThrow(RegistryKeys.PLACED_FEATURE)); entries.addAll(registries.lookupOrThrow(Registries.PLACED_FEATURE));
} }
@Override @Override

View File

@@ -1,59 +1,59 @@
package dev.sillyangel.nuggetmod.fabric.item; //package dev.sillyangel.nuggetmod.fabric.item;
//
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; //import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.block.ModBlocks; //import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.item.ModItems; //import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.fabric.NuggetMod; //import net.minecraft.core.Registry;
import net.minecraft.item.ItemGroup; //import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.item.ItemStack; //import net.minecraft.world.item.ItemStack;
import net.minecraft.registry.Registries; //import net.minecraft.network.chat.Component;
import net.minecraft.registry.Registry; //import net.minecraft.resources.Identifier;
import net.minecraft.text.Text; //import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.util.Identifier; ////import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
//
public class ModItemGroups { //public class ModItemGroups {
//
public static final ItemGroup NUGGET_BLOCKS_GROUP = Registry.register(Registries.ITEM_GROUP, // public static final CreativeModeTab NUGGET_BLOCKS_GROUP = Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,
Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"), // Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_blocks"),
FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get())) // FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks")) // .title(Component.translatable("creativetab.nuggetmod.nugget_blocks"))
.entries((displayContext, entries) -> { // .displayItems((displayContext, entries) -> {
entries.add(ModBlocks.NUGGET_BLOCK.get()); // entries.accept(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get()); // entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.add(ModBlocks.NUGGET_ORE.get()); // entries.accept(ModBlocks.NUGGET_ORE.get());
entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); // entries.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build()); // }).build());
//
public static final ItemGroup NUGGET_ITEMS_GROUP = Registry.register(Registries.ITEM_GROUP, // public static final CreativeModeTab NUGGET_ITEMS_GROUP = Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB,
Identifier.of(NuggetMod.MOD_ID, "nugget_items"), // Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_items"),
FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET.get())) // FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_items")) // .title(Component.translatable("creativetab.nuggetmod.nugget_items"))
.entries((displayContext, entries) -> { // .displayItems((displayContext, entries) -> {
entries.add(ModItems.NUGGET.get()); // entries.accept(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get()); // entries.accept(ModItems.RAW_NUGGET.get());
//
// Tool Set // // Tool Set
entries.add(ModItems.NUGGET_SWORD.get()); // entries.accept(ModItems.NUGGET_SWORD.get());
entries.add(ModItems.NUGGET_PICKAXE.get()); // entries.accept(ModItems.NUGGET_PICKAXE.get());
entries.add(ModItems.NUGGET_AXE.get()); // entries.accept(ModItems.NUGGET_AXE.get());
entries.add(ModItems.NUGGET_SHOVEL.get()); // entries.accept(ModItems.NUGGET_SHOVEL.get());
entries.add(ModItems.NUGGET_HOE.get()); // entries.accept(ModItems.NUGGET_HOE.get());
entries.add(ModItems.NUGGET_SPEAR.get()); // entries.accept(ModItems.NUGGET_SPEAR.get());
//
// Armor // // Armor
entries.add(ModItems.NUGGET_HELMET.get()); // entries.accept(ModItems.NUGGET_HELMET.get());
entries.add(ModItems.NUGGET_CHESTPLATE.get()); // entries.accept(ModItems.NUGGET_CHESTPLATE.get());
entries.add(ModItems.NUGGET_LEGGINGS.get()); // entries.accept(ModItems.NUGGET_LEGGINGS.get());
entries.add(ModItems.NUGGET_BOOTS.get()); // entries.accept(ModItems.NUGGET_BOOTS.get());
//
entries.add(ModItems.NUGGET_HORSE_ARMOR.get()); // entries.accept(ModItems.NUGGET_HORSE_ARMOR.get());
//
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get()); // entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get());
//
entries.add(ModItems.NUGGET_MUSIC_DISC.get()); // entries.accept(ModItems.NUGGET_MUSIC_DISC.get());
}).build()); // }).build());
//
public static void registerItemGroups() { // public static void registerItemGroups() {
NuggetMod.LOGGER.info("Registering Item Groups for " + NuggetMod.MOD_ID); // NuggetMod.LOGGER.info("Registering Item Groups for " + NuggetMod.MOD_ID);
} // }
} //}

View File

@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftServer.class) @Mixin(MinecraftServer.class)
public class ExampleMixin { public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "loadWorld") @Inject(at = @At("HEAD"), method = "loadLevel")
private void init(CallbackInfo info) { private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftServer.loadWorld()V // This code is injected into the start of MinecraftServer.loadWorld()V
} }

View File

@@ -2,17 +2,17 @@ package dev.sillyangel.nuggetmod.fabric.particle;
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
import dev.sillyangel.nuggetmod.fabric.NuggetMod; import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.particle.SimpleParticleType; import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.registry.Registries; import net.minecraft.core.Registry;
import net.minecraft.registry.Registry; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.util.Identifier; import net.minecraft.resources.Identifier;
public class ModParticles { public class ModParticles {
public static final SimpleParticleType NUGGET_PARTICLE = public static final SimpleParticleType NUGGET_PARTICLE =
registerParticle("nugget_particle", FabricParticleTypes.simple()); registerParticle("nugget_particle", FabricParticleTypes.simple());
private static SimpleParticleType registerParticle(String name, SimpleParticleType particleType) { private static SimpleParticleType registerParticle(String name, SimpleParticleType particleType) {
return Registry.register(Registries.PARTICLE_TYPE, Identifier.of(NuggetMod.MOD_ID, name), particleType); return Registry.register(BuiltInRegistries.PARTICLE_TYPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name), particleType);
} }
public static void registerParticles() { public static void registerParticles() {

View File

@@ -1,42 +0,0 @@
package dev.sillyangel.nuggetmod.fabric.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

@@ -4,39 +4,43 @@ import com.google.common.collect.ImmutableSet;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import net.fabricmc.fabric.api.object.builder.v1.world.poi.PointOfInterestHelper; import net.fabricmc.fabric.api.object.builder.v1.world.poi.PointOfInterestHelper;
import dev.sillyangel.nuggetmod.fabric.NuggetMod; import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import net.minecraft.block.Block; import net.minecraft.resources.ResourceKey;
import net.minecraft.registry.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.registry.Registry; import net.minecraft.sounds.SoundEvents;
import net.minecraft.registry.RegistryKey; import net.minecraft.network.chat.Component;
import net.minecraft.registry.RegistryKeys; import net.minecraft.resources.Identifier;
import net.minecraft.sound.SoundEvents; import net.minecraft.world.level.block.Block;
import net.minecraft.text.Text; import net.minecraft.world.entity.ai.village.poi.PoiType;
import net.minecraft.util.Identifier; import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType;
public class ModVillagers { public class ModVillagers {
public static final RegistryKey<PointOfInterestType> NUGGETER_POI_KEY = registerPoiKey("nuggeter_poi"); public static final ResourceKey<PoiType> NUGGETER_POI_KEY = registerPoiKey("nuggeter_poi");
public static final PointOfInterestType NUGGETER_POI = registerPOI("nuggeter_poi", ModBlocks.NUGGET_BLOCK.get()); public static final PoiType NUGGETER_POI = registerPOI("nuggeter_poi", ModBlocks.NUGGET_BLOCK.get());
public static final RegistryKey<VillagerProfession> NUGGETER_KEY = public static final ResourceKey<VillagerProfession> NUGGETER_KEY =
RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, "nuggeter")); ResourceKey.create(Registries.VILLAGER_PROFESSION, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nuggeter"));
public static final VillagerProfession NUGGETER = registerProfession("nuggeter", NUGGETER_POI_KEY); public static final VillagerProfession NUGGETER = registerProfession("nuggeter", NUGGETER_POI_KEY);
private static VillagerProfession registerProfession(String name, RegistryKey<PointOfInterestType> type) { private static VillagerProfession registerProfession(String name, ResourceKey<PoiType> type) {
return Registry.register(Registries.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, name), return new VillagerProfession(
new VillagerProfession(Text.literal("Nuggeter"), entry -> entry.matchesKey(type), entry -> entry.matchesKey(type), Component.translatable("entity.nuggetmod.villager.nuggeter"),
ImmutableSet.of(), ImmutableSet.of(), SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN)); entry -> entry.is(type),
entry -> entry.is(type),
ImmutableSet.of(),
ImmutableSet.of(),
SoundEvents.VILLAGER_WORK_LIBRARIAN
);
} }
private static PointOfInterestType registerPOI(String name, Block block) {
return PointOfInterestHelper.register(Identifier.of(NuggetMod.MOD_ID, name), private static PoiType registerPOI(String name, Block block) {
return PointOfInterestHelper.register(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name),
1, 1, block); 1, 1, block);
} }
private static RegistryKey<PointOfInterestType> registerPoiKey(String name) { private static ResourceKey<PoiType> registerPoiKey(String name) {
return RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, Identifier.of(NuggetMod.MOD_ID, name)); return ResourceKey.create(Registries.POINT_OF_INTEREST_TYPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
} }
public static void registerVillagers() { public static void registerVillagers() {

View File

@@ -3,11 +3,11 @@ package dev.sillyangel.nuggetmod.fabric.world;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications; import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures; import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.level.levelgen.GenerationStep;
public class ModOreGeneration { public class ModOreGeneration {
public static void generateOres() { public static void generateOres() {
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Decoration.UNDERGROUND_ORES,
ModPlacedFeatures.NUGGET_ORE_PLACED_KEY); ModPlacedFeatures.NUGGET_ORE_PLACED_KEY);
// Example for individual Bioms // Example for individual Bioms

View File

@@ -1,20 +1,19 @@
# Done to increase the memory available to Gradle. # Done to increase the memory available to Gradle.
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true org.gradle.parallel=true
# Mod properties # Mod properties
mod_version = 1.3.1 mod_version = 1.4.0
maven_group = dev.sillyangel.nuggetmod maven_group = dev.sillyangel.nuggetmod
archives_name = nuggetmod archives_name = nuggetmod
enabled_platforms = fabric,neoforge enabled_platforms = fabric,neoforge
# Minecraft properties # Minecraft properties
minecraft_version = 1.21.11 minecraft_version = 26.1
yarn_mappings = 1.21.11+build.4
# Dependencies # Dependencies
architectury_api_version = 19.0.1 architectury_api_version = 19.0.1
fabric_loader_version = 0.18.4 fabric_loader_version = 0.18.5
fabric_api_version = 0.141.1+1.21.11 fabric_api_version = 0.144.3+26.1
neoforge_version = 21.11.17-beta neoforge_version = 26.1.0.5-beta
yarn_mappings_patch_neoforge_version = 1.21+build.6

Binary file not shown.

View File

@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

13
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -112,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -170,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -203,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

5
gradlew.bat vendored
View File

@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -68,11 +70,10 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@@ -18,10 +18,19 @@ configurations {
// Files in this configuration will be bundled into your mod using the Shadow plugin. // Files in this configuration will be bundled into your mod using the Shadow plugin.
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
shadowBundle { shadowCommon {
canBeResolved = true canBeResolved = true
canBeConsumed = false canBeConsumed = false
} }
apiElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
runtimeElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
} }
repositories { repositories {
@@ -35,10 +44,10 @@ dependencies {
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version" neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
// Architectury API. This is optional, and you can comment it out if you don't need it. // Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-neoforge:$rootProject.architectury_api_version" api "dev.architectury:architectury-neoforge:$rootProject.architectury_api_version"
common(project(path: ':common', configuration: 'namedElements')) { transitive = false } common(project(path: ':common')) { transitive = false }
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge') shadowCommon project(path: ':common', configuration: 'transformProductionNeoForge')
} }
processResources { processResources {
@@ -49,11 +58,14 @@ processResources {
} }
} }
shadowJar { jar {
configurations = [project.configurations.shadowBundle] archiveClassifier = "raw"
archiveClassifier = 'dev-shadow'
} }
remapJar { shadowJar {
inputFile.set shadowJar.archiveFile dependsOn(jar)
from(zipTree(jar.archiveFile))
configurations = [project.configurations.shadowCommon]
archiveClassifier = null
from rootProject.file("LICENSE.md")
} }

View File

@@ -1,6 +1,6 @@
package dev.sillyangel.nuggetmod.neoforge; package dev.sillyangel.nuggetmod.neoforge;
import dev.sillyangel.nuggetmod.neoforge.item.ModItemGroups; //import dev.sillyangel.nuggetmod.neoforge.item.ModItemGroups;
import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles; import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles;
import dev.sillyangel.nuggetmod.neoforge.villager.ModVillagers; import dev.sillyangel.nuggetmod.neoforge.villager.ModVillagers;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
@@ -15,6 +15,6 @@ public final class NuggetMod {
// Register NeoForge-specific features // Register NeoForge-specific features
ModParticles.registerParticles(modEventBus); ModParticles.registerParticles(modEventBus);
ModVillagers.registerVillagers(modEventBus); ModVillagers.registerVillagers(modEventBus);
ModItemGroups.registerItemGroups(modEventBus); // ModItemGroups.registerItemGroups(modEventBus);
} }
} }

View File

@@ -2,7 +2,7 @@ package dev.sillyangel.nuggetmod.neoforge.client;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles; import dev.sillyangel.nuggetmod.neoforge.particle.ModParticles;
import dev.sillyangel.nuggetmod.neoforge.particle.NuggetParticle; import dev.sillyangel.nuggetmod.particle.NuggetParticle;
import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.common.EventBusSubscriber;

View File

@@ -4,12 +4,12 @@ import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.neoforge.villager.ModVillagers; import dev.sillyangel.nuggetmod.neoforge.villager.ModVillagers;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.village.TradedItem; import net.minecraft.world.item.trading.ItemCost;
import net.minecraft.village.VillagerProfession; import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.village.TradeOffer; import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.village.TradeOffers; import net.minecraft.world.entity.npc.villager.VillagerTrades;
import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.village.VillagerTradesEvent; import net.neoforged.neoforge.event.village.VillagerTradesEvent;
@@ -24,81 +24,81 @@ public class ModEvents {
public static void addCustomTrades(VillagerTradesEvent event) { public static void addCustomTrades(VillagerTradesEvent event) {
// Add trades to vanilla FARMER profession // Add trades to vanilla FARMER profession
if(event.getType() == VillagerProfession.FARMER) { if(event.getType() == VillagerProfession.FARMER) {
Int2ObjectMap<List<TradeOffers.Factory>> trades = event.getTrades(); Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades();
trades.get(1).add((level, entity, random) -> new TradeOffer( trades.get(1).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 3), new ItemCost(Items.EMERALD, 3),
new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f)); new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f));
} }
// Add trades to custom NUGGETER profession // Add trades to custom NUGGETER profession
if(event.getType().equals(ModVillagers.NUGGETER_KEY)) { if(event.getType().equals(ModVillagers.NUGGETER_KEY)) {
Int2ObjectMap<List<TradeOffers.Factory>> trades = event.getTrades(); Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades();
// Level 1 trades // Level 1 trades
trades.get(1).add((level, entity, random) -> new TradeOffer( trades.get(1).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 5), new ItemCost(Items.EMERALD, 5),
new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f)); new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f));
trades.get(1).add((level, entity, random) -> new TradeOffer( trades.get(1).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 2), new ItemCost(Items.DIAMOND, 2),
new ItemStack(ModItems.RAW_NUGGET.get(), 12), 6, 5, 0.05f)); new ItemStack(ModItems.RAW_NUGGET.get(), 12), 6, 5, 0.05f));
// Level 2 trades // Level 2 trades
trades.get(2).add((level, entity, random) -> new TradeOffer( trades.get(2).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.GOLD_INGOT, 8), new ItemCost(Items.GOLD_INGOT, 8),
new ItemStack(ModItems.NUGGET_SWORD.get(), 1), 3, 10, 0.05f)); new ItemStack(ModItems.NUGGET_SWORD.get(), 1), 3, 10, 0.05f));
trades.get(2).add((level, entity, random) -> new TradeOffer( trades.get(2).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 10), new ItemCost(Items.EMERALD, 10),
new ItemStack(ModItems.NUGGET_PICKAXE.get(), 1), 3, 10, 0.05f)); new ItemStack(ModItems.NUGGET_PICKAXE.get(), 1), 3, 10, 0.05f));
// Level 3 trades // Level 3 trades
trades.get(3).add((level, entity, random) -> new TradeOffer( trades.get(3).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 15), new ItemCost(Items.EMERALD, 15),
new ItemStack(ModItems.NUGGET_HELMET.get(), 1), 2, 15, 0.05f)); new ItemStack(ModItems.NUGGET_HELMET.get(), 1), 2, 15, 0.05f));
trades.get(3).add((level, entity, random) -> new TradeOffer( trades.get(3).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 20), new ItemCost(Items.EMERALD, 20),
new ItemStack(ModItems.NUGGET_CHESTPLATE.get(), 1), 2, 15, 0.05f)); new ItemStack(ModItems.NUGGET_CHESTPLATE.get(), 1), 2, 15, 0.05f));
// Level 4 trades // Level 4 trades
trades.get(4).add((level, entity, random) -> new TradeOffer( trades.get(4).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 5), new ItemCost(Items.DIAMOND, 5),
new ItemStack(ModItems.NUGGET_LEGGINGS.get(), 1), 2, 20, 0.05f)); new ItemStack(ModItems.NUGGET_LEGGINGS.get(), 1), 2, 20, 0.05f));
trades.get(4).add((level, entity, random) -> new TradeOffer( trades.get(4).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 12), new ItemCost(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET_BOOTS.get(), 1), 2, 20, 0.05f)); new ItemStack(ModItems.NUGGET_BOOTS.get(), 1), 2, 20, 0.05f));
// Level 5 trades (Master) // Level 5 trades (Master)
trades.get(5).add((level, entity, random) -> new TradeOffer( trades.get(5).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 30), new ItemCost(Items.EMERALD, 30),
new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 1, 30, 0.1f)); new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 1, 30, 0.1f));
trades.get(5).add((level, entity, random) -> new TradeOffer( trades.get(5).add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 10), new ItemCost(Items.DIAMOND, 10),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 30, 0.1f)); new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 30, 0.1f));
} }
} }
@SubscribeEvent @SubscribeEvent
public static void addWanderingTrades(WandererTradesEvent event) { public static void addWanderingTrades(WandererTradesEvent event) {
List<TradeOffers.Factory> genericTrades = event.getGenericTrades(); List<VillagerTrades.ItemListing> genericTrades = event.getGenericTrades();
List<TradeOffers.Factory> rareTrades = event.getRareTrades(); List<VillagerTrades.ItemListing> rareTrades = event.getRareTrades();
// Add generic wandering trader trades // Add generic wandering trader trades
genericTrades.add((level, entity, random) -> new TradeOffer( genericTrades.add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 12), new ItemCost(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET.get(), 3), 2, 8, 0.2f)); new ItemStack(ModItems.NUGGET.get(), 3), 2, 8, 0.2f));
// Add rare wandering trader trades // Add rare wandering trader trades
rareTrades.add((level, entity, random) -> new TradeOffer( rareTrades.add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.DIAMOND, 8), new ItemCost(Items.DIAMOND, 8),
new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 1, 12, 0.2f)); new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 1, 12, 0.2f));
rareTrades.add((level, entity, random) -> new TradeOffer( rareTrades.add((level, entity, random) -> new MerchantOffer(
new TradedItem(Items.EMERALD, 25), new ItemCost(Items.EMERALD, 25),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 12, 0.2f)); new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 12, 0.2f));
} }
} }

View File

@@ -3,55 +3,57 @@ package dev.sillyangel.nuggetmod.neoforge.item;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.item.ItemGroup; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.ItemStack; import net.minecraft.core.registries.Registries;
import net.minecraft.registry.RegistryKeys; import net.minecraft.network.chat.Component;
import net.minecraft.text.Text; import net.minecraft.resources.Identifier;
import net.minecraft.util.Identifier; import net.minecraft.world.item.CreativeModeTab;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister; import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ModItemGroups { public class ModItemGroups {
public static final DeferredRegister<ItemGroup> CREATIVE_MODE_TABS = public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
DeferredRegister.create(RegistryKeys.ITEM_GROUP, NuggetMod.MOD_ID); DeferredRegister.create(Registries.CREATIVE_MODE_TAB, NuggetMod.MOD_ID);
public static final Supplier<ItemGroup> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks", public static final Supplier<CreativeModeTab> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks",
() -> ItemGroup.create(ItemGroup.Row.TOP, -1) () -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
.icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get())) .icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks")) .title(Component.translatable("creativetab.nuggetmod.nugget_blocks"))
.entries((displayContext, entries) -> { .displayItems((displayContext, entries) -> {
entries.add(ModBlocks.NUGGET_BLOCK.get()); entries.accept(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get()); entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.add(ModBlocks.NUGGET_ORE.get()); entries.accept(ModBlocks.NUGGET_ORE.get());
entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); entries.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build()); }).build());
public static final Supplier<ItemGroup> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items", public static final Supplier<CreativeModeTab> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items",
() -> ItemGroup.create(ItemGroup.Row.TOP, -1) () -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
.icon(() -> new ItemStack(ModItems.NUGGET.get())) .icon(() -> new ItemStack(ModItems.NUGGET.get()))
.withTabsBefore(Identifier.of(NuggetMod.MOD_ID, "nugget_blocks")) .withTabsBefore(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_blocks"))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_items")) .title(Component.translatable("creativetab.nuggetmod.nugget_items"))
.entries((displayContext, entries) -> { .displayItems((displayContext, entries) -> {
entries.add(ModItems.NUGGET.get()); entries.accept(ModItems.NUGGET.get());
entries.add(ModItems.RAW_NUGGET.get()); entries.accept(ModItems.RAW_NUGGET.get());
entries.add(ModItems.NUGGET_SWORD.get()); entries.accept(ModItems.NUGGET_SWORD.get());
entries.add(ModItems.NUGGET_PICKAXE.get()); entries.accept(ModItems.NUGGET_PICKAXE.get());
entries.add(ModItems.NUGGET_AXE.get()); entries.accept(ModItems.NUGGET_AXE.get());
entries.add(ModItems.NUGGET_SHOVEL.get()); entries.accept(ModItems.NUGGET_SHOVEL.get());
entries.add(ModItems.NUGGET_HOE.get()); entries.accept(ModItems.NUGGET_HOE.get());
entries.add(ModItems.NUGGET_SPEAR.get()); entries.accept(ModItems.NUGGET_SPEAR.get());
entries.add(ModItems.NUGGET_HELMET.get()); entries.accept(ModItems.NUGGET_HELMET.get());
entries.add(ModItems.NUGGET_CHESTPLATE.get()); entries.accept(ModItems.NUGGET_CHESTPLATE.get());
entries.add(ModItems.NUGGET_LEGGINGS.get()); entries.accept(ModItems.NUGGET_LEGGINGS.get());
entries.add(ModItems.NUGGET_BOOTS.get()); entries.accept(ModItems.NUGGET_BOOTS.get());
entries.add(ModItems.NUGGET_HORSE_ARMOR.get()); entries.accept(ModItems.NUGGET_HORSE_ARMOR.get());
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get()); entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.add(ModItems.NUGGET_MUSIC_DISC.get()); entries.accept(ModItems.NUGGET_MUSIC_DISC.get());
entries.accept(ModBlocks.NUGGET_CAKE.get());
}).build()); }).build());
public static void registerItemGroups(IEventBus eventBus) { public static void registerItemGroups(IEventBus eventBus) {

View File

@@ -1,18 +1,20 @@
package dev.sillyangel.nuggetmod.neoforge.particle; package dev.sillyangel.nuggetmod.neoforge.particle;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.registries.Registries;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister; import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ModParticles { public class ModParticles {
public static final DeferredRegister<net.minecraft.particle.ParticleType<?>> PARTICLE_TYPES = public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES =
DeferredRegister.create(RegistryKeys.PARTICLE_TYPE, NuggetMod.MOD_ID); DeferredRegister.create(Registries.PARTICLE_TYPE, NuggetMod.MOD_ID);
public static final Supplier<net.minecraft.particle.SimpleParticleType> NUGGET_PARTICLE = public static final Supplier<SimpleParticleType> NUGGET_PARTICLE =
PARTICLE_TYPES.register("nugget_particle", () -> new net.minecraft.particle.SimpleParticleType(false)); PARTICLE_TYPES.register("nugget_particle", () -> new SimpleParticleType(false));
public static void registerParticles(IEventBus eventBus) { public static void registerParticles(IEventBus eventBus) {
PARTICLE_TYPES.register(eventBus); PARTICLE_TYPES.register(eventBus);

View File

@@ -1,42 +0,0 @@
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 {
protected NuggetParticle(ClientWorld level, double x, double y, double z, SpriteProvider spriteSet,
double xSpeed, double ySpeed, double zSpeed) {
super(level, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet.getSprite(Random.create()));
this.velocityMultiplier = 0.8f;
this.maxAge = 80;
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 spriteSet;
public Factory(SpriteProvider spriteSet) {
this.spriteSet = spriteSet;
}
@Nullable
@Override
public Particle createParticle(SimpleParticleType simpleParticleType, ClientWorld clientLevel,
double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed, Random randomSource) {
return new NuggetParticle(clientLevel, pX, pY, pZ, this.spriteSet, pXSpeed, pYSpeed, pZSpeed);
}
}
}

View File

@@ -3,36 +3,36 @@ package dev.sillyangel.nuggetmod.neoforge.villager;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import dev.sillyangel.nuggetmod.NuggetMod; import dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks; import dev.sillyangel.nuggetmod.block.ModBlocks;
import net.minecraft.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.registry.RegistryKeys; import net.minecraft.core.registries.Registries;
import net.minecraft.sound.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.network.chat.Component;
import net.minecraft.util.Identifier; import net.minecraft.resources.Identifier;
import net.minecraft.village.VillagerProfession; import net.minecraft.world.entity.ai.village.poi.PoiType;
import net.minecraft.world.poi.PointOfInterestType; import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister; import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier; import java.util.function.Supplier;
public class ModVillagers { public class ModVillagers {
public static final DeferredRegister<PointOfInterestType> POI_TYPES = public static final DeferredRegister<PoiType> POI_TYPES =
DeferredRegister.create(RegistryKeys.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID); DeferredRegister.create(Registries.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID);
public static final DeferredRegister<VillagerProfession> VILLAGER_PROFESSIONS = public static final DeferredRegister<VillagerProfession> VILLAGER_PROFESSIONS =
DeferredRegister.create(RegistryKeys.VILLAGER_PROFESSION, NuggetMod.MOD_ID); DeferredRegister.create(Registries.VILLAGER_PROFESSION, NuggetMod.MOD_ID);
public static final RegistryKey<VillagerProfession> NUGGETER_KEY = public static final ResourceKey<VillagerProfession> NUGGETER_KEY =
RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, "nuggeter")); ResourceKey.create(Registries.VILLAGER_PROFESSION, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nuggeter"));
public static final Supplier<PointOfInterestType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi", public static final Supplier<PoiType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi",
() -> new PointOfInterestType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateManager().getStates()), 1, 1)); () -> new PoiType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateDefinition().getPossibleStates()), 1, 1));
public static final Supplier<VillagerProfession> NUGGETER = VILLAGER_PROFESSIONS.register("nuggeter", public static final Supplier<VillagerProfession> NUGGETER = VILLAGER_PROFESSIONS.register("nuggeter",
() -> new VillagerProfession(Text.literal("Nuggeter"), () -> new VillagerProfession(Component.literal("Nuggeter"),
holder -> holder.value() == NUGGETER_POI.get(), holder -> holder.value() == NUGGETER_POI.get(),
poiTypeHolder -> poiTypeHolder.value() == NUGGETER_POI.get(), poiTypeHolder -> poiTypeHolder.value() == NUGGETER_POI.get(),
ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(),
SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN)); SoundEvents.VILLAGER_WORK_LIBRARIAN));
public static void registerVillagers(IEventBus eventBus) { public static void registerVillagers(IEventBus eventBus) {
POI_TYPES.register(eventBus); POI_TYPES.register(eventBus);

View File

@@ -2,7 +2,7 @@ pluginManagement {
repositories { repositories {
maven { url = 'https://maven.fabricmc.net/' } maven { url = 'https://maven.fabricmc.net/' }
maven { url = 'https://maven.architectury.dev/' } maven { url = 'https://maven.architectury.dev/' }
maven { url = 'https://files.minecraftforge.net/maven/' } maven { url = 'https://maven.neoforged.net/releases/' }
gradlePluginPortal() gradlePluginPortal()
} }
} }