Compare commits

..

3 Commits

Author SHA1 Message Date
ad4179dc1f Update README.md
All checks were successful
Build and Artifact / build (push) Successful in 1m58s
2026-01-10 15:28:49 -06:00
c33ed0a258 Add LICENSE
All checks were successful
Build and Artifact / build (push) Successful in 1m49s
2026-01-10 15:25:33 -06:00
eb9274fc5c Add README.md
All checks were successful
Build and Artifact / build (push) Successful in 2m8s
2026-01-10 15:19:11 -06:00
43 changed files with 686 additions and 681 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 sillyangel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
README.md Normal file
View File

@@ -0,0 +1,14 @@
<h1 align="left"><strong>Nugget</strong></h1>
<p align="left">
<img alt="modrinth" height="35" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/modrinth_vector.svg"><img alt="curseforge" height="35" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/curseforge_vector.svg"><img alt="fabric" height="35" src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/supported/fabric_vector.svg">
</p>
[forge port](https://github.com/sillyangel/forge-nugget/)
[gitea repo](https://git.sillyangel.dev/angel/nugget)
[github mirror](https://github.com/sillyangel/nugget/)
[curseforge page](https://www.curseforge.com/minecraft/mc-mods/gegagedigedagedago-nugget)
[modrinth page](https://modrinth.com/mod/nuggetmod)

View File

@@ -31,13 +31,12 @@ subprojects {
// for more information about repositories. // for more information about repositories.
} }
loom {
silentMojangMappingsLicense()
}
dependencies { dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version" minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.officialMojangMappings() 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 {

View File

@@ -1,7 +1,6 @@
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;
@@ -18,7 +17,6 @@ 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,59 @@ 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.world.level.block.state.BlockBehaviour; import net.minecraft.block.AbstractBlock;
import net.minecraft.world.level.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.level.block.DropExperienceBlock; import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.world.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.item.Item;
import net.minecraft.resources.ResourceKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.level.block.SoundType; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.resources.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.util.math.intprovider.UniformIntProvider;
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, Registries.BLOCK); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.BLOCK);
public static final DeferredRegister<Item> BLOCK_ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.ITEM); public static final DeferredRegister<Item> BLOCK_ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.ITEM);
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)
.requiresCorrectToolForDrops() .requiresTool()
.sound(SoundType.AMETHYST))); .sounds(BlockSoundGroup.AMETHYST_BLOCK)));
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)
.requiresCorrectToolForDrops())); .requiresTool()));
public static final RegistrySupplier<Block> NUGGET_ORE = registerBlockWithItem("nugget_ore", public static final RegistrySupplier<Block> NUGGET_ORE = registerBlockWithItem("nugget_ore",
() -> new DropExperienceBlock(UniformInt.of(2, 5), () -> new ExperienceDroppingBlock(UniformIntProvider.create(2, 5),
createBlockSettings("nugget_ore") createBlockSettings("nugget_ore")
.strength(3f) .strength(3f)
.requiresCorrectToolForDrops())); .requiresTool()));
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 DropExperienceBlock(UniformInt.of(3, 6), () -> new ExperienceDroppingBlock(UniformIntProvider.create(3, 6),
createBlockSettings("nugget_deepslate_ore") createBlockSettings("nugget_deepslate_ore")
.strength(4f) .strength(4f)
.requiresCorrectToolForDrops() .requiresTool()
.sound(SoundType.DEEPSLATE))); .sounds(BlockSoundGroup.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.Properties() new Item.Settings()
.useBlockDescriptionPrefix() .useBlockPrefixedTranslationKey()
.setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name))))); .registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)))));
return toReturn; return toReturn;
} }
private static BlockBehaviour.Properties createBlockSettings(String name) { private static AbstractBlock.Settings createBlockSettings(String name) {
return BlockBehaviour.Properties.of() return AbstractBlock.Settings.create()
.setId(ResourceKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name))); .registryKey(RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name)));
} }
public static void init() { public static void init() {

View File

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

View File

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

View File

@@ -1,62 +0,0 @@
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());
}).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.world.item.*; import net.minecraft.item.*;
import net.minecraft.world.item.equipment.ArmorType; import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.resources.ResourceKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryKeys;
import net.minecraft.resources.Identifier; import net.minecraft.util.Identifier;
public class ModItems { public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.ITEM); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.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").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.HELMET))); () -> new Item(createSettings("nugget_helmet").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.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").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.CHESTPLATE))); () -> new Item(createSettings("nugget_chestplate").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.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").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.LEGGINGS))); () -> new Item(createSettings("nugget_leggings").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.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").humanoidArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, ArmorType.BOOTS))); () -> new Item(createSettings("nugget_boots").armor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL, EquipmentType.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.createArmorTrimTemplate(createSettings("nugget_armor_trim_smithing_template").stacksTo(1))); () -> SmithingTemplateItem.of(createSettings("nugget_armor_trim_smithing_template")));
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))); () -> new Item(createSettings("nugget_music_disc").jukeboxPlayable(ModSounds.NUGGET_THEME_KEY).maxCount(1)));
private static Item.Properties createSettings(String name) { private static Item.Settings createSettings(String name) {
return new Item.Properties().setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name))); return new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(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.world.item.ToolMaterial; import net.minecraft.item.ToolMaterial;
public class ModToolMaterials { public class ModToolMaterials {
public static final ToolMaterial NUGGET = new ToolMaterial( public static final ToolMaterial NUGGET = new ToolMaterial(

View File

@@ -1,46 +0,0 @@
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.world.item.JukeboxSong; import net.minecraft.block.jukebox.JukeboxSong;
import net.minecraft.resources.ResourceKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryKeys;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.resources.Identifier; import net.minecraft.util.Identifier;
public class ModSounds { public class ModSounds {
public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.SOUND_EVENT); public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(NuggetMod.MOD_ID, RegistryKeys.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.createVariableRangeEvent(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_theme"))); () -> SoundEvent.of(Identifier.of(NuggetMod.MOD_ID, "nugget_theme")));
public static final ResourceKey<JukeboxSong> NUGGET_THEME_KEY = public static final RegistryKey<JukeboxSong> NUGGET_THEME_KEY =
ResourceKey.create(Registries.JUKEBOX_SONG, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_theme")); RegistryKey.of(RegistryKeys.JUKEBOX_SONG, Identifier.of(NuggetMod.MOD_ID, "nugget_theme"));
public static void init() { public static void init() {
SOUND_EVENTS.register(); SOUND_EVENTS.register();

View File

@@ -1,35 +1,37 @@
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.ModArmorMaterials; import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.item.Item;
import net.minecraft.item.equipment.trim.ArmorTrimAssets;
import net.minecraft.item.equipment.trim.ArmorTrimMaterial;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util; 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 final ResourceKey<TrimMaterial> NUGGET = public static void bootstrap(Registerable<ArmorTrimMaterial> registerable) {
ResourceKey.create(Registries.TRIM_MATERIAL, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget")); register(registerable, NUGGET, Registries.ITEM.getEntry(ModItems.NUGGET.get()),
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(BootstrapContext<TrimMaterial> context, ResourceKey<TrimMaterial> trimKey, private static void register(Registerable<ArmorTrimMaterial> registerable, RegistryKey<ArmorTrimMaterial> armorTrimKey,
Identifier assetId, Style style) { RegistryEntry<Item> item, Style style) {
MaterialAssetGroup.AssetInfo assetInfo = new MaterialAssetGroup.AssetInfo(assetId.getPath()); ArmorTrimMaterial trimMaterial = new ArmorTrimMaterial(ArmorTrimAssets.of("nugget"),
TrimMaterial trimmaterial = new TrimMaterial( Text.translatable(Util.createTranslationKey("trim_material", armorTrimKey.getValue())).fillStyle(style));
new MaterialAssetGroup(assetInfo, Map.of(ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, assetInfo)),
Component.translatable(Util.makeDescriptionId("trim_material", assetId)).withStyle(style)); registerable.register(armorTrimKey, trimMaterial);
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 {
private static final Identifier NUGGET_LOCATION = Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget"); public static final RegistryKey<ArmorTrimPattern> NUGGET = RegistryKey.of(RegistryKeys.TRIM_PATTERN,
Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static final ResourceKey<TrimPattern> NUGGET = ResourceKey.create(Registries.TRIM_PATTERN, NUGGET_LOCATION); public static void bootstrap(Registerable<ArmorTrimPattern> context) {
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(BootstrapContext<TrimPattern> context, Item item, ResourceKey<TrimPattern> key, Identifier assetId) { private static void register(Registerable<ArmorTrimPattern> context, Item item, RegistryKey<ArmorTrimPattern> key) {
TrimPattern trimPattern = new TrimPattern(assetId, ArmorTrimPattern trimPattern = new ArmorTrimPattern(key.getValue(),
Component.translatable(Util.makeDescriptionId("trim_pattern", assetId)), false); Text.translatable(Util.createTranslationKey("trim_pattern", key.getValue())), 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.resources.Identifier; import net.minecraft.block.Block;
import net.minecraft.world.level.block.Block; import net.minecraft.item.Item;
import net.minecraft.world.item.Item; import net.minecraft.registry.RegistryKeys;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.tag.TagKey;
import net.minecraft.tags.TagKey; import net.minecraft.util.Identifier;
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.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)); return TagKey.of(RegistryKeys.BLOCK, Identifier.of(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.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)); return TagKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name));
} }
} }
} }

View File

@@ -1,44 +1,42 @@
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 final ResourceKey<ConfiguredFeature<?, ?>> OVERWORLD_NUGGET_ORE_KEY = registerKey("nugget_ore"); public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
RuleTest stoneReplaceables = new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES);
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
List<OreFeatureConfig.Target> overworldNuggetOres =
List.of(OreFeatureConfig.createTarget(stoneReplaceables, ModBlocks.NUGGET_ORE.get().getDefaultState()),
OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.NUGGET_DEEPSLATE_ORE.get().getDefaultState()));
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) { register(context, NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldNuggetOres, 12));
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 ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) { public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)); return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name));
} }
private static <FC extends FeatureConfiguration, F extends Feature<FC>> void register(BootstrapContext<ConfiguredFeature<?, ?>> context, private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context,
ResourceKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) { RegistryKey<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.level.levelgen.placement.*; import net.minecraft.world.gen.placementmodifier.*;
import java.util.List; import java.util.List;
public class ModOrePlacement { public class ModOrePlacement {
public static List<PlacementModifier> orePlacement(PlacementModifier pCountPlacement, PlacementModifier pHeightRange) { public static List<PlacementModifier> modifiers(PlacementModifier countModifier, PlacementModifier heightModifier) {
return List.of(pCountPlacement, InSquarePlacement.spread(), pHeightRange, BiomeFilter.biome()); return List.of(countModifier, SquarePlacementModifier.of(), heightModifier, BiomePlacementModifier.of());
} }
public static List<PlacementModifier> commonOrePlacement(int pCount, PlacementModifier pHeightRange) { public static List<PlacementModifier> modifiersWithCount(int count, PlacementModifier heightModifier) {
return orePlacement(CountPlacement.of(pCount), pHeightRange); return modifiers(CountPlacementModifier.of(count), heightModifier);
} }
public static List<PlacementModifier> rareOrePlacement(int pChance, PlacementModifier pHeightRange) { public static List<PlacementModifier> modifiersWithRarity(int chance, PlacementModifier heightModifier) {
return orePlacement(RarityFilter.onAverageOnceEvery(pChance), pHeightRange); return modifiers(RarityFilterPlacementModifier.of(chance), heightModifier);
} }
} }

View File

@@ -1,38 +1,53 @@
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.core.Holder; import net.minecraft.registry.Registerable;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryKey;
import net.minecraft.data.worldgen.BootstrapContext; import net.minecraft.registry.RegistryKeys;
import net.minecraft.resources.ResourceKey; import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.resources.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.gen.YOffset;
import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
import net.minecraft.world.gen.placementmodifier.PlacementModifier;
import java.util.List; 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 final ResourceKey<PlacedFeature> NUGGET_ORE_PLACED_KEY = registerKey("nugget_ore_placed"); public static void bootstrap(Registerable<PlacedFeature> context) {
var configuredFeatures = context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE);
register(context, NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.NUGGET_ORE_KEY),
ModOrePlacement.modifiersWithCount(14,
HeightRangePlacementModifier.uniform(YOffset.fixed(-64), YOffset.fixed(80))));
// register(context, NETHER_NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.NETHER_NUGGET_ORE_KEY),
// ModOrePlacement.modifiersWithCount(14,
// HeightRangePlacementModifier.uniform(YOffset.fixed(-80), YOffset.fixed(80))));
// register(context, END_NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.END_NUGGET_ORE_KEY),
// ModOrePlacement.modifiersWithCount(14,
// HeightRangePlacementModifier.uniform(YOffset.fixed(-80), YOffset.fixed(80))));
public static 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))));
} }
private static ResourceKey<PlacedFeature> registerKey(String name) { public static RegistryKey<PlacedFeature> registerKey(String name) {
return ResourceKey.create(Registries.PLACED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)); return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(NuggetMod.MOD_ID, name));
} }
private static void register(BootstrapContext<PlacedFeature> context, ResourceKey<PlacedFeature> key, Holder<ConfiguredFeature<?, ?>> configuration, private static void register(Registerable<PlacedFeature> context, RegistryKey<PlacedFeature> key, RegistryEntry<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,15 +34,5 @@
"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

@@ -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.network.chat.Component; import net.minecraft.item.ItemGroups;
import net.minecraft.world.entity.npc.villager.VillagerProfession; import net.minecraft.text.Text;
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.world.item.trading.MerchantOffer; 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.util.Identifier;
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.is(ModItems.NUGGET.get())) { if (itemStack.isOf(ModItems.NUGGET.get())) {
list.add(Component.translatable("item.nuggetmod.nugget.tooltip")); list.add(Text.translatable("item.nuggetmod.nugget.tooltip"));
} }
}); });
// Add items to vanilla creative tabs // Add items to vanilla creative tabs
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(entries -> { ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
entries.accept(ModItems.NUGGET.get()); entries.add(ModItems.NUGGET.get());
entries.accept(ModItems.RAW_NUGGET.get()); entries.add(ModItems.RAW_NUGGET.get());
}); });
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(entries -> { ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> {
entries.accept(ModBlocks.NUGGET_BLOCK.get()); entries.add(ModBlocks.NUGGET_BLOCK.get());
entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get()); entries.add(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 3), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 5), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 2), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.GOLD_INGOT, 8), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 10), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 15), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 20), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 5), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 12), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 30), new TradedItem(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 MerchantOffer( factories.add((world,entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 10), new TradedItem(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.fromNamespaceAndPath(NuggetMod.MOD_ID, "emerald_for_nugget"), (world, entity, random) -> new MerchantOffer( factories.addAll(Identifier.of(NuggetMod.MOD_ID, "emerald_for_nugget"), (world, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 12), new TradedItem(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.fromNamespaceAndPath(NuggetMod.MOD_ID, "diamond_for_musicdisc"), (world, entity, random) -> new MerchantOffer( factories.addAll(Identifier.of(NuggetMod.MOD_ID, "diamond_for_musicdisc"), (world, entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 8), new TradedItem(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.fromNamespaceAndPath(NuggetMod.MOD_ID, "emerald_for_smithingtemplate"), (world, entity, random) -> new MerchantOffer( factories.addAll(Identifier.of(NuggetMod.MOD_ID, "emerald_for_smithingtemplate"), (world, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 25), new TradedItem(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.core.RegistrySetBuilder; import net.minecraft.registry.RegistryBuilder;
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.core.registries.Registries; import net.minecraft.registry.RegistryKeys;
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(RegistrySetBuilder registryBuilder) { public void buildRegistry(RegistryBuilder registryBuilder) {
registryBuilder.add(Registries.TRIM_MATERIAL, ModTrimMaterials::bootstrap); registryBuilder.addRegistry(RegistryKeys.TRIM_MATERIAL, ModTrimMaterials::bootstrap);
registryBuilder.add(Registries.TRIM_PATTERN, ModTrimPatterns::bootstrap); registryBuilder.addRegistry(RegistryKeys.TRIM_PATTERN, ModTrimPatterns::bootstrap);
registryBuilder.add(Registries.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap); registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ModConfiguredFeatures::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, ModPlacedFeatures::bootstrap); registryBuilder.addRegistry(RegistryKeys.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.core.HolderLookup; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.tags.BlockTags; import net.minecraft.registry.tag.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<HolderLookup.Provider> registriesFuture) { public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected void addTags(HolderLookup.Provider wrapperLookup) { protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
valueLookupBuilder(BlockTags.MINEABLE_WITH_PICKAXE) valueLookupBuilder(BlockTags.PICKAXE_MINEABLE)
.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.core.HolderLookup; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.tags.ItemTags; import net.minecraft.registry.tag.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<HolderLookup.Provider> completableFuture) { public ModItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, completableFuture); super(output, completableFuture);
} }
@Override @Override
protected void addTags(HolderLookup.Provider wrapperLookup) { protected void configure(RegistryWrapper.WrapperLookup 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.core.HolderLookup; import net.minecraft.block.Block;
import net.minecraft.core.registries.Registries; import net.minecraft.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.world.level.block.Block; import net.minecraft.item.Item;
import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.loot.LootTable;
import net.minecraft.world.item.Item; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.loot.entry.LeafEntry;
import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.loot.function.ApplyBonusLootFunction;
import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount; import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.registry.RegistryWrapper;
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<HolderLookup.Provider> registryLookup) { public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
super(dataOutput, registryLookup); super(dataOutput, registryLookup);
} }
@Override @Override
public void generate() { public void generate() {
dropSelf(ModBlocks.NUGGET_BLOCK.get()); addDrop(ModBlocks.NUGGET_BLOCK.get());
dropSelf(ModBlocks.RAW_NUGGET_BLOCK.get()); addDrop(ModBlocks.RAW_NUGGET_BLOCK.get());
add(ModBlocks.NUGGET_ORE.get(), createOreDrop(ModBlocks.NUGGET_ORE.get(), ModItems.RAW_NUGGET.get())); addDrop(ModBlocks.NUGGET_ORE.get(), oreDrops(ModBlocks.NUGGET_ORE.get(), ModItems.RAW_NUGGET.get()));
add(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), multipleOreDrops(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), ModItems.RAW_NUGGET.get(), 2, 6)); addDrop(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), multipleOreDrops(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), ModItems.RAW_NUGGET.get(), 2, 6));
} }
public LootTable.Builder multipleOreDrops(Block drop, Item item, float minDrops, float maxDrops) { public LootTable.Builder multipleOreDrops(Block drop, Item item, float minDrops, float maxDrops) {
HolderLookup.RegistryLookup<Enchantment> impl = this.registries.lookupOrThrow(Registries.ENCHANTMENT); RegistryWrapper.Impl<Enchantment> impl = this.registries.getOrThrow(RegistryKeys.ENCHANTMENT);
return this.createSilkTouchDispatchTable(drop, this.applyExplosionDecay(drop, ((LootPoolSingletonContainer.Builder<?>) return this.dropsWithSilkTouch(drop, this.applyExplosionDecay(drop, ((LeafEntry.Builder<?>)
LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(UniformGenerator.between(minDrops, maxDrops)))) ItemEntry.builder(item).apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(minDrops, maxDrops))))
.apply(ApplyBonusCount.addOreBonusCount(impl.getOrThrow(Enchantments.FORTUNE))))); .apply(ApplyBonusLootFunction.oreDrops(impl.getOrThrow(Enchantments.FORTUNE)))));
} }
} }

View File

@@ -5,10 +5,7 @@ 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.models.BlockModelGenerators; import net.minecraft.client.data.*;
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) {
@@ -16,36 +13,36 @@ public class ModModelProvider extends FabricModelProvider {
} }
// Blocks are generated here // Blocks are generated here
@Override @Override
public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) { public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_BLOCK.get()); blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_BLOCK.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.RAW_NUGGET_BLOCK.get()); blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.RAW_NUGGET_BLOCK.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_ORE.get()); blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_ORE.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
} }
// Items are generated here // Items are generated here
@Override @Override
public void generateItemModels(ItemModelGenerators itemModelGenerator) { public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.generateFlatItem(ModItems.NUGGET.get(), ModelTemplates.FLAT_ITEM); itemModelGenerator.register(ModItems.NUGGET.get(), Models.GENERATED);
itemModelGenerator.generateFlatItem(ModItems.RAW_NUGGET.get(), ModelTemplates.FLAT_ITEM); itemModelGenerator.register(ModItems.RAW_NUGGET.get(), Models.GENERATED);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_SWORD.get(), ModelTemplates.FLAT_HANDHELD_ITEM); itemModelGenerator.register(ModItems.NUGGET_SWORD.get(), Models.HANDHELD);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_PICKAXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM); itemModelGenerator.register(ModItems.NUGGET_PICKAXE.get(), Models.HANDHELD);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_SHOVEL.get(), ModelTemplates.FLAT_HANDHELD_ITEM); itemModelGenerator.register(ModItems.NUGGET_SHOVEL.get(), Models.HANDHELD);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_AXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM); itemModelGenerator.register(ModItems.NUGGET_AXE.get(), Models.HANDHELD);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_HOE.get(), ModelTemplates.FLAT_HANDHELD_ITEM); itemModelGenerator.register(ModItems.NUGGET_HOE.get(), Models.HANDHELD);
itemModelGenerator.generateSpear(ModItems.NUGGET_SPEAR.get()); itemModelGenerator.register(ModItems.NUGGET_SPEAR.get(), Models.SPEAR_IN_HAND);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_HELMET, false); itemModelGenerator.registerArmor(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.HELMET_TRIM_ID_PREFIX, false);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_CHESTPLATE, false); itemModelGenerator.registerArmor(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.CHESTPLATE_TRIM_ID_PREFIX, false);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_LEGGINGS, false); itemModelGenerator.registerArmor(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.LEGGINGS_TRIM_ID_PREFIX, false);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_BOOTS, false); itemModelGenerator.registerArmor(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.BOOTS_TRIM_ID_PREFIX, false);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_HORSE_ARMOR.get(), ModelTemplates.FLAT_ITEM); itemModelGenerator.register(ModItems.NUGGET_HORSE_ARMOR.get(), Models.GENERATED);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModelTemplates.FLAT_ITEM); itemModelGenerator.register(ModItems.NUGGET_SMITHING_TEMPLATE.get(), Models.GENERATED);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_MUSIC_DISC.get(), ModelTemplates.MUSIC_DISC); itemModelGenerator.register(ModItems.NUGGET_MUSIC_DISC.get(), Models.GENERATED);
} }
} }

