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.
}
loom {
silentMojangMappingsLicense()
}
dependencies {
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 {

View File

@@ -1,7 +1,6 @@
package dev.sillyangel.nuggetmod;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItemGroups;
import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.sound.ModSounds;
import org.slf4j.Logger;
@@ -18,7 +17,6 @@ public final class NuggetMod {
ModSounds.init();
ModItems.init();
ModBlocks.init();
ModItemGroups.init();
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.RegistrySupplier;
import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.resources.ResourceKey;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.resources.Identifier;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import java.util.function.Supplier;
public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.BLOCK);
public static final DeferredRegister<Item> BLOCK_ITEMS = DeferredRegister.create(NuggetMod.MOD_ID, Registries.ITEM);
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, RegistryKeys.ITEM);
public static final RegistrySupplier<Block> NUGGET_BLOCK = registerBlockWithItem("nugget_block",
() -> new Block(createBlockSettings("nugget_block")
.strength(4f)
.requiresCorrectToolForDrops()
.sound(SoundType.AMETHYST)));
.requiresTool()
.sounds(BlockSoundGroup.AMETHYST_BLOCK)));
public static final RegistrySupplier<Block> RAW_NUGGET_BLOCK = registerBlockWithItem("raw_nugget_block",
() -> new Block(createBlockSettings("raw_nugget_block")
.strength(4f)
.requiresCorrectToolForDrops()));
.requiresTool()));
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")
.strength(3f)
.requiresCorrectToolForDrops()));
.requiresTool()));
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")
.strength(4f)
.requiresCorrectToolForDrops()
.sound(SoundType.DEEPSLATE)));
.requiresTool()
.sounds(BlockSoundGroup.DEEPSLATE)));
private static <T extends Block> RegistrySupplier<T> registerBlockWithItem(String name, Supplier<T> block) {
RegistrySupplier<T> toReturn = BLOCKS.register(name, block);
BLOCK_ITEMS.register(name, () -> new BlockItem(toReturn.get(),
new Item.Properties()
.useBlockDescriptionPrefix()
.setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)))));
new Item.Settings()
.useBlockPrefixedTranslationKey()
.registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)))));
return toReturn;
}
private static BlockBehaviour.Properties createBlockSettings(String name) {
return BlockBehaviour.Properties.of()
.setId(ResourceKey.create(Registries.BLOCK, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)));
private static AbstractBlock.Settings createBlockSettings(String name) {
return AbstractBlock.Settings.create()
.registryKey(RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(NuggetMod.MOD_ID, name)));
}
public static void init() {

View File

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

View File

@@ -1,9 +1,9 @@
package dev.sillyangel.nuggetmod.item;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.component.type.FoodComponent;
public class ModFoodComponents {
public static final FoodProperties NUGGET = new FoodProperties.Builder()
public static final FoodComponent NUGGET = new FoodComponent.Builder()
.nutrition(5)
.saturationModifier(0.5f)
.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.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.sound.ModSounds;
import net.minecraft.world.item.*;
import net.minecraft.world.item.equipment.ArmorType;
import net.minecraft.resources.ResourceKey;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.item.*;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
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
public static final RegistrySupplier<Item> NUGGET = ITEMS.register("nugget",
@@ -41,29 +41,29 @@ public class ModItems {
// Armor
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",
() -> 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",
() -> 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",
() -> 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",
() -> new Item(createSettings("nugget_horse_armor").horseArmor(ModArmorMaterials.NUGGET_ARMOR_MATERIAL)));
// Special Items
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",
() -> 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) {
return new Item.Properties().setId(ResourceKey.create(Registries.ITEM, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name)));
private static Item.Settings createSettings(String name) {
return new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(NuggetMod.MOD_ID, name)));
}
public static void init() {

View File

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

View File

@@ -1,35 +1,37 @@
package dev.sillyangel.nuggetmod.trim;
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.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 static final RegistryKey<ArmorTrimMaterial> NUGGET = RegistryKey.of(RegistryKeys.TRIM_MATERIAL,
Identifier.of(NuggetMod.MOD_ID, "nugget"));
public static final ResourceKey<TrimMaterial> NUGGET =
ResourceKey.create(Registries.TRIM_MATERIAL, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget"));
public static void bootstrap(Registerable<ArmorTrimMaterial> registerable) {
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,
Identifier assetId, Style style) {
MaterialAssetGroup.AssetInfo assetInfo = new MaterialAssetGroup.AssetInfo(assetId.getPath());
TrimMaterial trimmaterial = new TrimMaterial(
new MaterialAssetGroup(assetInfo, Map.of(ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, assetInfo)),
Component.translatable(Util.makeDescriptionId("trim_material", assetId)).withStyle(style));
context.register(trimKey, trimmaterial);
private static void register(Registerable<ArmorTrimMaterial> registerable, RegistryKey<ArmorTrimMaterial> armorTrimKey,
RegistryEntry<Item> item, Style style) {
ArmorTrimMaterial trimMaterial = new ArmorTrimMaterial(ArmorTrimAssets.of("nugget"),
Text.translatable(Util.createTranslationKey("trim_material", armorTrimKey.getValue())).fillStyle(style));
registerable.register(armorTrimKey, trimMaterial);
}
}

View File

@@ -1,28 +1,28 @@
package dev.sillyangel.nuggetmod.trim;
import net.minecraft.world.item.equipment.trim.TrimPattern;
import dev.sillyangel.nuggetmod.NuggetMod;
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.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 {
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(BootstrapContext<TrimPattern> context) {
register(context, ModItems.NUGGET_SMITHING_TEMPLATE.get(), NUGGET, NUGGET_LOCATION);
public static void bootstrap(Registerable<ArmorTrimPattern> context) {
register(context, ModItems.NUGGET_SMITHING_TEMPLATE.get(), NUGGET);
}
private static void register(BootstrapContext<TrimPattern> context, Item item, ResourceKey<TrimPattern> key, Identifier assetId) {
TrimPattern trimPattern = new TrimPattern(assetId,
Component.translatable(Util.makeDescriptionId("trim_pattern", assetId)), false);
private static void register(Registerable<ArmorTrimPattern> context, Item item, RegistryKey<ArmorTrimPattern> key) {
ArmorTrimPattern trimPattern = new ArmorTrimPattern(key.getValue(),
Text.translatable(Util.createTranslationKey("trim_pattern", key.getValue())), false);
context.register(key, trimPattern);
}
}

View File

@@ -1,11 +1,11 @@
package dev.sillyangel.nuggetmod.util;
import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.item.Item;
import net.minecraft.core.registries.Registries;
import net.minecraft.tags.TagKey;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
public class ModTags {
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");
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");
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;
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 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 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;
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) {
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));
register(context, NUGGET_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldNuggetOres, 12));
}
public static ResourceKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String 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,
ResourceKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context,
RegistryKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
context.register(key, new ConfiguredFeature<>(feature, configuration));
}
}
}

