/u/Wallaceman105
Guest
Member
I'm trying to tweak a plugin to improve it's functionality at higher speeds. Basically, this plugin lets players link 2 minecarts together into a train. Its link manager functions by moving the 'child' cart towards the 'parent' cart at a speed defined by 'double speed = x'.
and then applies it using a moveToward function.
The plugin uses 2
My current issue is this: I'm seeking to make this plugin compatible with a high-speed minecart plugin. if
I was trying to compensate by adding additional
However, this failed to work.
Does anyone have advice on how I could achieve this behavior?
Note- I'm not an experienced Java programmer, I'm a complete noob who's just logic-puzzling my way through this code.
submitted by /u/Wallaceman105
[link] [comments]
Continue reading...
free plugins
minecraft paid for free
spigotmc
SpigotMC
free minecraft paid plugins
free minecraft plugins
aac free
ewg free
Minecraft Premium Plugins
ewg free download
litebans free
epicworldgenerator free
free schematics
leaked schematics minecraft
schematics
schematics leaked
schematics free
minecraft schematics free
paid minecraft schematics free
paid minecraft schematics for free
free cracked plugins
free cracked minecraft plugins
plugins
featherboard download
featherboard plugin download
antiaura download
minecraft plugins
xenforo leaked
xenforo for free
xenforo addons
//Defines the distance value as the distance from parent double distance = minecart.getLocation().distance(parent.getLocation()); //Sets the speed at which carts move towards their dependant. At HSR speeds, this value must be high //to avoid breaking trains during acceleration double speed = 6; //Sets max/min distance for links if((distance > 9.2) || distance < 0.7) { linkageManager.removeLink(minecart); minecart.setVelocity(new Vector(0, 0, 0)); parent.setVelocity(new Vector(0, 0, 0)); //^Brings broken carts to a hard stop, preventing runaway trains }
and then applies it using a moveToward function.
//defines moveToward, which handles the elastic movement of dependant carts. Uses the speed set earlier. public void moveToward(Entity child, Entity parent, double speed, double distance) { Location childLoc = child.getLocation(); Location parentLoc = parent.getLocation(); double x = childLoc.getX() - parentLoc.getX(); double y = childLoc.getY() - parentLoc.getY(); double z = childLoc.getZ() - parentLoc.getZ(); Vector velocity = new Vector(x, y, z).normalize().multiply(-speed); child.setVelocity(velocity.multiply((distance * distance * distance))); }
The plugin uses 2
else if
functions to try to maintain a 1.6m distance between the carts, one to move it away, and one to move it closer.else if(distance < 1.5){ moveToward(minecart, parent, (speed * 0.9), (distance - 1.6)); } else if((distance > 1.7)) { moveToward(minecart, parent, speed, (distance - 1.6)); }
My current issue is this: I'm seeking to make this plugin compatible with a high-speed minecart plugin. if
double speed = x
is set to low, roughly below 5, then train carts become to far from one another and the link breaks. However, at values closer to 6, once a train decelerates once, and the carts begin to overlap, their attempts to separate themselves causes the carts to 'jiggle' and move back and forth. This eliminates their momentum, and the train crawls along at maybe 3m/s.I was trying to compensate by adding additional
else if
statements that would apply different speed values depending on the distance between the carts, like this:else if(distance > 2.0) { moveToward(minecart, parent, (speed * 2), (distance - 1.8)); } else if(distance > 2.5) { moveToward(minecart, parent, (speed * 3), (distance - 2.4)); } else if(distance > 5) { moveToward(minecart, parent, (speed * 5), (distance - 4.9)); }
However, this failed to work.
Does anyone have advice on how I could achieve this behavior?
Note- I'm not an experienced Java programmer, I'm a complete noob who's just logic-puzzling my way through this code.
submitted by /u/Wallaceman105
[link] [comments]
Continue reading...
free plugins
minecraft paid for free
spigotmc
SpigotMC
free minecraft paid plugins
free minecraft plugins
aac free
ewg free
Minecraft Premium Plugins
ewg free download
litebans free
epicworldgenerator free
free schematics
leaked schematics minecraft
schematics
schematics leaked
schematics free
minecraft schematics free
paid minecraft schematics free
paid minecraft schematics for free
free cracked plugins
free cracked minecraft plugins
plugins
featherboard download
featherboard plugin download
antiaura download
minecraft plugins
xenforo leaked
xenforo for free
xenforo addons