Jump to content

Recommended Posts

Posted

It seems that whenever the item would be destroyed by damage it is only destroyed on the server and not the client. I should also mention that using player.inventoryContainer.refresh() or whatever it's called does nothing.

Here is the src file, note: look into the itemRightClick method.

Posted

There is no onItemRightClick in that class file. Just a bunch of crap in onCreated.

What are you trying to achieve?

 

Whoops, sorry about that. I am working on two completely different mods right now and it is confusing me a bit. As for what I am trying to do, whenever you craft the (MagicItem) it will look at the item that you are holding. If it is an instance of ItemGlove then damage it otherwise kill the player.

For some reason however, whenever the item is "destroyed" the client doesn't get the information and just resets the damage to 0.

Posted

First of all this and therefor this will never be true.

 

Then: This check will crash on a server. You cannot check the keyboard directly like that in common code.

 

I see what you mean for the Keyboard but that is something else completely. Just ignore that. And what do you mean when you say needsEssence will never be true? It is set to true if the object has a tag. And yes, the tag compound can be null.

Posted

Where do you "create the Object"?

 

I see what you were talking about, I updated the post above. Apparently you had text highlighted but github's highlighter is very light and hard to see on my monitor.

Posted

You know what onCreated does, right? It gets called when your Item gets crafted. At that point the NBTTagCompound will always be null, unless your crafting result already has NBT.

 

And that is exactly why it's there. Some of my crafting recipes already have a tag, hence it even being there.

Posted

Actually from looking at vanilla code, damageItem does not properly destroy stacks when they reach size 0, unless they are a Bow (don't ask me why that is). So you have to check for that manually.

 

Wow, that doesn't make any sense whatsoever. Do you think you could help me out on this then? If you look at the item code you will notice that I already have this set up but I am using VERY improperly. If you could give me a few pointers that would help a ton.

Posted

Ok, so now that I have that part fixed could you help me out as to why everything is doubled when I hold shift to get the recipe? It acts like it is run twice but the output is still the same.

Posted

ItemCraftedEvent is a FML Event. Are you registered to the FML EventBus?

 

Yeah, every other event in that class works fine. I have tried elevating that one to a higher priority and even making it static but nothing is fixing it. I have no idea what's going on here.

Is it wrong that I registered it like: MinecraftForge.EVENT_BUS.register(new EventManager());?

Posted

ItemCraftedEvent is a FML Event. Are you registered to the FML EventBus?

 

Yeah, every other event in that class works fine. I have tried elevating that one to a higher priority and even making it static but nothing is fixing it. I have no idea what's going on here.

Is it wrong that I registered it like: MinecraftForge.EVENT_BUS.register(new EventManager());?

 

Always... always.... register in the right event bus.

 

 

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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