Jump to content

webox

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

webox's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello everyone! I've just published my first Forge mod on curseforge, It's called "Illegal easy moh". This is a mod for servers that are looking to restrict how users interact with different items. The mod allows marking items so they are not allowed to be carried, used, or have restrictions on usage. With this mod, admins can move the rules that are often written inside the discord server's channels inside the game domain and be a part of the item's tooltip. Features Provides a registry where you can register items and or complete namespaces and assign them an illegality category Registered items can fall into the following categories: BANNED ILLEGAL RESTRICTED Prevent users from carrying BANNED items on their inventories, either by destroying them or throwing them on the ground automatically on pickup Prevent users from equipping or carrying ILLEGAL items on their hands or armor slots Customize registered items so they can have a message that explains to the users why the item is configured as it is via tooltips Configure through JSON configuration files or by using commands English and Spanish translations Short video showing how it works: "Small disclaimer, ignore the fact that the video calls it "Illegal easy mod" I had to change the name due to curseforge policies and I haven't changed the video yet" If you want to give it a go, you can get it here: https://www.curseforge.com/minecraft/mc-mods/illegal-easy-moh Thanks everyone, specially all who helped in the forum with questions about forge!
  2. Nice! Thanks a lot, I was not aware of that wiki, I was only reading the official docs and a youtube series but it didn't help on this specific case. I'll sure read the wiki. Thanks again for the quick response!
  3. Hi warjort! Thanks for the answer, it steered me in the right direction!! As you said, the error was that I was apprently trying to access before registration finished. As for the wordlgen part, I should've used a better example, it was just a sample config from the tutorial I was doing, my mod doesn't use worldgen. What I need to do in my config file is store a few strings (item names) that are used to fill a dictionary. What I don't fully understand is how to know that registration has ended and that the configurations are ready to be read. Yersterday I was placing that println that I showed in the post right after: MinecraftForge.EVENT_BUS.register(this); But now I assume that's probably not synchronous and that was the reason why I wasn't getting the correct info. What I did now that worked was use the event "onServerStarting" so I did: @SubscribeEvent public void onServerStarting(ServerStartingEvent event) { InitizalizeRegistry(); // Do something when the server starts LOGGER.info("HELLO from server starting"); } private static void InitizalizeRegistry() { System.out.println(MyModCommonConfigs.CITRINE_ORE_VEIN_SIZE.get()); } When I do that, I get the correct value but I'm not sure if it's the correct thing to do. So I have a few follow up question - Is there an event to subscribe that is triggered when the registration has ended? Is that event onServerStarting? Thanks a lot for the help! I've just started learning about minecraft modding with forge like a week or two ago so I'm struggling a bit
  4. Hi! I'm having an issue with config files being ignored after editing and restarting the client or server (Neither client, common nor server configs are working). I'm learning how to use config files so my first file is pretty straightforward, I created a config class that looks like this: package com.webox.myMod.config; import net.minecraftforge.common.ForgeConfigSpec; public class MyModCommonConfigs { public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec SPEC; public static final ForgeConfigSpec.ConfigValue<Integer> CITRINE_ORE_VEINS_PER_CHUNK; public static final ForgeConfigSpec.ConfigValue<Integer> CITRINE_ORE_VEIN_SIZE; static { BUILDER.push("Configs for my Mod"); CITRINE_ORE_VEINS_PER_CHUNK = BUILDER.comment("How many Citrine Ore Veins spawn per chunk!") .define("Veins Per Chunk", 7); CITRINE_ORE_VEIN_SIZE = BUILDER.comment("How many Citrine Ore Blocks spawn in one Vein!") .defineInRange("Vein Size", 8, 4, 20); BUILDER.pop(); SPEC = BUILDER.build(); } } And in my main class I'm using: public MyMod() { // Register the setup method for modloading IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); ModItems.register(eventBus); // Passing setup functions as parameters with :: operator eventBus.addListener(this::commonSetup); eventBus.addListener(this::clientSetup); //////THIS IS WHERE I REGISTER MY CONFIG FILE //// ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, MyModCommonConfigs.SPEC); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); var bus = MinecraftForge.EVENT_BUS; } And finally, when I try to read a configuration I use: System.out.println(MyModCommonConfigs.CITRINE_ORE_VEIN_SIZE.get()); This always outputs the default value no matter what the file says. ------------------------------------- The entire process seems to work at first, since the toml file is created correctly but whenever I edit for example the vein size, and then try to access it from a place after the registration of the config file I get the default value and not the value that I've overwritten in the toml file. I've no idea what I might be doing wrong, I checked some mods on github and they all seem to be doing the same as me. Some important remarks that may help pinpoint the problem: - I'm not getting any errors on the console, at least that I can distinguish - I've tried making a client config, a sever config and a common config all with the same result - I've already tried to generate the jar file and import it into a running forge server and I got the same result, so it's not just on my dev env - I'm using windows - I followed this Kaupenjoe tutorial https://www.youtube.com/watch?v=QN9jq3_V-I8&list=PLKGarocXCE1Hut51TKKqZKqVZtKLZC48x&index=62&ab_channel=ModdingbyKaupenjoe - I'm using forge 40.1.76 - I'm using minecraft 1.18.2 - Whenever I save the file, and the client or server are running I get a message from tracker that says that the file was modified and it's sending notifies - I've explored the forum with a ton of keywords but found nothing Thanks in advance! I Hope someone can help me
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.