saxon564 Posted October 13, 2017 Share Posted October 13, 2017 I have been slowing getting this thing working again and now I have found a chunk that is not working. I setup an int array which carries potion effect ids. When I cycle through it right after it is set, it has the correct information, but when I cycle through it to actually use the stored ids, for some reason it is empty. All other variable seem to work, except this one and possibly the arrays for the duration and amplification for each effect. I am declaring the variable here: https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L102 Initializing it here:https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L1025 and using it here:https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L473 Where this class is first called to build the entities is here:https://github.com/saxon564/MoChickens/blob/master/src/main/java/com/saxon564/mochickens/entities/mobs/EntityMoChicken.java#L230 Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 13, 2017 Author Share Posted October 13, 2017 Thank you. I will make the change when I get home later today. Would you be willimg to give me an example of potionNBT being used in a config file? I am interested in possibly going that route, I'm just just not sure how that would look in a config file. Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 13, 2017 Author Share Posted October 13, 2017 Alright. Well to get back to the original reason for this post, were you able to find why my array was beimg emptied? Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 13, 2017 Author Share Posted October 13, 2017 7 hours ago, diesieben07 said: I am not sure why you (or I) should spend time on trying to fix an issue with code that will then be thrown away. Please first update to use non-numerical IDs and then we can discuss your issue. Changed it to a String and am now getting the potion through the resource location. But that aside, the issue remains the same. Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 13, 2017 Author Share Posted October 13, 2017 9 minutes ago, diesieben07 said: In your config creation classes (by the way, why are the like 20 million of these?) you still create "Effect IDs" as an integer array. The entity class then reads it as a string array, which works, but every time you change the config to contain a string, it will revert back to the default, because a string cannot be parsed as a number. Aside from that, the loading worked just fine for me, the array contained one entry, "1", the default ID. Each of the mods is customizable and runs off a different config, the class I have been showing you is a base class they all extend. I have uploaded the new config code updating all of them to use the Strings, but before I was just testing 1 of the mobs since they all in the end use the same thing. The loading doesn't seem to have the issue. the issue seems to be when it actually trys to create the potion effect. Using strings now is causing it to crash since strings can actually be null. I have added the crash report in the spoiler. Spoiler ---- Minecraft Crash Report ---- // This doesn't make any sense! Time: 10/13/17 6:28 PM Description: Ticking entity java.lang.NullPointerException: Ticking entity at net.minecraft.util.ResourceLocation.splitObjectName(ResourceLocation.java:35) at net.minecraft.util.ResourceLocation.<init>(ResourceLocation.java:20) at net.minecraft.potion.Potion.getPotionFromResourceLocation(Potion.java:61) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.applyEffects(EntityMoChicken.java:477) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.attackEntityAsMob(EntityMoChicken.java:425) at net.minecraft.entity.ai.EntityAIAttackMelee.checkAndPerformAttack(EntityAIAttackMelee.java:169) at net.minecraft.entity.ai.EntityAIAttackMelee.updateTask(EntityAIAttackMelee.java:158) at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:114) at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2470) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:640) at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:194) at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:46) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.onLivingUpdate(EntityMoChicken.java:527) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2296) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:344) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2122) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:876) at net.minecraft.world.World.updateEntity(World.java:2088) at net.minecraft.world.World.updateEntities(World.java:1896) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:648) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:795) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:699) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at net.minecraft.util.ResourceLocation.splitObjectName(ResourceLocation.java:35) at net.minecraft.util.ResourceLocation.<init>(ResourceLocation.java:20) at net.minecraft.potion.Potion.getPotionFromResourceLocation(Potion.java:61) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.applyEffects(EntityMoChicken.java:477) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.attackEntityAsMob(EntityMoChicken.java:425) at net.minecraft.entity.ai.EntityAIAttackMelee.checkAndPerformAttack(EntityAIAttackMelee.java:169) at net.minecraft.entity.ai.EntityAIAttackMelee.updateTask(EntityAIAttackMelee.java:158) at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:114) at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2470) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:640) at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:194) at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:46) at com.saxon564.mochickens.entities.mobs.EntityMoChicken.onLivingUpdate(EntityMoChicken.java:527) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2296) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:344) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2122) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:876) at net.minecraft.world.World.updateEntity(World.java:2088) -- Entity being ticked -- Details: Entity Type: mochickens:enchantedchicken (com.saxon564.mochickens.entities.mobs.EntityEnchantedChicken) Entity ID: 2282 Entity Name: entity.EnchantedChicken.name Entity's Exact location: 36.45, 62.00, 246.62 Entity's Block location: World: (36,62,246), Chunk: (at 4,3,6 in 2,15; contains blocks 32,0,240 to 47,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, 0.00, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.updateEntities(World.java:1896) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:648) -- Affected level -- Details: Level name: Test All players: 1 total; [EntityPlayerMP['saxon564'/341, l='Test', x=36.45, y=62.00, z=246.62]] Chunk stats: ServerChunkCache: 635 Drop: 0 Level seed: 164818281865442326 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (28,64,252), Chunk: (at 12,4,12 in 1,15; contains blocks 16,0,240 to 31,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 180140 game time, 6000 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 1 (now: false), thunder time: 1 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:795) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:699) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) at java.lang.Thread.run(Unknown Source) -- System Details -- Details: Minecraft Version: 1.11.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_144, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 479024392 bytes (456 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP 9.38 Powered by Forge 13.20.1.2476 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA minecraft{1.11.2} [Minecraft] (minecraft.jar) UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11.2-13.20.1.2476.jar) UCHIJAAAA forge{13.20.1.2476} [Minecraft Forge] (forgeSrc-1.11.2-13.20.1.2476.jar) UCHIJAAAA mochickens{1.6.3} [Mo Chickens] (bin) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 1 / 8; [EntityPlayerMP['saxon564'/341, l='Test', x=36.45, y=62.00, z=246.62]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 14, 2017 Author Share Posted October 14, 2017 2 hours ago, diesieben07 said: I know. I cloned your repo. That is not a justification to make 20 classes that are all basically identical... Then what would you do for it??? 2 hours ago, diesieben07 said: Your array is initialized to contain 50 null elements. Why you do this is beyond me, but I am not sure what else you expected but for the array to , well, contain null. Why you are not using a List / ArrayList and why you are using an indexed for-loop instead of a foreach loop is also beyond me. I took what you said and removed the '= new String[50]' and '=new int[50]' (amplifications and durations) and it is now working. As well as deleted the config files that I had before the change since I realized I forgot to do that before. Quote Link to comment Share on other sites More sharing options...
saxon564 Posted October 14, 2017 Author Share Posted October 14, 2017 (edited) I would assume you would pass a List into the constructor? If not and you mean all the options as variables, that would be 60 variables to pass, which in my mind is a lot of clutter which would all be in 24 places based of the current number of entities in my mod. (23 entities plus the constructor. Considering this, there really is no clean and better way to handle it... At least in my mind. Also considering if you were thinking of passing a List, then there would be 23 calls to the constructor which would each have the list declared with all 60 options. If you can think of something that would be cleaner and use less file space, I am more than happy to try it Edit: Maybe having a class called "ChickenConfig" with a sub-class for each of the entities so they would be called by ChickenConfig.BeefyChickenConfig(event) or something like that. It would create a class that is over 4000 lines though, so that part makes me hesitant. Edited October 14, 2017 by saxon564 Added a thought Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.