Jump to content

Recommended Posts

Posted

Ok, so I recently switched from using an Item for my gun to a dummy Block, so that I could have a 3D model. Now, when I right click it, it doesn't spawn the ammo, and prints the following error in to console:

http://paste.ubuntu.com/10971581/

Here is my code:

ItemBlockCoalGun: http://paste.ubuntu.com/10947721/

ItemCoalGun(The dummy block): http://paste.ubuntu.com/10947733/

EntityCoal: http://paste.ubuntu.com/10947748/

(doubt the code in the next 2 files is necessary to fix the problem, but here, in case it is)

ExtendedPlayer: http://paste.ubuntu.com/10947750/

EnumAmmo: http://paste.ubuntu.com/10947768/

And I may as well include that I have this in my FMLPreInitializationEvent:

GameRegistry.registerBlock(coal_gun, ItemBlockCoalGun.class, "coal_gun");

If you need any more code or details, let me know.

 

EDIT: I have made the mod open source(for now), here is the full source.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

The error is line 29 of ItemBlockCoalGun which, I think, the entity is hitting the player and it doesn't know what to do. Check if the entity hit is not the player? I'm not really sure but, I think maybe the entity is being spawned incorrectly.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

The error is line 29 of ItemBlockCoalGun which, I think, the entity is hitting the player and it doesn't know what to do. Check if the entity hit is not the player? I'm not really sure but, I think maybe the entity is being spawned incorrectly.

Don't get me wrong, I appreciate your attempt to help, but, quite frankly, everything you just said was either unhelpful or stupid wrong. I will leave it to you to decide what was unhelpful and what was wrong.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Typically you see that kind of error when you do not correctly register your entity via EntityRegistry#registerModEntity - can you show that code as well?

 

So, ItemCoalGun is a Block with a TileEntityCoalGun... can your names get any more confusing? I don't understand your logic here - you can render a 3D model with an Item just fine, so why switch to a block, let alone one with a TileEntity? I highly advise against this kind of 'solution' - much better to actually learn how to properly handle rendering.

Posted

Thank you for that quite insulting way of putting it. O.o No matter that, the error is line 29 of ItemBlockCoalGun which is the closing bracket of hitEntity. With that in mind, it seems that you're spawning your entity wrong or. perhaps, you registering it as a block is affecting it? I don't want you to take what I am saying as a cold cut way of immediatly fixing your problem. I am just throwing suggesting on what may be CAUSING the error.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

Oh dear God! I did screw up my last response quite a lot. I didn't realize it was the block class. coolAlias is right though, I render 3D models to my items just fine so that is a very good question.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

"you can render a 3D model with an Item just fine"

Could I see an example of that? Last time I tried finding out all I got was to make a dummy block.

http://www.minecraftforge.net/forum/index.php/topic,29471.msg152198.html#msg152198

"Thank you for that quite insulting way of putting it"

Sorry, I have dealt with a few too many stupid people today.

 

As for the code example, it is in this file somewhere, I am on my phone right now, so it is easier just to post the file without narrowing it down. Here: https://dl.dropboxusercontent.com/s/t6307cffhs1flf1/The_Fireplace_unlogic-ii_master_src_main_java_the_fireplace_unlogicii_UnLogicII.java?dl=0

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Aren't you the rude one. :P I made a mistake when looking at it just like everyone does. I do not appreciate being called "stupid" based upon one post.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted

Aren't you the rude one. :P I made a mistake when looking at it just like everyone does. I do not appreciate being called "stupid" based upon one post.

Yes, everyone makes mistakes, as I did when wording that last post. I did not intend to call you stupid, but the people I had a discussion with earlier, but that was on a different, completely unrelated website, so I won't get in to that.

And if you were referring to my first response, saying something stupid does not make you stupid. There are many smart people who say stupid things from time to time.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Ok, first: You are not checking if you're on the server when spawning the entity. That will leave ghost entities behind.

The actual issue is further down the exception chain: Some entry in your Entity's DataWatcher contains an invalid ItemStack.

Ok, I see what you are saying, and have since fixed the ghost entities.

As for the main issue, how would I go about finding and fixing it? I have looked and looked and can't find where it could be.

 

On a side note, it looks to me like it is expecting to place it as a block and can't, and that could be why.

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:607) [NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) [C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) [C08PacketPlayerBlockPlacement.class:?]

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

It has nothing to do with placing a block. It's simple the name of the packet for "right click" (you right-click your item, this packet is sent and tells the server you right-clicked).

 

For finding the issue, put a conditinoal breakpoint in DataWatcher.writeTo (only break if it's your entity, otherwise you get notified for every entity that's spawned). Then check which slot is null and find out why.

Alright, did that(again and again and again), and I can't find any reason for it to be doing that. The itemstack in DataWatcher.writeTo is ItemBlockCoalGun, not null, and I have tried putting waypoints in various other spots mentioned in the error, all look like they should be working fine.

 

Perhaps it just needs a fresh set of eyes. Anyways, I have made the mod open source for now, so it is easier to fix. Here is the link to the source. Any help is very much appreciated, and I will keep looking, and will let you know if I find the issue.

EDIT: Here is the link to the error now, I renamed and moved the dummy block appropriately: http://paste.ubuntu.com/10971581/

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Ok, to set it up, what I do is clone it, download the latest version of Minecraft Forge, open the zip and delete the arc folder, then extract it over my existing files, replacing any that are the same. Then, I run setupforge.bat(a simple batch file, it runs gradlew setupDecompWorkspace then gradlew eclipse. Then, open eclipse and set it to the workspace as normal, and make sure to add the 2 jarslibsthe libs folder to the build path, as they are Fireplace Core sources and deobf.

 

To reproduce the issue, run the client, make a new world in creative, get a Coal Gun out of the UnLogic II creative tab. Right click while holding it to make the error.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Ok, to set it up, what I do is clone it, download the latest version of Minecraft Forge, open the zip and delete the arc folder, then extract it over my existing files, replacing any that are the same. Then, I run setupforge.bat(a simple batch file, it runs gradlew setupDecompWorkspace then gradlew eclipse. Then, open eclipse and set it to the workspace as normal, and make sure to add the 2 jarslibsthe libs folder to the build path, as they are Fireplace Core sources and deobf.

Yeah, no that's not how to make a repo.

Clone + setupDecompWorkspace is enough if you provide the wrapper. See here for an example.

Ok, should work now

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

The issue is that you extend EntityItem (which is the entity used when you drop an Item on the ground) but never tell it what ItemStack it should represent.

Thanks.

Also: Your code is a giant mess full of lurking errors, but I am not in the mood to go over them all. But you should seriously consider learning Java more in-depth.

I know, and I am working on it.

 

Thanks for taking the time to look in to this and help, I appreciate it.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

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



×
×
  • Create New...

Important Information

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