View File

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

View File

@@ -1,38 +1,53 @@
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 net.minecraft.core.Holder;
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.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
import net.minecraft.world.gen.placementmodifier.PlacementModifier;
import java.util.List;
public class ModPlacedFeatures {
public static final RegistryKey<PlacedFeature> NUGGET_ORE_PLACED_KEY = registerKey("nugget_ore_placed");
// public static final RegistryKey<PlacedFeature> NETHER_NUGGET_ORE_PLACED_KEY = registerKey("nether_nugget_ore_placed");
// public static final RegistryKey<PlacedFeature> END_NUGGET_ORE_PLACED_KEY = registerKey("end_nugget_ore_placed");
public static 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) {
return ResourceKey.create(Registries.PLACED_FEATURE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, name));
public static RegistryKey<PlacedFeature> registerKey(String 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) {
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",
"entity.minecraft.villager.nuggeter": "Nuggeter",
"trim_material.nuggetmod.nugget": "Nugget Material",
"trim_pattern.nuggetmod.nugget_trim_material": "Nugget Trim",
"trim_pattern.nuggetmod.nugget_armor_trim_smithing_template": "§6Nugget Armor Trim",
"trim_pattern.nuggetmod.nugget": "Nugget Trim",
"painting.nuggetmod.nugget_painting.title": "Nugget Painting",
"painting.nuggetmod.nugget_painting.author": "Nugget Mod",
"entity.nuggetmod.villager.nuggeter": "Nuggeter"
"painting.nuggetmod.nugget_painting.author": "Nugget Mod"
}

View File

@@ -34,15 +34,5 @@
"trim_pattern.nuggetmod.nugget": "Adorno de Nuggets",
"painting.nuggetmod.nugget_painting.title": "Pintura 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",
"painting.nuggetmod.nugget_painting.author": "Mod de Nuggets"
}