View File

@@ -2,142 +2,143 @@ 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.core.HolderLookup; import net.minecraft.item.Items;
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.recipes.RecipeOutput; import net.minecraft.data.recipe.RecipeExporter;
import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipe.RecipeGenerator;
import net.minecraft.world.level.ItemLike; import net.minecraft.item.ItemConvertible;
import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.resources.Identifier; import net.minecraft.registry.RegistryKey;
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<HolderLookup.Provider> registriesFuture) { public ModRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected RecipeProvider createRecipeProvider(HolderLookup.Provider wrapperLookup, RecipeOutput recipeExporter) { protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) {
return new RecipeProvider(wrapperLookup, recipeExporter) { return new RecipeGenerator(wrapperLookup, recipeExporter) {
@Override @Override
public void buildRecipes() { public void generate() {
List<ItemLike> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(), List<ItemConvertible> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(),
ModBlocks.NUGGET_DEEPSLATE_ORE.get()); ModBlocks.NUGGET_DEEPSLATE_ORE.get());
oreSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget"); offerSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
oreBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget"); offerBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
nineBlockStorageRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET.get(), RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK.get()); offerReversibleCompactingRecipes(RecipeCategory.BUILDING_BLOCKS, ModItems.NUGGET.get(), RecipeCategory.DECORATIONS, ModBlocks.NUGGET_BLOCK.get());
// RAW_NUGGET_BLOCK // RAW_NUGGET_BLOCK
shaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get()) createShaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
.pattern("RRR") .pattern("RRR")
.pattern("RRR") .pattern("RRR")
.pattern("RRR") .pattern("RRR")
.define('R', ModItems.RAW_NUGGET.get()) .input('R', ModItems.RAW_NUGGET.get())
.unlockedBy(getHasName(ModItems.RAW_NUGGET.get()), has(ModItems.RAW_NUGGET.get())) .criterion(hasItem(ModItems.RAW_NUGGET.get()), conditionsFromItem(ModItems.RAW_NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9) createShapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.requires(ModBlocks.RAW_NUGGET_BLOCK.get()) .input(ModBlocks.RAW_NUGGET_BLOCK.get())
.unlockedBy(getHasName(ModBlocks.RAW_NUGGET_BLOCK.get()), has(ModBlocks.RAW_NUGGET_BLOCK.get())) .criterion(hasItem(ModBlocks.RAW_NUGGET_BLOCK.get()), conditionsFromItem(ModBlocks.RAW_NUGGET_BLOCK.get()))
.save(recipeExporter); .offerTo(exporter);
// TOOLS // TOOLS
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get())
.pattern(" N ") .pattern(" N ")
.pattern(" N ") .pattern(" N ")
.pattern(" S ") .pattern(" S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get()) createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get())
.pattern("NNN") .pattern("NNN")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get()) createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get())
.pattern(" NN") .pattern(" NN")
.pattern(" SN") .pattern(" SN")
.pattern(" S ") .pattern(" S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get()) createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get())
.pattern(" N ") .pattern(" N ")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get()) createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get())
.pattern(" NN") .pattern(" NN")
.pattern(" S ") .pattern(" S ")
.pattern(" S ") .pattern(" S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get())
.pattern(" N") .pattern(" N")
.pattern(" S ") .pattern(" S ")
.pattern("S ") .pattern("S ")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.define('S', Items.STICK) .input('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
// ARMOR // ARMOR
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get())
.pattern("NNN") .pattern("NNN")
.pattern("N N") .pattern("N N")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get())
.pattern("N N") .pattern("N N")
.pattern("NNN") .pattern("NNN")
.pattern("NNN") .pattern("NNN")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get())
.pattern("NNN") .pattern("NNN")
.pattern("N N") .pattern("N N")
.pattern("N N") .pattern("N N")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get()) createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get())
.pattern("N N") .pattern("N N")
.pattern("N N") .pattern("N N")
.define('N', ModItems.NUGGET.get()) .input('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get())) .criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.save(recipeExporter); .offerTo(exporter);
trimSmithing(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET, offerSmithingTrimRecipe(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET,
ResourceKey.create(Registries.RECIPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_smithing_template"))); RegistryKey.of(RegistryKeys.RECIPE, Identifier.of(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.core.HolderLookup; import net.minecraft.registry.RegistryKeys;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryWrapper;
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<HolderLookup.Provider> registriesFuture) { public ModRegistryDataGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected void configure(HolderLookup.Provider registries, Entries entries) { protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
entries.addAll(registries.lookupOrThrow(Registries.TRIM_MATERIAL)); entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_MATERIAL));
entries.addAll(registries.lookupOrThrow(Registries.TRIM_PATTERN)); entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_PATTERN));
entries.addAll(registries.lookupOrThrow(Registries.CONFIGURED_FEATURE)); entries.addAll(registries.getOrThrow(RegistryKeys.CONFIGURED_FEATURE));
entries.addAll(registries.lookupOrThrow(Registries.PLACED_FEATURE)); entries.addAll(registries.getOrThrow(RegistryKeys.PLACED_FEATURE));
} }
@Override @Override

