Jump to content

Mod loading fails with java.lang.StringIndexOutOfBoundsException


luckykid

Recommended Posts

I am pretty new to modding and I cant get my mod to load. Minecraft wont load and it keeps giving me this error java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 11

@Mod("testmod")
public class testmod {
    private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "testmod");

    public static final RegistryObject<Block> PLASTIC_BLOCK = BLOCKS.register("Plastic", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).strength(5f).color(MaterialColor.COLOR_BLUE)));
    public archemistry() {
        BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }
}

This is the class that keeps breaking it

Link to comment
Share on other sites

Why don't you show the full error message?

One obvious thing is you can't have uppercase characters in block names or any ResourceLocation.

But AFAIK you don't get that error message for this.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

this is the full crash message

java.lang.Exception: Mod Loading has failed
    at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:55) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23183%23190!/:?] {re:classloading}
    at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:167) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23183%23190!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:583) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.Util.ifElse(Util.java:438) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading}
    at net.minecraft.client.Minecraft.lambda$new$3(Minecraft.java:577) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:885) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1113) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:698) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.0.11.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}

Link to comment
Share on other sites

Nope.

It doesn't even show the StringIndexOutOfBoundException you partially quoted earlier.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

and in the detailed description right here

Thread: Render thread
Stacktrace:
    at java.lang.String.checkBoundsBeginEnd(String.java:4604) ~[?:?] {}
-- MOD testmod --
Details:
    Mod File: /C:/Users/asher/OneDrive/Desktop/Forge/My Mod/run/mods/testmod-1.0.jar
    Failure message: Testmod has class loading errors
        java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 11
    Mod Version: 1.0.0.0
    Mod Issue URL: NOT PROVIDED
    Exception message: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 11
Stacktrace:
    at java.lang.String.checkBoundsBeginEnd(String.java:4604) ~[?:?] {}
    at java.lang.String.substring(String.java:2707) ~[?:?] {}
    at cpw.mods.cl.ProtectionDomainHelper.tryDefinePackage(ProtectionDomainHelper.java:32) ~[securejarhandler-2.1.4.jar:?] {}
    at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:117) ~[securejarhandler-2.1.4.jar:?] {}
    at cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219) ~[securejarhandler-2.1.4.jar:?] {}
    at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229) ~[securejarhandler-2.1.4.jar:?] {}
    at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219) ~[securejarhandler-2.1.4.jar:?] {}
    at java.lang.ClassLoader.loadClass(ClassLoader.java:632) ~[?:?] {}
    at java.lang.Class.forName(Class.java:545) ~[?:?] {}
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.<init>(FMLModContainer.java:48) ~[javafmllanguage-1.19.2-43.0.11.jar%23185!/:?] {}
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] {}
    at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] {}
    at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?] {}
    at net.minecraftforge.fml.javafmlmod.FMLJavaModLanguageProvider$FMLModTarget.loadMod(FMLJavaModLanguageProvider.java:62) ~[javafmllanguage-1.19.2-43.0.11.jar%23185!/:?] {}
    at net.minecraftforge.fml.ModLoader.buildModContainerFromTOML(ModLoader.java:276) ~[fmlcore-1.19.2-43.0.11.jar%23188!/:?] {}
    at net.minecraftforge.fml.ModLoader.lambda$buildMods$29(ModLoader.java:255) ~[fmlcore-1.19.2-43.0.11.jar%23188!/:?] {}
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?] {}
    at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1850) ~[?:?] {}
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] {}
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] {}
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?] {}
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] {}
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?] {}
    at net.minecraftforge.fml.ModLoader.buildMods(ModLoader.java:257) ~[fmlcore-1.19.2-43.0.11.jar%23188!/:?] {}
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?] {}
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?] {}
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?] {}
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] {}
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] {}
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?] {}
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?] {}
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?] {}
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?] {}
    at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?] {}
    at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:175) ~[fmlcore-1.19.2-43.0.11.jar%23188!/:?] {}
    at net.minecraftforge.client.loading.ClientModLoader.lambda$begin$1(ClientModLoader.java:91) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23183%23190!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.client.loading.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:111) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23183%23190!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:91) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23183%23190!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:468) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.run(Main.java:176) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.0.11_mapped_official_1.19.2-recomp.jar%23184!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.0.11.jar%2395!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}
 

Link to comment
Share on other sites

Looks like your class is not in a package?

For some reason Forge doesn't like mod classes in the root package.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

this may be something unrelated but now intellij can't seem to find minecraft

Exception in thread "main" java.lang.IllegalStateException: Failed to find system mod: minecraft
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.ModSorter.detectSystemMods(ModSorter.java:181)
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.ModSorter.buildUniqueList(ModSorter.java:145)
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.ModSorter.sort(ModSorter.java:53)
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.moddiscovery.ModValidator.stage2Validation(ModValidator.java:101)
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.FMLLoader.completeScan(FMLLoader.java:175)
    at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.FMLServiceProvider.completeScan(FMLServiceProvider.java:91)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServiceDecorator.onCompleteScan(TransformationServiceDecorator.java:174)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.lambda$triggerScanCompletion$24(TransformationServicesHandler.java:145)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
    at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.triggerScanCompletion(TransformationServicesHandler.java:147)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:94)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
    at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
    at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)

Link to comment
Share on other sites

I suggest, you download the mdk and modify that.

https://docs.minecraftforge.net/en/latest/gettingstarted/

It's almost like you are deliberately trying to make your mod have every possible misconfiguration/error.

While at the same time forcing us to continually ask for information rather than you posting the relevant files you have changed.

And you must have seen the footnote to my posts multiple times now.

 

Most likely this problem is caused by you not specifying your minecraft dependency or run configuration properly in the build.gradle or the mods.toml?

Or you changed something important and didn't regenerate your ide run configurations.

But I can only guess with you drip feeding information.

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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