Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

  • Author

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.

  • Author

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.

  • Author

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.

  • Author

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.

  • Author

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.

  • Author

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.

  • Author

Shift clicking is very weird. Basically it's a bad idea to rely on onCreated in any way.

 

So should I move it all to the forge event of onCreated?

  • Author

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());?

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.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.