Ok create a new class called [YourItemName] in items package. Make your class extend Item create the constructor. Inside the constructor super(new Item.Properties().group(ItemGroup here)). You can add new properties in that super.
Then override hitEntity and do whatever you want.
Now register the Item. I hope u use DeferredRegister. Register the Item like this:
public static final RegistryObject<YourItemClass> = ITEMS.register(“your_item_name”, YourItemClass::new);
If you learn java before modding your Modding Experience will be 100x better. Don’t learn Java through modding. Or don’t mod Minecraft while learning java.
You can do the same by overriding hitEntity() in The Item class. That would be more efficient as the LivingAttackEvent fires every time you attack something. But hitEntity() fires only when you hit something with the item. You could reduce potential lag.
Git and Github is the best in my opinion. And it is easy to do it in eclipse. Just create a git repo in the root of the Mdk and then stage all the files and commit. Then create a new repo in github(Do not initialize with a readme or .gitignore file) get the repo url and push your project from eclipse using the url.
Then get to the second device open eclipse and clone the repo and import the project and it is done. The only important thing is you have to create the git repo in the root of the mdk(the folder with the .gitignore file by Forge).
If you have used git before it should be dead easy.
Nevermind I did it myself. I created a custom sound. I want to play the sound everytime I take something from the output slot, Just like the anvil after everytime we repair or enchant it plays a sound.
0
What IDE do you use?
0
Ok create a new class called [YourItemName] in items package. Make your class extend Item create the constructor. Inside the constructor super(new Item.Properties().group(ItemGroup here)). You can add new properties in that super.
Then override hitEntity and do whatever you want.
Now register the Item. I hope u use DeferredRegister. Register the Item like this:
public static final RegistryObject<YourItemClass> = ITEMS.register(“your_item_name”, YourItemClass::new);
Note that I gave you the answer to a simple Java problem. Please learn java: https://docs.oracle.com/javase/tutorial/
If you learn java before modding your Modding Experience will be 100x better. Don’t learn Java through modding. Or don’t mod Minecraft while learning java.
0
You can do the same by overriding hitEntity() in The Item class. That would be more efficient as the LivingAttackEvent fires every time you attack something. But hitEntity() fires only when you hit something with the item. You could reduce potential lag.
0
Git and Github is the best in my opinion. And it is easy to do it in eclipse. Just create a git repo in the root of the Mdk and then stage all the files and commit. Then create a new repo in github(Do not initialize with a readme or .gitignore file) get the repo url and push your project from eclipse using the url.
Then get to the second device open eclipse and clone the repo and import the project and it is done. The only important thing is you have to create the git repo in the root of the mdk(the folder with the .gitignore file by Forge).
If you have used git before it should be dead easy.
0
What is the version of java you use? To check it open CMD and type java -version. Forge does not work properly if you don’t use Java 8 specifically.
0
A small question is the class you have posted is a custom tool material class?
Im unfamiliar with 1.16.1. I am used to 1.12.2.
If this is a tool material class(that’s what they call in 1.12.2) I don’t think the
hitEntity() has to do anything with this class.
And can you post your registryhandler so I can help you a little more.
0
You have to create a custom class for your weapon and override hitEntity()
and you have to register the class in your RegistryHandler.
0
Well nevermind I found out that Gists permalinks take some time to update the cache.
They take like five to six minutes to do it. I was impatient.
But anyways thx for your help. It works perfectly.
0
I recently setup the Forge Update checker for my Minecraft Mod.
I used the official Forge documentation for setting it up.
I set the Update.json file correctly and uploaded it to gist and obtained the permalink
for the raw json file.
It worked. However when I make a change to the gist that is when I add a new version number,
Forge update checker doesn’t work.
It returned the result TARGET UP TO DATE even though it was outdated what should I do?
0
I made it play a custom sound after crafting myself.
Thanks V5_ for helping me complete this block it works fine and I'm able
to create recipes for it.
I need to learn more new stuff in modding and maybe even try to use the latest
versions of Forge.
Finally, Thanks for your help.
0
BUMP!
0
Nevermind I did it myself. I created a custom sound. I want to play the sound everytime I take something from the output slot, Just like the anvil after everytime we repair or enchant it plays a sound.
Can you please tell me how to do it?
0
I added a few recipes and they work fine how it works is it upgrades tools along with all existing enchantments.
But if the tools' durability is reduced the output item doesn't have the same durability it resets it to max that is a problem I have.
How do I solve it? You can check the GitHub I always commit and push whenever I make changes.
Please help.
0
How do I create crafting recipes that is if I had a tool in the first slot and a item in the second slot it gives me a output?
0
Please reply