Jump to content

Recommended Posts

Posted (edited)

When? When in the player's inventory? Please clarify.

To call a function every tick when the item stack is in the player's inventory, override Item#onUpdate.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
50 minutes ago, DavidM said:

When? When in the player's inventory? Please clarify.

To call a function every tick when the item stack is in the player's inventory, override Item#onUpdate.

Generally anywhere. Like if it's in a player inventory, or a chest inventory (as long as it's loaded) or on the floor?

Epic Website

Posted
36 minutes ago, FrostBytes said:

Generally anywhere. Like if it's in a player inventory, or a chest inventory (as long as it's loaded) or on the floor?

In this case you need to use different method fr each. I don't think this is possible with the chest inventory though (in which case you have to create your own chest).

As for on the floor, override Item#onEntityItemUpdate.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
47 minutes ago, DavidM said:

In this case you need to use different method fr each. I don't think this is possible with the chest inventory though (in which case you have to create your own chest).

As for on the floor, override Item#onEntityItemUpdate.

Would it be possible to override functionality of the vanilla chest from the mod?

Epic Website

Posted
25 minutes ago, FrostBytes said:

Would it be possible to override functionality of the vanilla chest from the mod?

It could be done, but would be a bad idea. You might as well create your own chest that has your custom functionalities.

You can take a look at the code of the alchemical chest in ProjectE, which does exactly what you described (allow custom items update inside chest).

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted

You also can't do anything about inventories that aren't loaded.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
14 hours ago, Laike_Endaril said:

If you're trying to do something that changes at a constant rate over time, you can do it using timestamps.  What exactly is the goal?

I’m trying to run code every tick for every itemstack currently loaded.

Epic Website

Posted

That much is obvious. What will this achieve for an end user perspective?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

Double post

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
14 minutes ago, Cadiboo said:

That much is obvious. What will this achieve for an end user perspective?

It's going to just be code that randomly checks if there is a certain container nearby and move the itemstack into it. Not sure how that would contribute to this.

Epic Website

Posted

Because there are better ways of doing this than the one you’re trying. For example, putting the item into the container from the container. This is super easy if the container has something that runs every tick (like an Entity or a TileEntity).

What you’re trying to do is always relevant, because there’s usually a better way of doing it.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
1 hour ago, Cadiboo said:

Because there are better ways of doing this than the one you’re trying. For example, putting the item into the container from the container. This is super easy if the container has something that runs every tick (like an Entity or a TileEntity).

What you’re trying to do is always relevant, because there’s usually a better way of doing it.

Wow. Never really thought of that. Thanks.

Epic Website

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.