View File

@@ -1,59 +1,59 @@
//package dev.sillyangel.nuggetmod.fabric.item; package dev.sillyangel.nuggetmod.fabric.item;
//
//import dev.sillyangel.nuggetmod.block.ModBlocks; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
//import dev.sillyangel.nuggetmod.item.ModItems; import dev.sillyangel.nuggetmod.block.ModBlocks;
//import dev.sillyangel.nuggetmod.fabric.NuggetMod; import dev.sillyangel.nuggetmod.item.ModItems;
//import net.minecraft.core.Registry; import dev.sillyangel.nuggetmod.fabric.NuggetMod;
//import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.item.ItemGroup;
//import net.minecraft.world.item.ItemStack; import net.minecraft.item.ItemStack;
//import net.minecraft.network.chat.Component; import net.minecraft.registry.Registries;
//import net.minecraft.resources.Identifier; import net.minecraft.registry.Registry;
//import net.minecraft.world.item.CreativeModeTab; import net.minecraft.text.Text;
////import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.minecraft.util.Identifier;
//
//public class ModItemGroups { public class ModItemGroups {
//
// public static final CreativeModeTab NUGGET_BLOCKS_GROUP = Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, public static final ItemGroup NUGGET_BLOCKS_GROUP = Registry.register(Registries.ITEM_GROUP,
// Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_blocks"), Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"),
// FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get())) FabricItemGroup.builder().icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
// .title(Component.translatable("creativetab.nuggetmod.nugget_blocks")) .displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks"))
// .displayItems((displayContext, entries) -> { .entries((displayContext, entries) -> {
// entries.accept(ModBlocks.NUGGET_BLOCK.get()); entries.add(ModBlocks.NUGGET_BLOCK.get());
// entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get()); entries.add(ModBlocks.RAW_NUGGET_BLOCK.get());
// entries.accept(ModBlocks.NUGGET_ORE.get()); entries.add(ModBlocks.NUGGET_ORE.get());
// entries.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
// }).build()); }).build());
//
// public static final CreativeModeTab NUGGET_ITEMS_GROUP = Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, public static final ItemGroup NUGGET_ITEMS_GROUP = Registry.register(Registries.ITEM_GROUP,
// Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_items"), Identifier.of(NuggetMod.MOD_ID, "nugget_items"),
// FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET.get())) FabricItemGroup.builder().icon(() -> new ItemStack(ModItems.NUGGET.get()))
// .title(Component.translatable("creativetab.nuggetmod.nugget_items")) .displayName(Text.translatable("creativetab.nuggetmod.nugget_items"))
// .displayItems((displayContext, entries) -> { .entries((displayContext, entries) -> {
// entries.accept(ModItems.NUGGET.get()); entries.add(ModItems.NUGGET.get());
// entries.accept(ModItems.RAW_NUGGET.get()); entries.add(ModItems.RAW_NUGGET.get());
//
// // Tool Set // Tool Set
// entries.accept(ModItems.NUGGET_SWORD.get()); entries.add(ModItems.NUGGET_SWORD.get());
// entries.accept(ModItems.NUGGET_PICKAXE.get()); entries.add(ModItems.NUGGET_PICKAXE.get());
// entries.accept(ModItems.NUGGET_AXE.get()); entries.add(ModItems.NUGGET_AXE.get());
// entries.accept(ModItems.NUGGET_SHOVEL.get()); entries.add(ModItems.NUGGET_SHOVEL.get());
// entries.accept(ModItems.NUGGET_HOE.get()); entries.add(ModItems.NUGGET_HOE.get());
// entries.accept(ModItems.NUGGET_SPEAR.get()); entries.add(ModItems.NUGGET_SPEAR.get());
//
// // Armor // Armor
// entries.accept(ModItems.NUGGET_HELMET.get()); entries.add(ModItems.NUGGET_HELMET.get());
// entries.accept(ModItems.NUGGET_CHESTPLATE.get()); entries.add(ModItems.NUGGET_CHESTPLATE.get());
// entries.accept(ModItems.NUGGET_LEGGINGS.get()); entries.add(ModItems.NUGGET_LEGGINGS.get());
// entries.accept(ModItems.NUGGET_BOOTS.get()); entries.add(ModItems.NUGGET_BOOTS.get());
//
// entries.accept(ModItems.NUGGET_HORSE_ARMOR.get()); entries.add(ModItems.NUGGET_HORSE_ARMOR.get());
//
// entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get()); entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get());
//
// entries.accept(ModItems.NUGGET_MUSIC_DISC.get()); entries.add(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 = "loadLevel") @Inject(at = @At("HEAD"), method = "loadWorld")
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.core.particles.SimpleParticleType; import net.minecraft.particle.SimpleParticleType;
import net.minecraft.core.Registry; import net.minecraft.registry.Registries;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.registry.Registry;
import net.minecraft.resources.Identifier; import net.minecraft.util.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(BuiltInRegistries.PARTICLE_TYPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name), particleType); return Registry.register(Registries.PARTICLE_TYPE, Identifier.of(NuggetMod.MOD_ID, name), particleType);
} }
public static void registerParticles() { public static void registerParticles() {

View File

@@ -0,0 +1,42 @@
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,43 +4,39 @@ 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.resources.ResourceKey; import net.minecraft.block.Block;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.Registries;
import net.minecraft.sounds.SoundEvents; import net.minecraft.registry.Registry;
import net.minecraft.network.chat.Component; import net.minecraft.registry.RegistryKey;
import net.minecraft.resources.Identifier; import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.level.block.Block; import net.minecraft.sound.SoundEvents;
import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.text.Text;
import net.minecraft.world.entity.npc.villager.VillagerProfession; import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType;
public class ModVillagers { public class ModVillagers {
public static final ResourceKey<PoiType> NUGGETER_POI_KEY = registerPoiKey("nuggeter_poi"); public static final RegistryKey<PointOfInterestType> NUGGETER_POI_KEY = registerPoiKey("nuggeter_poi");
public static final PoiType NUGGETER_POI = registerPOI("nuggeter_poi", ModBlocks.NUGGET_BLOCK.get()); public static final PointOfInterestType NUGGETER_POI = registerPOI("nuggeter_poi", ModBlocks.NUGGET_BLOCK.get());
public static final ResourceKey<VillagerProfession> NUGGETER_KEY = public static final RegistryKey<VillagerProfession> NUGGETER_KEY =
ResourceKey.create(Registries.VILLAGER_PROFESSION, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nuggeter")); RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(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, ResourceKey<PoiType> type) { private static VillagerProfession registerProfession(String name, RegistryKey<PointOfInterestType> type) {
return new VillagerProfession( return Registry.register(Registries.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, name),
Component.translatable("entity.nuggetmod.villager.nuggeter"), new VillagerProfession(Text.literal("Nuggeter"), entry -> entry.matchesKey(type), entry -> entry.matchesKey(type),
entry -> entry.is(type), ImmutableSet.of(), ImmutableSet.of(), SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN));
entry -> entry.is(type),
ImmutableSet.of(),
ImmutableSet.of(),
SoundEvents.VILLAGER_WORK_LIBRARIAN
);
} }
private static PointOfInterestType registerPOI(String name, Block block) {
private static PoiType registerPOI(String name, Block block) { return PointOfInterestHelper.register(Identifier.of(NuggetMod.MOD_ID, name),
return PointOfInterestHelper.register(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name),
1, 1, block); 1, 1, block);
} }
private static ResourceKey<PoiType> registerPoiKey(String name) { private static RegistryKey<PointOfInterestType> registerPoiKey(String name) {
return ResourceKey.create(Registries.POINT_OF_INTEREST_TYPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)); return RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, Identifier.of(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.level.levelgen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
public class ModOreGeneration { public class ModOreGeneration {
public static void generateOres() { public static void generateOres() {
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Decoration.UNDERGROUND_ORES, BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES,
ModPlacedFeatures.NUGGET_ORE_PLACED_KEY); ModPlacedFeatures.NUGGET_ORE_PLACED_KEY);
// Example for individual Bioms // Example for individual Bioms

View File

@@ -3,16 +3,18 @@ org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true org.gradle.parallel=true
# Mod properties # Mod properties
mod_version = 1.4.0 mod_version = 1.3.1
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 = 1.21.11
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.4
fabric_api_version = 0.140.2+1.21.11 fabric_api_version = 0.141.1+1.21.11
neoforge_version = 21.11.17-beta neoforge_version = 21.11.17-beta
yarn_mappings_patch_neoforge_version = 1.21+build.6

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.particle.NuggetParticle; import dev.sillyangel.nuggetmod.neoforge.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.world.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.item.Items;
import net.minecraft.world.item.trading.ItemCost; import net.minecraft.village.TradedItem;
import net.minecraft.world.entity.npc.villager.VillagerProfession; import net.minecraft.village.VillagerProfession;
import net.minecraft.world.item.trading.MerchantOffer; import net.minecraft.village.TradeOffer;
import net.minecraft.world.entity.npc.villager.VillagerTrades; import net.minecraft.village.TradeOffers;
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<VillagerTrades.ItemListing>> trades = event.getTrades(); Int2ObjectMap<List<TradeOffers.Factory>> trades = event.getTrades();
trades.get(1).add((level, entity, random) -> new MerchantOffer( trades.get(1).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 3), new TradedItem(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<VillagerTrades.ItemListing>> trades = event.getTrades(); Int2ObjectMap<List<TradeOffers.Factory>> trades = event.getTrades();
// Level 1 trades // Level 1 trades
trades.get(1).add((level, entity, random) -> new MerchantOffer( trades.get(1).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 5), new TradedItem(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 MerchantOffer( trades.get(1).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 2), new TradedItem(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 MerchantOffer( trades.get(2).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.GOLD_INGOT, 8), new TradedItem(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 MerchantOffer( trades.get(2).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 10), new TradedItem(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 MerchantOffer( trades.get(3).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 15), new TradedItem(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 MerchantOffer( trades.get(3).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 20), new TradedItem(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 MerchantOffer( trades.get(4).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 5), new TradedItem(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 MerchantOffer( trades.get(4).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 12), new TradedItem(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 MerchantOffer( trades.get(5).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 30), new TradedItem(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 MerchantOffer( trades.get(5).add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 10), new TradedItem(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<VillagerTrades.ItemListing> genericTrades = event.getGenericTrades(); List<TradeOffers.Factory> genericTrades = event.getGenericTrades();
List<VillagerTrades.ItemListing> rareTrades = event.getRareTrades(); List<TradeOffers.Factory> rareTrades = event.getRareTrades();
// Add generic wandering trader trades // Add generic wandering trader trades
genericTrades.add((level, entity, random) -> new MerchantOffer( genericTrades.add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 12), new TradedItem(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 MerchantOffer( rareTrades.add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.DIAMOND, 8), new TradedItem(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 MerchantOffer( rareTrades.add((level, entity, random) -> new TradeOffer(
new ItemCost(Items.EMERALD, 25), new TradedItem(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,55 @@ 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.world.item.ItemStack; import net.minecraft.item.ItemGroup;
import net.minecraft.core.registries.Registries; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.Component; import net.minecraft.registry.RegistryKeys;
import net.minecraft.resources.Identifier; import net.minecraft.text.Text;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.util.Identifier;
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<CreativeModeTab> CREATIVE_MODE_TABS = public static final DeferredRegister<ItemGroup> CREATIVE_MODE_TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, NuggetMod.MOD_ID); DeferredRegister.create(RegistryKeys.ITEM_GROUP, NuggetMod.MOD_ID);
public static final Supplier<CreativeModeTab> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks", public static final Supplier<ItemGroup> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1) () -> ItemGroup.create(ItemGroup.Row.TOP, -1)
.icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get())) .icon(() -> new ItemStack(ModBlocks.NUGGET_BLOCK.get()))
.title(Component.translatable("creativetab.nuggetmod.nugget_blocks")) .displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks"))
.displayItems((displayContext, entries) -> { .entries((displayContext, entries) -> {
entries.accept(ModBlocks.NUGGET_BLOCK.get()); entries.add(ModBlocks.NUGGET_BLOCK.get());
entries.accept(ModBlocks.RAW_NUGGET_BLOCK.get()); entries.add(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.accept(ModBlocks.NUGGET_ORE.get()); entries.add(ModBlocks.NUGGET_ORE.get());
entries.accept(ModBlocks.NUGGET_DEEPSLATE_ORE.get()); entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build()); }).build());
public static final Supplier<CreativeModeTab> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items", public static final Supplier<ItemGroup> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1) () -> ItemGroup.create(ItemGroup.Row.TOP, -1)
.icon(() -> new ItemStack(ModItems.NUGGET.get())) .icon(() -> new ItemStack(ModItems.NUGGET.get()))
.withTabsBefore(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_blocks")) .withTabsBefore(Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"))
.title(Component.translatable("creativetab.nuggetmod.nugget_items")) .displayName(Text.translatable("creativetab.nuggetmod.nugget_items"))
.displayItems((displayContext, entries) -> { .entries((displayContext, entries) -> {
entries.accept(ModItems.NUGGET.get()); entries.add(ModItems.NUGGET.get());
entries.accept(ModItems.RAW_NUGGET.get()); entries.add(ModItems.RAW_NUGGET.get());
entries.accept(ModItems.NUGGET_SWORD.get()); entries.add(ModItems.NUGGET_SWORD.get());
entries.accept(ModItems.NUGGET_PICKAXE.get()); entries.add(ModItems.NUGGET_PICKAXE.get());
entries.accept(ModItems.NUGGET_AXE.get()); entries.add(ModItems.NUGGET_AXE.get());
entries.accept(ModItems.NUGGET_SHOVEL.get()); entries.add(ModItems.NUGGET_SHOVEL.get());
entries.accept(ModItems.NUGGET_HOE.get()); entries.add(ModItems.NUGGET_HOE.get());
entries.accept(ModItems.NUGGET_SPEAR.get()); entries.add(ModItems.NUGGET_SPEAR.get());
entries.accept(ModItems.NUGGET_HELMET.get()); entries.add(ModItems.NUGGET_HELMET.get());
entries.accept(ModItems.NUGGET_CHESTPLATE.get()); entries.add(ModItems.NUGGET_CHESTPLATE.get());
entries.accept(ModItems.NUGGET_LEGGINGS.get()); entries.add(ModItems.NUGGET_LEGGINGS.get());
entries.accept(ModItems.NUGGET_BOOTS.get()); entries.add(ModItems.NUGGET_BOOTS.get());
entries.accept(ModItems.NUGGET_HORSE_ARMOR.get()); entries.add(ModItems.NUGGET_HORSE_ARMOR.get());
entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get()); entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.accept(ModItems.NUGGET_MUSIC_DISC.get()); entries.add(ModItems.NUGGET_MUSIC_DISC.get());
}).build()); }).build());
public static void registerItemGroups(IEventBus eventBus) { public static void registerItemGroups(IEventBus eventBus) {

View File

@@ -1,20 +1,18 @@
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.core.particles.ParticleType; import net.minecraft.registry.RegistryKeys;
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<ParticleType<?>> PARTICLE_TYPES = public static final DeferredRegister<net.minecraft.particle.ParticleType<?>> PARTICLE_TYPES =
DeferredRegister.create(Registries.PARTICLE_TYPE, NuggetMod.MOD_ID); DeferredRegister.create(RegistryKeys.PARTICLE_TYPE, NuggetMod.MOD_ID);
public static final Supplier<SimpleParticleType> NUGGET_PARTICLE = public static final Supplier<net.minecraft.particle.SimpleParticleType> NUGGET_PARTICLE =
PARTICLE_TYPES.register("nugget_particle", () -> new SimpleParticleType(false)); PARTICLE_TYPES.register("nugget_particle", () -> new net.minecraft.particle.SimpleParticleType(false));
public static void registerParticles(IEventBus eventBus) { public static void registerParticles(IEventBus eventBus) {
PARTICLE_TYPES.register(eventBus); PARTICLE_TYPES.register(eventBus);

View File

@@ -0,0 +1,42 @@
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.resources.ResourceKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.core.registries.Registries; import net.minecraft.registry.RegistryKeys;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sound.SoundEvents;
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.entity.ai.village.poi.PoiType; import net.minecraft.village.VillagerProfession;
import net.minecraft.world.entity.npc.villager.VillagerProfession; import net.minecraft.world.poi.PointOfInterestType;
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<PoiType> POI_TYPES = public static final DeferredRegister<PointOfInterestType> POI_TYPES =
DeferredRegister.create(Registries.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID); DeferredRegister.create(RegistryKeys.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID);
public static final DeferredRegister<VillagerProfession> VILLAGER_PROFESSIONS = public static final DeferredRegister<VillagerProfession> VILLAGER_PROFESSIONS =
DeferredRegister.create(Registries.VILLAGER_PROFESSION, NuggetMod.MOD_ID); DeferredRegister.create(RegistryKeys.VILLAGER_PROFESSION, NuggetMod.MOD_ID);
public static final ResourceKey<VillagerProfession> NUGGETER_KEY = public static final RegistryKey<VillagerProfession> NUGGETER_KEY =
ResourceKey.create(Registries.VILLAGER_PROFESSION, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nuggeter")); RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, "nuggeter"));
public static final Supplier<PoiType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi", public static final Supplier<PointOfInterestType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi",
() -> new PoiType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateDefinition().getPossibleStates()), 1, 1)); () -> new PointOfInterestType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateManager().getStates()), 1, 1));
public static final Supplier<VillagerProfession> NUGGETER = VILLAGER_PROFESSIONS.register("nuggeter", public static final Supplier<VillagerProfession> NUGGETER = VILLAGER_PROFESSIONS.register("nuggeter",
() -> new VillagerProfession(Component.literal("Nuggeter"), () -> new VillagerProfession(Text.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.VILLAGER_WORK_LIBRARIAN)); SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN));
public static void registerVillagers(IEventBus eventBus) { public static void registerVillagers(IEventBus eventBus) {
POI_TYPES.register(eventBus); POI_TYPES.register(eventBus);