Jump to content

Recommended Posts

Posted

If I wanted to create a custom player entity, to overwrite the functionality of the player, how could I do that? I have noticed that the player is initialized in net.minecraft.client . If Overwriting this variable is what I would need to do, how would I go about doing that? If I need to, can I/ how do I change some of the code in this main Minecraft.java file?

Posted (edited)
36 minutes ago, MickeyD3557 said:

If I wanted to create a custom player entity, to overwrite the functionality of the player, how could I do that? I have noticed that the player is initialized in net.minecraft.client . If Overwriting this variable is what I would need to do, how would I go about doing that? If I need to, can I/ how do I change some of the code in this main Minecraft.java file?

You can't.

 

What are you trying to achieve? What is your mod going to do? It is likely that what you are trying to achieve does not require modifications to the vanilla files.

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
On 6/12/2020 at 11:58 PM, DavidM said:

You can't.

 

What are you trying to achieve? What is your mod going to do? It is likely that what you are trying to achieve does not require modifications to the vanilla files.

I want to change what happens when you left click with different objects, essentially. Also, I want to change the way that sword damage is calculated. In vanilla, damage is reduced based on the speed of attack, and there is a charge bar for a swing attack, unless I am misunderstanding something. My goal is to change this to a sort of repeatable n hit combo. 

 

This is just one of the goals of the mod, there are other things including changing how xp is gathered and player leveling is done, and adding new actions to the player. 

 

I had an idea, but I am unsure of if it would work yet: Writing a sub class which overrides functionality of the PlayerEntity, and replacing the reference in the Main Minecraft file through reflection. The problem is: When would I be able to do this without breaking anything. It would need to be after Minecraft.instance is initialized somehow. Is this a possibility?

Posted

All of those can be accomplished others ways.

There's InteractionEvents for things like "left clicking objects" and another for the player attacking and dealing damage. Pretty sure there's one regarding picking up EXP (you would then handle the effects in a Capability) and so on.

  • Like 1

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

I see. The reason I am concerned about it is because I am writing a custom renderer and model for the player. Things like sword swings and other actions are stored in the entity handed to the PlayerRenderer. It uses swing progress and other things in order to animate the model. I had two concerns when seeing this: Would I need to change the entity coming in in order to add new features for animation? The second issue was where the hit boxes were stored. If they are stored in the model thats fine, but if they are prepared in the entity I see no way around changing it. If I wanted to do a vertical slash, and there were 2 enemies in front of me, stacked on top of each other, like a spider jockey, they should both be hit. If the hit boxes are in the entity, then I would need to change the hit boxes in the entity based on the action.

 

We have plenty of other ideas we may want to implement once we figure out limitations of the modding, so I wish I could provide more concrete examples of what we want to do, but to sum up its a lot(I think). 

 

With all that in mind, can that be done only by hooking onto events?

Posted
58 minutes ago, MickeyD3557 said:

With all that in mind, can that be done only by hooking onto events?

Yes.

 

58 minutes ago, MickeyD3557 said:

Would I need to change the entity coming in in order to add new features for animation?

No.

 

58 minutes ago, MickeyD3557 said:

If I wanted to do a vertical slash, and there were 2 enemies in front of me, stacked on top of each other, like a spider jockey, they should both be hit. If the hit boxes are in the entity, then I would need to change the hit boxes in the entity based on the action.

You don't need to change the hitbox. Just subscribe to an attack event and change the way hitbox are calculated in an attack.

  • Like 1

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

Thanks for the help, both of you!

 

Since Im new to the forum, Im not sure if there is a function to close this thread, or what best practices are for selecting an answer, so feel free to let me know about that as well!

Posted
2 hours ago, MickeyD3557 said:

Im not sure if there is a function to close this thread

You don't. There's no point. Its a forum not Stack Exchange.

  • Like 1

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.

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.