Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted
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.

Posted
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'

 

 

Posted
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.

Posted (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 by saxon564
Added a thought

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Without Network protocol fix mod, I get kicked with a Network Protocol error when on LAN. Also, both of these issues are caused by a Null Pointer Exception/Screen cannot be null in a "Client Bound Player Combat Kill Packet".
    • You need a new "items" folder at  resources/assets/yourmodid/ there you add for every item model a .json file with the exact item/block name and fill it like this if it's an item: { "model": { "type": "minecraft:model", "model": "yourmodid:item/youritem" } } and so if its a block: { "model": { "type": "minecraft:model", "model": "yourmodid:block/youritem" } } There is also a generator for it you can do namy crazy things with it which replaces the previous hard coded Item Properties implementaion method (Bow pulling animation for example). https://misode.github.io/assets/item/
    • Hello! I'm playing a modpack (custom made) with some friends, and we have the server running on BisectHosting. We encountered a bug with an entity from The Box Of Horrors mod, that would crash the game whenever someone nearby it would log in. We tried to fix it by: 1) Editing the player.dat files to change the location of the affected players (something I had done successfully previously) 2) Updating the version of the mod we had (0.0.8.2) to the latest alpha version (0.0.8.3 However, after doing both of those, none of us are able to join the server, and we get the following errors: Server side: https://pastebin.com/J5sc3VQN Client side: Internal Server Error (that's basically all I've gotten) Please help! I've tried restoring the player data to how it was before I made the changes (Bisect allows you to restore deleted files) and deleting all of my player data files and I still get the same error. Deleting Box Of Horrors causes the error: Failed to load datapacks, cannot continue with server load.
    • Hey there! I'm trying to create a simple mod for Forge 1.21.1 that adds a few custom banner patterns that don't require any banner pattern items. To be completely honest, this is my first time modding for Minecraft, so after setting up the project in Intellij, I copied the parts of the source code from this mod on CurseForge that dealt with adding and registering banner patterns, including the lang and banner_pattern .json files. From what I understand, to add a banner pattern that doesn't require a banner pattern item, I only needed to create the registries for each pattern like in here and then register it in the main java class like here on Line 54. Additionally, in the lang/en_us.json file, add in the names for each respective banner color, and in the data/minecraft/tags/banner_pattern/no_items_required.json file, add each banner pattern that does not require a banner pattern item to make a banner. The project is able to compile when loading in Forge which makes me assume that the file structure I have is correct, but on loading a Minecraft world, this error appears in console and the loom is subsequently blank. [Worker-Main-1/ERROR] [minecraft/TagLoader]: Couldn't load tag minecraft:no_item_required as it is missing following references: *lists every added entry in no_item_required.json* The message clearly states something went wrong regarding when trying to load in the registries from the mod, but I have no clue what could be wrong with the code I have. Attached below are screenshots of what I currently have. Java Main Class Banner Registry Class File Structure Error in Console upon loading a Minecraft world What the loom shows without minecraft:no_item_required    The original mod I copied still functions completely, so if anyone can figure out why the registries for the mod I'm making isn't working, that would be greatly appreciated!    
    • Please someone help me to know how can I fix this generation error in the trees! I already uninstalled and reinstalled several mods in my modpack and can't figure out what is causing it.    
  • Topics

×
×
  • Create New...

Important Information

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