• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I've been trying to get a config file working for my mod so that certain armor sets can be disabled. I followed a tutorial i found on youtube, however it doesnt seem to be working.   It seems that i am always getting the default value for each option, rather than the one in the config file.   My config class is as follows:   import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import org.apache.commons.lang3.tuple.Pair; public class ArmorConfig { public static class Common { public final BooleanValue enableOakWood; public final BooleanValue enableBirchWood; public final BooleanValue enableJungleWood; public final BooleanValue enableSpruceWood; public final BooleanValue enableDarkOakWood; public final BooleanValue enableAcaciaWood; public final BooleanValue enableCactus; public final BooleanValue enableObsidian; public final BooleanValue enableMagma; public final BooleanValue enableMelon; public final BooleanValue enableQuartz; public final BooleanValue enableBone; public final BooleanValue enableMolten; public final BooleanValue enablePumpkin; public final BooleanValue enablePhantom; public final BooleanValue enableGhost; public final BooleanValue enableCryingObsidian; public final BooleanValue enableIce; public final BooleanValue enableSnow; public final BooleanValue enableGlowstone; public final BooleanValue enablePrismarineShard; public final BooleanValue enablePrismarineCrystal; public final BooleanValue enableHoneycomb; public final BooleanValue enableEmerald; public final BooleanValue enableEnder; Common(ForgeConfigSpec.Builder builder){ builder.comment("Armor Config") .push("Armor"); enableOakWood = builder .comment("Enable or Disable Oak Wood Armor") .worldRestart() .define("enableOakWood", true); enableBirchWood = builder .comment("Enable or Disable Birch Wood Armor") .worldRestart() .define("enableBirchWood", true); enableJungleWood = builder .comment("Enable or Disable Jungle Wood Armor") .worldRestart() .define("enableJungleWood", true); enableSpruceWood = builder .comment("Enable or Disable Spruce Wood Armor") .worldRestart() .define("enableSpruceWood", true); enableDarkOakWood = builder .comment("Enable or Disable Dark Oak Wood Armor") .worldRestart() .define("enableDarkOakWood", true); enableAcaciaWood = builder .comment("Enable or Disable Acacia Wood Armor") .worldRestart() .define("enableAcaciaWood", true); enableCactus = builder .comment("Enable or Disable Cactus Armor") .worldRestart() .define("enableCactus", true); enableObsidian = builder .comment("Enable or Disable Obsidian Armor") .worldRestart() .define("enableObsidian", true); enableMagma = builder .comment("Enable or Disable Magma Armor") .worldRestart() .define("enableMagma", true); enableMelon = builder .comment("Enable or Disable Melon Armor") .worldRestart() .define("enableMelon", true); enableQuartz = builder .comment("Enable or Disable Quartz Armor") .worldRestart() .define("enableQuartz", true); enableBone = builder .comment("Enable or Disable Bone Armor") .worldRestart() .define("enableBone", true); enableMolten = builder .comment("Enable or Disable Molten Armor") .worldRestart() .define("enableMolten", true); enablePumpkin = builder .comment("Enable or Disable Pumpkin Armor") .worldRestart() .define("enablePumpkin", true); enablePhantom = builder .comment("Enable or Disable Phantom Armor") .worldRestart() .define("enablePhantom", true); enableGhost = builder .comment("Enable or Disable Ghost Armor") .worldRestart() .define("enableGhost", true); enableCryingObsidian = builder .comment("Enable or Disable Crying Obsidian Armor") .worldRestart() .define("enableCryingObsidian", true); enableIce = builder .comment("Enable or Disable Ice Armor") .worldRestart() .define("enableIce", true); enableSnow = builder .comment("Enable or Disable Snow Armor") .worldRestart() .define("enableSnow", true); enableGlowstone = builder .comment("Enable or Disable Glowstone Armor") .worldRestart() .define("enableGlowstone", true); enablePrismarineShard = builder .comment("Enable or Disable Prismarine Shard Armor") .worldRestart() .define("enablePrismarineShard", true); enablePrismarineCrystal = builder .comment("Enable or Disable Prismarine Crystal Armor") .worldRestart() .define("enablePrismarineCrystal", true); enableHoneycomb = builder .comment("Enable or Disable Honeycomb Armor") .worldRestart() .define("enableHoneycomb", true); enableEmerald = builder .comment("Enable or Disable Emerald Armor") .worldRestart() .define("enableEmerald", true); enableEnder = builder .comment("Enable or Disable Ender Armor") .worldRestart() .define("enableEnder", true); builder.pop(); } } public static final ForgeConfigSpec COMMON_SPEC; public static final Common COMMON; static{ final Pair<Common, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(Common::new); COMMON_SPEC = specPair.getRight(); COMMON = specPair.getLeft(); } }   and the config file (generated):   #Armor Config [Armor] #Enable or Disable Cactus Armor enableCactus = true #Enable or Disable Honeycomb Armor enableHoneycomb = true #Enable or Disable Oak Wood Armor enableOakWood = true #Enable or Disable Obsidian Armor enableObsidian = true #Enable or Disable Ice Armor enableIce = true #Enable or Disable Glowstone Armor enableGlowstone = true #Enable or Disable Acacia Wood Armor enableAcaciaWood = true #Enable or Disable Crying Obsidian Armor enableCryingObsidian = true #Enable or Disable Molten Armor enableMolten = true #Enable or Disable Melon Armor enableMelon = true #Enable or Disable Ender Armor enableEnder = true #Enable or Disable Prismarine Crystal Armor enablePrismarineCrystal = true #Enable or Disable Birch Wood Armor enableBirchWood = true #Enable or Disable Pumpkin Armor enablePumpkin = true #Enable or Disable Spruce Wood Armor enableSpruceWood = true #Enable or Disable Magma Armor enableMagma = true #Enable or Disable Dark Oak Wood Armor enableDarkOakWood = true #Enable or Disable Quartz Armor enableQuartz = true #Enable or Disable Ghost Armor enableGhost = true #Enable or Disable Emerald Armor enableEmerald = true #Enable or Disable Jungle Wood Armor enableJungleWood = true #Enable or Disable Bone Armor enableBone = true #Enable or Disable Phantom Armor enablePhantom = true #Enable or Disable Snow Armor enableSnow = true #Enable or Disable Prismarine Shard Armor enablePrismarineShard = true   Here is where i'm expecting to load the config (the main class for the mod):   import com.bailym.extraarmor.config.ArmorConfig; import com.bailym.extraarmor.util.RegistryHandler; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraftforge.common.MinecraftForge; 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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // The value here should match an entry in the META-INF/mods.toml file @Mod("extraarmor") public class ExtraArmor { public static final String MOD_ID = "extraarmor"; // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public ExtraArmor() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); //HERE IS WHERE I AM REGISTERING THE CONFIG AND CHECKING ONE OF THE VALUES ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ArmorConfig.COMMON_SPEC); //DOESNT GIVE THE VALUE IN THE CONFIG FILE. ONLY THE DEFAULT VALUE IN THE CONFIG CLASS System.out.println(ArmorConfig.COMMON.enableOakWood.get()); //Call the method to initialize the registry. (Multiple registries require multiple calls). RegistryHandler.init(); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { } //Creates a custom ItemGroup with the label extraArmorTab. In game Label can be set in lang files. public static final ItemGroup TAB = new ItemGroup("extraArmorTab") { //Overrides the vanilla createIcon method to chnge the icon used for this tab to a new item. @Override public ItemStack createIcon() { return new ItemStack(Items.LEATHER_CHESTPLATE); } }; }     Any help is appreciated. Thanks.
    • I actually figured it out just before you posted this, but thanks anyway!
    • One step ahead?   @SubscribeEvent     public void clientTickEnd(TickEvent.PlayerTickEvent event){         if (event.phase != Phase.START || event.player == null) return;         PlayerEntity player = event.player;         Vector3d v3 = player.getLook(1);         SmallFireballEntity fireball = new SmallFireballEntity(player.getEntityWorld(), player.getPosX(), player.getPosY() + player.getEyeHeight(), player.getPosZ(), v3.x, v3.y, v3.z);         fireball.setShooter(player);         player.getEntityWorld().addEntity(fireball); }   Should I move it out of @EventBusSubscriber to somewhere else?
    • Alright, where can I learn about the ObsfuscationReflectionHelper and SRG names? (and by register, you mean registering to the VALUES field from the WoodType class?) doesn't this do it? Atlases.SIGN_MATERIALS.put(ModWoodType.EFFETE, new RenderMaterial(Atlases.SIGN_ATLAS, new ResourceLocation("effetewood:entity/signs/effete"))); if it doesn't, can you point me towards how I would write my own renderer?
    • You still need reflection to register it.   I don't know. It might be better to just make your own renderer and not use this vanilla stuff.
  • Topics

  • Who's Online (See full list)