diff --git a/gradle.properties b/gradle.properties index 8d03d98..e1ffaea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ mapping_version=2023.09.03-1.20.1 mod_id=util_rings mod_name=Utility Rings mod_license=MIT -mod_version=1.20-0.1.0 +mod_version=1.20-1.0.0.0 mod_group_id=com.skdevstudios mod_authors=Steven'specCon18'Carpenter mod_description=Adds a set of rings for the curios ring slot that solve small issues in mc ex.) I fucking hate lava in my mines :P diff --git a/src/main/java/com/example/examplemod/UtilRings.java b/src/main/java/com/example/examplemod/UtilRings.java deleted file mode 100644 index 79ea9f9..0000000 --- a/src/main/java/com/example/examplemod/UtilRings.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.example.examplemod; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(UtilRings.MODID) -public class UtilRings -{ - // Define mod id in a common place for everything to reference - public static final String MODID = "util_rings"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); - - // Creates a new Block with the id "examplemod:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); - // Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); - - // Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2 - public static final RegistryObject EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Properties().food(new FoodProperties.Builder() - .alwaysEat().nutrition(1).saturationMod(2f).build()))); - - // Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab - public static final RegistryObject EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event - }).build()); - - public UtilRings() - { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - // Register the Deferred Register to the mod event bus so tabs get registered - CREATIVE_MODE_TABS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - - // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); - } - - private void commonSetup(final FMLCommonSetupEvent event) - { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - - if (Config.logDirtBlock) - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - - LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); - - Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); - } - - // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) - { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents - { - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} diff --git a/src/main/java/com/example/examplemod/Config.java b/src/main/java/com/skdevstudios/util_rings/Config.java similarity index 98% rename from src/main/java/com/example/examplemod/Config.java rename to src/main/java/com/skdevstudios/util_rings/Config.java index 8c10f5f..4f4d1c4 100644 --- a/src/main/java/com/example/examplemod/Config.java +++ b/src/main/java/com/skdevstudios/util_rings/Config.java @@ -1,4 +1,4 @@ -package com.example.examplemod; +package com.skdevstudios.util_rings; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; diff --git a/src/main/java/com/skdevstudios/util_rings/UtilRings.java b/src/main/java/com/skdevstudios/util_rings/UtilRings.java new file mode 100644 index 0000000..782491f --- /dev/null +++ b/src/main/java/com/skdevstudios/util_rings/UtilRings.java @@ -0,0 +1,75 @@ +package com.skdevstudios.util_rings; + +import com.mojang.logging.LogUtils; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; +import org.slf4j.Logger; + +// The value here should match an entry in the META-INF/mods.toml file +@Mod(UtilRings.MODID) +public class UtilRings +{ + // Define mod id in a common place for everything to reference + public static final String MODID = "util_rings"; + // Directly reference a slf4j logger + private static final Logger LOGGER = LogUtils.getLogger(); + // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace + public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); + // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace + public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); + // Creates a crafting material item named util_rings:iron_ring + public static final RegistryObject IRON_RING = ITEMS.register("iron_ring", () -> new Item(new Item.Properties().stacksTo(1))); + // Creates a crafting material item named util_rings:volcanic_glass_ring + public static final RegistryObject VOLCANIC_GLASS_RING = ITEMS.register("volcanic_glass_ring", () -> new Item(new Item.Properties().stacksTo(1))); + + // Creates a creative tab with the id "util_rings:rings_tab" for the example item, that is placed after the combat tab + public static final RegistryObject UTIL_RINGS_TAB = CREATIVE_MODE_TABS.register("rings_tab", () -> CreativeModeTab.builder() + .title(Component.translatable("itemGroup.rings_tab")) + .withTabsBefore(CreativeModeTabs.COMBAT) + .icon(() -> IRON_RING.get().getDefaultInstance()) + .displayItems((parameters, output) -> { + output.accept(IRON_RING.get()); + output.accept(VOLCANIC_GLASS_RING.get()); + }) + .build() + ); + + public UtilRings() + { + IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + // Register the commonSetup method for modloading + modEventBus.addListener(this::commonSetup); + // Register the Deferred Register to the mod event bus so items get registered + ITEMS.register(modEventBus); + // Register the Deferred Register to the mod event bus so tabs get registered + CREATIVE_MODE_TABS.register(modEventBus); + // Register ourselves for server and other game events we are interested in + MinecraftForge.EVENT_BUS.register(this); + // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us + ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); + } + + private void commonSetup(final FMLCommonSetupEvent event) + { + // Some common setup code + LOGGER.info("HELLO FROM COMMON SETUP"); + if (Config.logDirtBlock) + LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); + LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); + Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 0dc2be8..b4357de 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -16,7 +16,7 @@ issueTrackerURL="https://github.com/specCon18/Utility_Rings/issues" [[mods]] modId="util_rings" -version="1.20_0.1.0" +version="1.20-1.0.0.0" displayName="Utility Rings" # A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/ updateJSONURL="https://skdevstudios.dev/util_rings/updates.json" @@ -27,19 +27,19 @@ description=''' Adds a set of rings for the curios ring slot that solve small issues in mc ex.) I fucking hate lava in my mines :P ''' # A file name (in the root of the mod JAR) containing a logo for display -# logoFile="examplemod.png" +# logoFile="util_rings.png" showAsResourcePack=false -[[dependencies.examplemod]] +[[dependencies.util_rings]] modId="forge" mandatory=true versionRange="[47,)" ordering="NONE" side="BOTH" -[[dependencies.examplemod]] +[[dependencies.util_rings]] modId="minecraft" mandatory=true -versionRange="[1.20]" +versionRange="[1.20,1.21)" ordering="NONE" side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/util_rings/lang/en_us.json b/src/main/resources/assets/util_rings/lang/en_us.json new file mode 100644 index 0000000..fcba141 --- /dev/null +++ b/src/main/resources/assets/util_rings/lang/en_us.json @@ -0,0 +1,5 @@ +{ + "item.util_rings.iron_ring": "Iron Ring", + "item.util_rings.volcanic_glass_ring": "Ring of Volcanic Glass", + "itemGroup.rings_tab": "Utility Rings" +} \ No newline at end of file diff --git a/src/main/resources/assets/util_rings/models/item/iron_ring.json b/src/main/resources/assets/util_rings/models/item/iron_ring.json new file mode 100644 index 0000000..1a0341d --- /dev/null +++ b/src/main/resources/assets/util_rings/models/item/iron_ring.json @@ -0,0 +1,6 @@ +{ + "parent":"minecraft:item/generated", + "textures":{ + "layer0":"util_rings:item/iron_ring" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/util_rings/models/item/volcanic_glass_ring.json b/src/main/resources/assets/util_rings/models/item/volcanic_glass_ring.json new file mode 100644 index 0000000..aa25f6c --- /dev/null +++ b/src/main/resources/assets/util_rings/models/item/volcanic_glass_ring.json @@ -0,0 +1,6 @@ +{ + "parent":"minecraft:item/generated", + "textures":{ + "layer0":"util_rings:item/volcanic_glass_ring" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/util_rings/textures/item/iron_ring.png b/src/main/resources/assets/util_rings/textures/item/iron_ring.png new file mode 100644 index 0000000..dea939c Binary files /dev/null and b/src/main/resources/assets/util_rings/textures/item/iron_ring.png differ diff --git a/src/main/resources/assets/util_rings/textures/item/volcanic_glass_ring.png b/src/main/resources/assets/util_rings/textures/item/volcanic_glass_ring.png new file mode 100644 index 0000000..d7a208b Binary files /dev/null and b/src/main/resources/assets/util_rings/textures/item/volcanic_glass_ring.png differ diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 59c5240..5d304cc 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,6 @@ { "pack": { - "description": { - "text": "${mod_id} resources" - }, - "pack_format": ${pack_format_number} + "pack_format": 15, + "description": "util_rings resources" } } diff --git a/updates.json b/updates.json new file mode 100644 index 0000000..28d6a4a --- /dev/null +++ b/updates.json @@ -0,0 +1,10 @@ +{ + "homepage": "https://skdevstudios.com/util_rings/releases/", + "promos": { + "1.20.1-latest": "1.20-1.0.0", + "1.20.1-recommended": "1.20-1.0.0" + }, + "1.20.1": { + "1.20-1.0.0": "Initial Release" + } +} \ No newline at end of file