Unable to mount resources
LemADEC opened this issue ยท 3 comments
Useful information to include:
- Minecraft version 1.15.2
- CC: Tweaked version 1.95.3
- Logs:
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling getClass().getResource("/assets/warpdrive/lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is file:/C:/_mcdev/_sandbox/_mods/WarpDrive-1.15/build/resources/main/assets/warpdrive/lua.computercraft/common
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling getClass().getResource("/assets/warpdrive/lua.computercraft/commonInvalid")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "/assets/lua.computercraft/common/")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "/assets/lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "assets/lua.computercraft/common/")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "assets/lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "/assets/warpdrive/lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "/assets/warpdrive/lua.computercraft/common/")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "assets/warpdrive/lua.computercraft/common")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Calling ComputerCraftAPI.createResourceMount("warpdrive", "assets/warpdrive/lua.computercraft/common/")
[12:55:26] [ComputerCraft-Computer-Runner-0/INFO] [warpdrive/]: [CC] Returned value is null
- Detailed reproduction steps:
I'm updating my mod from 1.12.2 to 1.15.2. The resources mounting was working back on 1.12.2.
Apart from renaming the assets to be lowercase, not much else have changed in terms of creating the resources.
The first 2 calls to getClass().getResource() shows that the folder exist and an invalid one is properly detected.
All following calls to ComputerCraftAPI.createResourceMount() are failling while trying different variations of the path.
I was expecting at least a debug log from ComputerCraftAPI itself about this failure, but nothing is seen here.
Here's the code snippet used for above logs :
String resourcePath = "/assets/" + WarpDrive.MODID + "/" + pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling getClass().getResource(\"%s\")",
resourcePath ));
URL url = getClass().getResource(resourcePath);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
url ));
resourcePath = "/assets/" + WarpDrive.MODID + "/" + pathAsset + "Invalid";
WarpDrive.logger.info(String.format("[CC] Calling getClass().getResource(\"%s\")",
resourcePath ));
url = getClass().getResource(resourcePath);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
url ));
String pathTest = pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "/assets/" + pathAsset + "/";
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "/assets/" + pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "assets/" + pathAsset + "/";
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "assets/" + pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "/assets/warpdrive/" + pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "/assets/warpdrive/" + pathAsset + "/";
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "assets/warpdrive/" + pathAsset;
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
pathTest = "assets/warpdrive/" + pathAsset + "/";
WarpDrive.logger.info(String.format("[CC] Calling ComputerCraftAPI.createResourceMount(\"%s\", \"%s\")",
WarpDrive.MODID, pathTest ));
mountCommon = ComputerCraftAPI.createResourceMount(WarpDrive.MODID, pathTest);
WarpDrive.logger.info(String.format("[CC] Returned value is %s",
mountCommon ));
As per the docs, this accepts a path relative to your mod's datapack root, rather than the jar root.
So you'll want a call like createResourceMount(WarpDrive.MODID, "lua.computercraft/common")
, which resolves to /data/warpdrive/lua.computercraft/common
.
I'll try to clarify the docs a little and make the mount warn if we can't find any matching files.
I've probably missed something when testing the datapack approach. It works now, keep up the good updates!