Jump to content

Recommended Posts

Posted

I am looking at increasing the maximum speed of a minecart, but EntityMinecart class doesn't have a way to set the max speed, only get. Would there be an easier way to simply change the max speed of the cart, or do I have to create a new Entity class, override the function, and then spawn in the custom cart in place of the default one? If the latter is true, can anyone point me to a good tutorial on registering entity's and spawning them in? I have seen other tutorials on the registering entities, but they all deal with mobs and I don't think mobs and carts are the same entities.

Posted (edited)

Does the function return a hardcoded value or does it reference a field?

If it references a field you can use reflection to modify it.

If not, you'll have to make your own Minecart entity class.  Keep in mind however, that any subclasses of EntityMinecart that already exist will not see your adjustment.

Edited by Draco18s

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
3 hours ago, Dongle12 said:

I am looking at increasing the maximum speed of a minecart, but EntityMinecart class doesn't have a way to set the max speed, only get. Would there be an easier way to simply change the max speed of the cart, or do I have to create a new Entity class, override the function, and then spawn in the custom cart in place of the default one? If the latter is true, can anyone point me to a good tutorial on registering entity's and spawning them in? I have seen other tutorials on the registering entities, but they all deal with mobs and I don't think mobs and carts are the same entities.

You should use Minecraft.getMinecraft().timer.timerSpeed

Posted
9 hours ago, Draco18s said:

Does the function return a hardcoded value or does it reference a field?

If it references a field you can use reflection to modify it.

The EntityMinecart class has this function: 

    public float getMaxCartSpeedOnRail()
    {
        return 1.2f;
    }

 That does return a static value, and that function is used here:

    public final void setCurrentCartSpeedCapOnRail(float value)
    {
        value = Math.min(value, getMaxCartSpeedOnRail());
        currentSpeedRail = value;
    }

in order to limit the actual speed.

 

I have looked at reflection for both these functions, but I can't find the SRG name for either function, and all the tutorials for ReflectionHelper use the SRG names. I'm not sure if that has changed with newer versions of MC, or if ReflectionHelper does in fact still need the SRG when I use it. I have gone through all the MCP names with no luck of finding the names. Is there some debug I can do manually in eclipse to get the SRG name of the functions?

Posted
10 hours ago, Draco18s said:

If not...

It does not

10 hours ago, Draco18s said:

you'll have to make your own Minecart entity class.  Keep in mind however, that any subclasses of EntityMinecart that already exist will not see your adjustment.

 

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.