Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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.

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

  • Author
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?

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.