[MC-121379] Functions, advancements and loot tables allow other filetypes than .mcfunction and .json Created: 26/Oct/17  Updated: 02/Jan/18  Resolved: 02/Jan/18

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 17w43b, Minecraft 17w45a, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w47b, Minecraft 17w50a
Fix Version/s: Minecraft 17w47a, Minecraft 17w48a, Minecraft 18w01a

Type: Bug
Reporter: alexander Thomsen Assignee: [Mojang] Dinnerbone (Nathan Adams)
Resolution: Fixed Votes: 12
Labels: advancement, data-pack, file, function

Attachments: Text File launcher_log.txt    
Issue Links:
Duplicate
is duplicated by MC-121380 .DS_store files aren't recognized and... Resolved
is duplicated by MC-121394 Functions Will Run If .mcfunction Is ... Resolved
is duplicated by MC-121751 The game attempts to parse files that... Resolved
is duplicated by MC-121939 Functions in datapacks causing fatal ... Resolved
is duplicated by MC-122197 Data packs cannot replace vanilla ass... Resolved
is duplicated by MC-122206 Unknown characters when reloading dat... Resolved
is duplicated by MC-123516 You cannot replace vanilla advancemen... Resolved
Relates
relates to MC-122473 Game crashes when resourcepack selected Resolved
CHK:
Confirmation Status: Confirmed

 Description   

I tried naming a function test.txt by forgetting to add the .mcfunction at the end, but the game still noticed the file. And because "txt" is 7 characters less than "mcfunction", the function name was cut off so it tried to load a function with a name length of less than 0 which caused an error.



 Comments   
Comment by [Mod] FVbico (Steven Verberne) [ 26/Oct/17 ]

Can confirm:

[21:08:15] [Server thread/ERROR]: Couldn't read function luigis_mansion:rooms/nieuw tekstd from luigis_mansion:functions/rooms/nieuw tekstdocument.txt
java.io.FileNotFoundException: luigis_mansion:functions/rooms/nieuw tekstdocument.txt
        at qa.a(SourceFile:61) ~[minecraft_server.jar:?]
        at qf.a(SourceFile:59) ~[minecraft_server.jar:?]
        at nt.a(SourceFile:142) [minecraft_server.jar:?]
        at qf.c(SourceFile:121) [minecraft_server.jar:?]
        at qf.a(SourceFile:109) [minecraft_server.jar:?]
        at net.minecraft.server.MinecraftServer.a(SourceFile:1369) [minecraft_server.jar:?]
        at net.minecraft.server.MinecraftServer.aM(SourceFile:1352) [minecraft_server.jar:?]
        at da.a(SourceFile:31) [minecraft_server.jar:?]
        at bj.a(SourceFile:92) [minecraft_server.jar:?]
        at bj.a(SourceFile:70) [minecraft_server.jar:?]
        at pa.c(SourceFile:855) [minecraft_server.jar:?]
        at pa.a(SourceFile:842) [minecraft_server.jar:?]
        at la.a(SourceFile:37) [minecraft_server.jar:?]
        at la.a(SourceFile:9) [minecraft_server.jar:?]
        at hv$1.run(SourceFile:13) [minecraft_server.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_131]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_131]
        at h.a(SourceFile:125) [minecraft_server.jar:?]
        at net.minecraft.server.MinecraftServer.D(SourceFile:637) [minecraft_server.jar:?]
        at nz.D(SourceFile:349) [minecraft_server.jar:?]
        at net.minecraft.server.MinecraftServer.C(SourceFile:593) [minecraft_server.jar:?]
        at net.minecraft.server.MinecraftServer.run(SourceFile:497) [minecraft_server.jar:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Comment by [Mod] tryashtar [ 26/Oct/17 ]

Is this also the case for loot tables?

Comment by alexander Thomsen [ 28/Oct/17 ]

Yes. I've updated the title.

Comment by CreeperMagnet_ [ 10/Nov/17 ]

Please update this to the correct versions- this still affects 17w45b, and prevents all mac users from using functions at all.

Comment by Withered Away [ 15/Nov/17 ]

As far as I can tell, the bug also affects the new 17w46a snapshot.

Comment by CreeperMagnet_ [ 15/Nov/17 ]

This seems to not apply to the new snapshot. Seems like they've indirectly fixed it.

EDIT: They only fixed this problem for functions. Loot tables, and advancements are still affected.

Comment by alexander Thomsen [ 25/Nov/17 ]

I still experience this bug in 17w47b with the filepath being data/(namespace)/functions/test.txt
If I use /reload it just comes up with the message String index out of range: -3 which is fine, but if I load up the map, the game crashes (Or rather it stops responding, which forces me to kill the process).

A proposed fix is to ignore files that don't have the necessary [a-z0-9/._-] format or correct file extension instead of stopping the entire datapack from being loaded or crashing the game.

Comment by [Mod] Skylinerw [ 23/Dec/17 ]

Via MC-123516 appears to not be fixed for .DS_Store

Generated at Thu Feb 22 10:48:18 CST 2018 using JIRA 7.2.8#72010-sha1:dc33de34ffa065bef267bff4768b99ca94e2c00c.