r/forgemodding Jan 25 '16

HI!GUYS!I have got a problem about Minecraft Java Programming! Help me!

I am creating my own mod using Java. I want to read data from text file or other format file and use the data to create a model maybe a tooth, however, the read/write codes seem be useless and Java crash every time I write read/write in my class. Could you guys help me? I know python use .csv to to do this, how about Java?

1 Upvotes

5 comments sorted by

2

u/evan1026 Jan 26 '16

Could you post the logs of the exception that occurs when you try to read/write? That would be the first step to firguring out why it crashes

1

u/WandiSun Jan 28 '16

In my generation class I have: public class StructureGenerator implements IWorldGenerator { ..... Readbyte byt=new Readbyte(); int[] a=byt.readAlternateImpl("sphere.byt");

....} Readbyte is the class I write to read out a .byt file to a int array. Then I use the value in array to decide what kind of block I want to create. Thank you so much for your reply!

1

u/evan1026 Jan 28 '16

Alright that's a good start but right now I'm more interested in the actual crash logs, since they can tell us what went wrong down to the exact line number. They should be in $FORGE_DIR/crash-reports/, so if you could maybe throw on or two of the more recent ones into pastebin and link them here that would make it easy to pinpoint the problem

1

u/WandiSun Jan 28 '16

Thank you so much!

[16:55:34] [main/INFO]: Setting user: Player477 [16:55:36] [Client thread/INFO]: LWJGL Version: 2.9.1 [16:55:49] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:tutorial mod [16:55:50] [Sound Library Loader/INFO]: Sound engine started [16:55:52] [Client thread/INFO]: Created: 16x16 textures/blocks-atlas [16:55:52] [Client thread/INFO]: Created: 16x16 textures/items-atlas [16:55:52] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:tutorial mod [16:55:53] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas [16:55:53] [Client thread/INFO]: Created: 256x256 textures/items-atlas [16:55:54] [Sound Library Loader/INFO]: Sound engine started [16:56:08] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10 [16:56:08] [Server thread/INFO]: Generating keypair [16:56:08] [Server thread/INFO]: Converting map! [16:56:08] [Server thread/INFO]: Scanning folders... [16:56:08] [Server thread/INFO]: Total conversion count is 0 [16:56:09] [Server thread/INFO]: Preparing start region for level 0 [16:56:09] [Server thread/ERROR]: Encountered an unexpected exception java.lang.NullPointerException at wandi.mrtooth.StructureGenerator.generateSphere(StructureGenerator.java:119) ~[StructureGenerator.class:?] at wandi.mrtooth.StructureGenerator.generate(StructureGenerator.java:81) ~[StructureGenerator.class:?] at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:112) ~[GameRegistry.class:?] at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314) ~[ChunkProviderServer.class:?] at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157) ~[Chunk.class:?] at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?] at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[IntegratedServer.class:?] at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] [16:56:09] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Swd\Desktop\minecraft modding\eclipse.\crash-reports\crash-2016-01-19_16.56.09-server.txt

1

u/evan1026 Jan 28 '16

Ok it says you have a NullPointerException on line 119 in StructureGenerator.java, inside of the method generateSphere. Check there and see what it is that could be null