Posted May 15, 201510 yr Hi, I am new here and would like some basic modding information. I have managed to setup minecraft forge for 1.7.10 on my machine using Eclipse 4.4.2 and forge 10.13.2.1291. I am able to start reading and debugging the vanilla minecraft code (yeah!) I have already made a change to one of the vanilla minecraft classes and would like to recompile and test my change. I have tried Build All from the project menu but when I start debugging, the code reads the same as before my change. Could you please provide the proper steps to change and debug vanilla minecraft classes please? Thank you in advance!
May 15, 201510 yr You don't. Jar modding is dead and you should not be doing it ever. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
May 15, 201510 yr Author Ok, thank you for that information I was confused when the vanilla minecraft classes were not included in the project. I would still like to override some vanilla entity behavior... Or is this the wrong tool for that? Do I create a subclass of the vanilla class I want to modify and override the original functionality there, and then somehow replace the original entity with my inheritied entity?
May 15, 201510 yr There are plenty of events and hooks for entities. You can use them to modify an entity's behaviour. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
May 15, 201510 yr And if that isn't somehow enough, you can use ASM and make a core mod. Warning: I am not responsible for any effects, temporary or permanent, acquired from having The Abyss looking back at you. 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.
May 16, 201510 yr Author There are plenty of events and hooks for entities. You can use them to modify an entity's behaviour. That sounds excellent! I don't suppose there are any links out there that demonstrate using minecraft forge hooks to modify vanilla minecraft entities... From my point of view I am not looking for anything very specific to start with. I think it could help me if I could see a sample or something of someone modifying any aspect of a vanilla entity. Basically I know that I know nothing about this tool and I am looking for a place to start learning.
May 16, 201510 yr When trying to modify vanilla behavior, you should consider the following approaches (in this order). 1) Look for public methods, fields and registries. The vanilla code has a lot of public scope stuff -- like entity AI is in a list that is public so you can simply modify it directly. 2) Events. There are events for many of the things that modders are interested in, and the events allow you to change and even cancel the vanilla behavior. 3) Java reflection. Java is a funny language and reflection allows you to access a lot of vanilla stuff that is technically out of scope. 4) ASM and transformer techniques. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 16, 201510 yr Author When trying to modify vanilla behavior, you should consider the following approaches (in this order). 1) Look for public methods, fields and registries. The vanilla code has a lot of public scope stuff -- like entity AI is in a list that is public so you can simply modify it directly. 2) Events. There are events for many of the things that modders are interested in, and the events allow you to change and even cancel the vanilla behavior. 3) Java reflection. Java is a funny language and reflection allows you to access a lot of vanilla stuff that is technically out of scope. 4) ASM and transformer techniques. I have created a class that inherits from the vanilla entity and overrides a protected method to implement some sample overriden behavior. Now my question is how do I tell the game engine to use my inherited entity instead of the original entity (without modifying the vanilla files of course!)? I am assuming that this kind of change is supported I guess.
May 16, 201510 yr No. You either make new entity and register it as separate entity, or you use events to hook into vanilla ones. There is like milions of tutorials on "How to use Events in Forge". Say exacly what you want to archieve, then we can be more direct, otherwise - read ab out events (tutorial, code, anything). To for example hook into update() method of entity (one that is called every tick) you can use LivingUpdateEvent. Notes: Remember to register entity, understand that client events should be put into client proxies, know that there are few different buses that will call event. Everything can be found VERY easily on google. 1.7.10 is no longer supported by forge, you are on your own.
May 19, 201510 yr Author No. You either make new entity and register it as separate entity, or you use events to hook into vanilla ones. There is like milions of tutorials on "How to use Events in Forge". Say exacly what you want to archieve, then we can be more direct, otherwise - read ab out events (tutorial, code, anything). To for example hook into update() method of entity (one that is called every tick) you can use LivingUpdateEvent. Notes: Remember to register entity, understand that client events should be put into client proxies, know that there are few different buses that will call event. Everything can be found VERY easily on google. After reading lots of code and googling minecraft forge events I managed to subscribe to an event in a generic custom event handler class that I wrote. I built and ran my code and got eclipse to stop at my breakpoint. I think that it even does what I want it to do. (I did figure out that onLivingUpdate was probably to high up the stack for my purpose and found a hook much closer to the behavior that I wanted to override.) Many thanks!
May 19, 201510 yr I glad to hear you were able to figure this out. You're off to a good start. We like helping people who can take a bit of direction and do the work to learn the rest. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 19, 201510 yr Yes, a push in the right direction, sometimes a shove , without giving the full way of how to do things. On this forum we don't like it when we have to give full code for things.
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.