View File

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

View File

@@ -1,9 +1,9 @@
package dev.sillyangel.nuggetmod.fabric.client;
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.api.ClientModInitializer;
import dev.sillyangel.nuggetmod.fabric.particle.NuggetParticle;
public class NuggetModClient implements ClientModInitializer {
@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 dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.util.ModTags;
import net.minecraft.core.HolderLookup;
import net.minecraft.tags.BlockTags;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
import java.util.concurrent.CompletableFuture;
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);
}
@Override
protected void addTags(HolderLookup.Provider wrapperLookup) {
valueLookupBuilder(BlockTags.MINEABLE_WITH_PICKAXE)
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
valueLookupBuilder(BlockTags.PICKAXE_MINEABLE)
.add(ModBlocks.NUGGET_BLOCK.get())
.add(ModBlocks.RAW_NUGGET_BLOCK.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.provider.FabricTagProvider;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.core.HolderLookup;
import net.minecraft.tags.ItemTags;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.ItemTags;
import java.util.concurrent.CompletableFuture;
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);
}
@Override
protected void addTags(HolderLookup.Provider wrapperLookup) {
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
valueLookupBuilder(ItemTags.SWORDS)
.add(ModItems.NUGGET_SWORD.get());
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 dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.entry.LeafEntry;
import net.minecraft.loot.function.ApplyBonusLootFunction;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import java.util.concurrent.CompletableFuture;
public class ModLootTableProvider extends FabricBlockLootTableProvider {
public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
super(dataOutput, registryLookup);
}
@Override
public void generate() {
dropSelf(ModBlocks.NUGGET_BLOCK.get());
dropSelf(ModBlocks.RAW_NUGGET_BLOCK.get());
addDrop(ModBlocks.NUGGET_BLOCK.get());
addDrop(ModBlocks.RAW_NUGGET_BLOCK.get());
add(ModBlocks.NUGGET_ORE.get(), createOreDrop(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_ORE.get(), oreDrops(ModBlocks.NUGGET_ORE.get(), ModItems.RAW_NUGGET.get()));
addDrop(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), multipleOreDrops(ModBlocks.NUGGET_DEEPSLATE_ORE.get(), ModItems.RAW_NUGGET.get(), 2, 6));
}
public LootTable.Builder multipleOreDrops(Block drop, Item item, float minDrops, float maxDrops) {
HolderLookup.RegistryLookup<Enchantment> impl = this.registries.lookupOrThrow(Registries.ENCHANTMENT);
return this.createSilkTouchDispatchTable(drop, this.applyExplosionDecay(drop, ((LootPoolSingletonContainer.Builder<?>)
LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(UniformGenerator.between(minDrops, maxDrops))))
.apply(ApplyBonusCount.addOreBonusCount(impl.getOrThrow(Enchantments.FORTUNE)))));
RegistryWrapper.Impl<Enchantment> impl = this.registries.getOrThrow(RegistryKeys.ENCHANTMENT);
return this.dropsWithSilkTouch(drop, this.applyExplosionDecay(drop, ((LeafEntry.Builder<?>)
ItemEntry.builder(item).apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(minDrops, maxDrops))))
.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 dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.ModelProvider;
import net.minecraft.client.data.models.model.ModelTemplates;
import net.minecraft.client.data.*;
public class ModModelProvider extends FabricModelProvider {
public ModModelProvider(FabricDataOutput output) {
@@ -16,36 +13,36 @@ public class ModModelProvider extends FabricModelProvider {
}
// Blocks are generated here
@Override
public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) {
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_BLOCK.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.RAW_NUGGET_BLOCK.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_ORE.get());
blockStateModelGenerator.createTrivialCube(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.RAW_NUGGET_BLOCK.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_ORE.get());
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}
// Items are generated here
@Override
public void generateItemModels(ItemModelGenerators itemModelGenerator) {
itemModelGenerator.generateFlatItem(ModItems.NUGGET.get(), ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(ModItems.RAW_NUGGET.get(), ModelTemplates.FLAT_ITEM);
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(ModItems.NUGGET.get(), Models.GENERATED);
itemModelGenerator.register(ModItems.RAW_NUGGET.get(), Models.GENERATED);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_SWORD.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_PICKAXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_SHOVEL.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_AXE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(ModItems.NUGGET_HOE.get(), ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.register(ModItems.NUGGET_SWORD.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_PICKAXE.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_SHOVEL.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_AXE.get(), Models.HANDHELD);
itemModelGenerator.register(ModItems.NUGGET_HOE.get(), Models.HANDHELD);
itemModelGenerator.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.generateTrimmableItem(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_CHESTPLATE, false);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_LEGGINGS, false);
itemModelGenerator.generateTrimmableItem(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_EQUIPMENT_ASSET, ItemModelGenerators.TRIM_PREFIX_BOOTS, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_HELMET.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.HELMET_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_CHESTPLATE.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.CHESTPLATE_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_LEGGINGS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.LEGGINGS_TRIM_ID_PREFIX, false);
itemModelGenerator.registerArmor(ModItems.NUGGET_BOOTS.get(), ModArmorMaterials.NUGGET_KEY, ItemModelGenerator.BOOTS_TRIM_ID_PREFIX, false);
itemModelGenerator.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.provider.FabricRecipeProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.Items;
import net.minecraft.item.Items;
import dev.sillyangel.nuggetmod.fabric.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import dev.sillyangel.nuggetmod.item.ModItems;
import dev.sillyangel.nuggetmod.trim.ModTrimPatterns;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.world.level.ItemLike;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.Identifier;
import net.minecraft.data.recipe.RecipeExporter;
import net.minecraft.data.recipe.RecipeGenerator;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.book.RecipeCategory;
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.concurrent.CompletableFuture;
public class ModRecipeProvider extends FabricRecipeProvider {
public ModRecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
public ModRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}
@Override
protected RecipeProvider createRecipeProvider(HolderLookup.Provider wrapperLookup, RecipeOutput recipeExporter) {
return new RecipeProvider(wrapperLookup, recipeExporter) {
protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) {
return new RecipeGenerator(wrapperLookup, recipeExporter) {
@Override
public void buildRecipes() {
List<ItemLike> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(),
public void generate() {
List<ItemConvertible> NUGGET_SMELTABLES = List.of(ModItems.RAW_NUGGET.get(), ModBlocks.NUGGET_ORE.get(),
ModBlocks.NUGGET_DEEPSLATE_ORE.get());
oreSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
oreBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
offerSmelting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 200, "nugget");
offerBlasting(NUGGET_SMELTABLES, RecipeCategory.MISC, ModItems.NUGGET.get(), 0.25f, 100, "nugget");
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
shaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
createShaped(RecipeCategory.MISC, ModBlocks.RAW_NUGGET_BLOCK.get())
.pattern("RRR")
.pattern("RRR")
.pattern("RRR")
.define('R', ModItems.RAW_NUGGET.get())
.unlockedBy(getHasName(ModItems.RAW_NUGGET.get()), has(ModItems.RAW_NUGGET.get()))
.save(recipeExporter);
.input('R', ModItems.RAW_NUGGET.get())
.criterion(hasItem(ModItems.RAW_NUGGET.get()), conditionsFromItem(ModItems.RAW_NUGGET.get()))
.offerTo(exporter);
shapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.requires(ModBlocks.RAW_NUGGET_BLOCK.get())
.unlockedBy(getHasName(ModBlocks.RAW_NUGGET_BLOCK.get()), has(ModBlocks.RAW_NUGGET_BLOCK.get()))
.save(recipeExporter);
createShapeless(RecipeCategory.MISC, ModItems.RAW_NUGGET.get(), 9)
.input(ModBlocks.RAW_NUGGET_BLOCK.get())
.criterion(hasItem(ModBlocks.RAW_NUGGET_BLOCK.get()), conditionsFromItem(ModBlocks.RAW_NUGGET_BLOCK.get()))
.offerTo(exporter);
// TOOLS
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SWORD.get())
.pattern(" N ")
.pattern(" N ")
.pattern(" S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get())
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_PICKAXE.get())
.pattern("NNN")
.pattern(" S ")
.pattern(" S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get())
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_AXE.get())
.pattern(" NN")
.pattern(" SN")
.pattern(" S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get())
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_SHOVEL.get())
.pattern(" N ")
.pattern(" S ")
.pattern(" S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get())
createShaped(RecipeCategory.TOOLS, ModItems.NUGGET_HOE.get())
.pattern(" NN")
.pattern(" S ")
.pattern(" S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_SPEAR.get())
.pattern(" N")
.pattern(" S ")
.pattern("S ")
.define('N', ModItems.NUGGET.get())
.define('S', Items.STICK)
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.input('S', Items.STICK)
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
// ARMOR
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_HELMET.get())
.pattern("NNN")
.pattern("N N")
.define('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_CHESTPLATE.get())
.pattern("N N")
.pattern("NNN")
.pattern("NNN")
.define('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_LEGGINGS.get())
.pattern("NNN")
.pattern("N N")
.pattern("N N")
.define('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
shaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get())
createShaped(RecipeCategory.COMBAT, ModItems.NUGGET_BOOTS.get())
.pattern("N N")
.pattern("N N")
.define('N', ModItems.NUGGET.get())
.unlockedBy(getHasName(ModItems.NUGGET.get()), has(ModItems.NUGGET.get()))
.save(recipeExporter);
.input('N', ModItems.NUGGET.get())
.criterion(hasItem(ModItems.NUGGET.get()), conditionsFromItem(ModItems.NUGGET.get()))
.offerTo(exporter);
trimSmithing(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET,
ResourceKey.create(Registries.RECIPE, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_smithing_template")));
offerSmithingTrimRecipe(ModItems.NUGGET_SMITHING_TEMPLATE.get(), ModTrimPatterns.NUGGET,
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.provider.FabricDynamicRegistryProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import java.util.concurrent.CompletableFuture;
public class ModRegistryDataGenerator extends FabricDynamicRegistryProvider {
public ModRegistryDataGenerator(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
public ModRegistryDataGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}
@Override
protected void configure(HolderLookup.Provider registries, Entries entries) {
entries.addAll(registries.lookupOrThrow(Registries.TRIM_MATERIAL));
entries.addAll(registries.lookupOrThrow(Registries.TRIM_PATTERN));
entries.addAll(registries.lookupOrThrow(Registries.CONFIGURED_FEATURE));
entries.addAll(registries.lookupOrThrow(Registries.PLACED_FEATURE));
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_MATERIAL));
entries.addAll(registries.getOrThrow(RegistryKeys.TRIM_PATTERN));
entries.addAll(registries.getOrThrow(RegistryKeys.CONFIGURED_FEATURE));
entries.addAll(registries.getOrThrow(RegistryKeys.PLACED_FEATURE));
}
@Override

View File

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

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

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.BiomeSelectors;
import dev.sillyangel.nuggetmod.worldgen.ModPlacedFeatures;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.gen.GenerationStep;
public class ModOreGeneration {
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);
// Example for individual Bioms

View File

@@ -3,16 +3,18 @@ org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
# Mod properties
mod_version = 1.4.0
mod_version = 1.3.1
maven_group = dev.sillyangel.nuggetmod
archives_name = nuggetmod
enabled_platforms = fabric,neoforge
# Minecraft properties
minecraft_version = 1.21.11
yarn_mappings = 1.21.11+build.4
# Dependencies
architectury_api_version = 19.0.1
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
yarn_mappings_patch_neoforge_version = 1.21+build.6

View File

@@ -1,6 +1,6 @@
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.villager.ModVillagers;
import net.neoforged.bus.api.IEventBus;
@@ -15,6 +15,6 @@ public final class NuggetMod {
// Register NeoForge-specific features
ModParticles.registerParticles(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.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.bus.api.SubscribeEvent;
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.neoforge.villager.ModVillagers;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.trading.ItemCost;
import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraft.world.entity.npc.villager.VillagerTrades;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.village.TradedItem;
import net.minecraft.village.VillagerProfession;
import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradeOffers;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.village.VillagerTradesEvent;
@@ -24,81 +24,81 @@ public class ModEvents {
public static void addCustomTrades(VillagerTradesEvent event) {
// Add trades to vanilla FARMER profession
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(
new ItemCost(Items.EMERALD, 3),
trades.get(1).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 3),
new ItemStack(ModItems.NUGGET.get(), 8), 7, 2, 0.04f));
}
// Add trades to custom NUGGETER profession
if(event.getType().equals(ModVillagers.NUGGETER_KEY)) {
Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades();
Int2ObjectMap<List<TradeOffers.Factory>> trades = event.getTrades();
// Level 1 trades
trades.get(1).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 5),
trades.get(1).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 5),
new ItemStack(ModItems.NUGGET.get(), 20), 4, 7, 0.04f));
trades.get(1).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.DIAMOND, 2),
trades.get(1).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.DIAMOND, 2),
new ItemStack(ModItems.RAW_NUGGET.get(), 12), 6, 5, 0.05f));
// Level 2 trades
trades.get(2).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.GOLD_INGOT, 8),
trades.get(2).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.GOLD_INGOT, 8),
new ItemStack(ModItems.NUGGET_SWORD.get(), 1), 3, 10, 0.05f));
trades.get(2).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 10),
trades.get(2).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 10),
new ItemStack(ModItems.NUGGET_PICKAXE.get(), 1), 3, 10, 0.05f));
// Level 3 trades
trades.get(3).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 15),
trades.get(3).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 15),
new ItemStack(ModItems.NUGGET_HELMET.get(), 1), 2, 15, 0.05f));
trades.get(3).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 20),
trades.get(3).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 20),
new ItemStack(ModItems.NUGGET_CHESTPLATE.get(), 1), 2, 15, 0.05f));
// Level 4 trades
trades.get(4).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.DIAMOND, 5),
trades.get(4).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.DIAMOND, 5),
new ItemStack(ModItems.NUGGET_LEGGINGS.get(), 1), 2, 20, 0.05f));
trades.get(4).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 12),
trades.get(4).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET_BOOTS.get(), 1), 2, 20, 0.05f));
// Level 5 trades (Master)
trades.get(5).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 30),
trades.get(5).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 30),
new ItemStack(ModItems.NUGGET_HORSE_ARMOR.get(), 1), 1, 30, 0.1f));
trades.get(5).add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.DIAMOND, 10),
trades.get(5).add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.DIAMOND, 10),
new ItemStack(ModItems.NUGGET_SMITHING_TEMPLATE.get(), 1), 1, 30, 0.1f));
}
}
@SubscribeEvent
public static void addWanderingTrades(WandererTradesEvent event) {
List<VillagerTrades.ItemListing> genericTrades = event.getGenericTrades();
List<VillagerTrades.ItemListing> rareTrades = event.getRareTrades();
List<TradeOffers.Factory> genericTrades = event.getGenericTrades();
List<TradeOffers.Factory> rareTrades = event.getRareTrades();
// Add generic wandering trader trades
genericTrades.add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 12),
genericTrades.add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 12),
new ItemStack(ModItems.NUGGET.get(), 3), 2, 8, 0.2f));
// Add rare wandering trader trades
rareTrades.add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.DIAMOND, 8),
rareTrades.add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.DIAMOND, 8),
new ItemStack(ModItems.NUGGET_MUSIC_DISC.get(), 1), 1, 12, 0.2f));
rareTrades.add((level, entity, random) -> new MerchantOffer(
new ItemCost(Items.EMERALD, 25),
rareTrades.add((level, entity, random) -> new TradeOffer(
new TradedItem(Items.EMERALD, 25),
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.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.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier;
public class ModItemGroups {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, NuggetMod.MOD_ID);
public static final DeferredRegister<ItemGroup> CREATIVE_MODE_TABS =
DeferredRegister.create(RegistryKeys.ITEM_GROUP, NuggetMod.MOD_ID);
public static final Supplier<CreativeModeTab> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
public static final Supplier<ItemGroup> NUGGET_BLOCKS_GROUP = CREATIVE_MODE_TABS.register("nugget_blocks",
() -> ItemGroup.create(ItemGroup.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());
.displayName(Text.translatable("creativetab.nuggetmod.nugget_blocks"))
.entries((displayContext, entries) -> {
entries.add(ModBlocks.NUGGET_BLOCK.get());
entries.add(ModBlocks.RAW_NUGGET_BLOCK.get());
entries.add(ModBlocks.NUGGET_ORE.get());
entries.add(ModBlocks.NUGGET_DEEPSLATE_ORE.get());
}).build());
public static final Supplier<CreativeModeTab> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items",
() -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, -1)
public static final Supplier<ItemGroup> NUGGET_ITEMS_GROUP = CREATIVE_MODE_TABS.register("nugget_items",
() -> ItemGroup.create(ItemGroup.Row.TOP, -1)
.icon(() -> new ItemStack(ModItems.NUGGET.get()))
.withTabsBefore(Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nugget_blocks"))
.title(Component.translatable("creativetab.nuggetmod.nugget_items"))
.displayItems((displayContext, entries) -> {
entries.accept(ModItems.NUGGET.get());
entries.accept(ModItems.RAW_NUGGET.get());
.withTabsBefore(Identifier.of(NuggetMod.MOD_ID, "nugget_blocks"))
.displayName(Text.translatable("creativetab.nuggetmod.nugget_items"))
.entries((displayContext, entries) -> {
entries.add(ModItems.NUGGET.get());
entries.add(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.add(ModItems.NUGGET_SWORD.get());
entries.add(ModItems.NUGGET_PICKAXE.get());
entries.add(ModItems.NUGGET_AXE.get());
entries.add(ModItems.NUGGET_SHOVEL.get());
entries.add(ModItems.NUGGET_HOE.get());
entries.add(ModItems.NUGGET_SPEAR.get());
entries.accept(ModItems.NUGGET_HELMET.get());
entries.accept(ModItems.NUGGET_CHESTPLATE.get());
entries.accept(ModItems.NUGGET_LEGGINGS.get());
entries.accept(ModItems.NUGGET_BOOTS.get());
entries.add(ModItems.NUGGET_HELMET.get());
entries.add(ModItems.NUGGET_CHESTPLATE.get());
entries.add(ModItems.NUGGET_LEGGINGS.get());
entries.add(ModItems.NUGGET_BOOTS.get());
entries.accept(ModItems.NUGGET_HORSE_ARMOR.get());
entries.accept(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.accept(ModItems.NUGGET_MUSIC_DISC.get());
entries.add(ModItems.NUGGET_HORSE_ARMOR.get());
entries.add(ModItems.NUGGET_SMITHING_TEMPLATE.get());
entries.add(ModItems.NUGGET_MUSIC_DISC.get());
}).build());
public static void registerItemGroups(IEventBus eventBus) {

View File

@@ -1,20 +1,18 @@
package dev.sillyangel.nuggetmod.neoforge.particle;
import dev.sillyangel.nuggetmod.NuggetMod;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.registries.Registries;
import net.minecraft.registry.RegistryKeys;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier;
public class ModParticles {
public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES =
DeferredRegister.create(Registries.PARTICLE_TYPE, NuggetMod.MOD_ID);
public static final DeferredRegister<net.minecraft.particle.ParticleType<?>> PARTICLE_TYPES =
DeferredRegister.create(RegistryKeys.PARTICLE_TYPE, NuggetMod.MOD_ID);
public static final Supplier<SimpleParticleType> NUGGET_PARTICLE =
PARTICLE_TYPES.register("nugget_particle", () -> new SimpleParticleType(false));
public static final Supplier<net.minecraft.particle.SimpleParticleType> NUGGET_PARTICLE =
PARTICLE_TYPES.register("nugget_particle", () -> new net.minecraft.particle.SimpleParticleType(false));
public static void registerParticles(IEventBus 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 dev.sillyangel.nuggetmod.NuggetMod;
import dev.sillyangel.nuggetmod.block.ModBlocks;
import net.minecraft.resources.ResourceKey;
import net.minecraft.core.registries.Registries;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.ai.village.poi.PoiType;
import net.minecraft.world.entity.npc.villager.VillagerProfession;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;
import java.util.function.Supplier;
public class ModVillagers {
public static final DeferredRegister<PoiType> POI_TYPES =
DeferredRegister.create(Registries.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID);
public static final DeferredRegister<PointOfInterestType> POI_TYPES =
DeferredRegister.create(RegistryKeys.POINT_OF_INTEREST_TYPE, NuggetMod.MOD_ID);
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 =
ResourceKey.create(Registries.VILLAGER_PROFESSION, Identifier.fromNamespaceAndPath(NuggetMod.MOD_ID, "nuggeter"));
public static final RegistryKey<VillagerProfession> NUGGETER_KEY =
RegistryKey.of(RegistryKeys.VILLAGER_PROFESSION, Identifier.of(NuggetMod.MOD_ID, "nuggeter"));
public static final Supplier<PoiType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi",
() -> new PoiType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateDefinition().getPossibleStates()), 1, 1));
public static final Supplier<PointOfInterestType> NUGGETER_POI = POI_TYPES.register("nuggeter_poi",
() -> new PointOfInterestType(ImmutableSet.copyOf(ModBlocks.NUGGET_BLOCK.get().getStateManager().getStates()), 1, 1));
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(),
poiTypeHolder -> poiTypeHolder.value() == NUGGETER_POI.get(),
ImmutableSet.of(), ImmutableSet.of(),
SoundEvents.VILLAGER_WORK_LIBRARIAN));
SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN));
public static void registerVillagers(IEventBus eventBus) {
POI_TYPES.register(eventBus);