1.15.2 Problems with Minecarts in curves

Discussion in 'Spigot Plugin Development' started by MyriadC, Mar 27, 2020.

  1. Hello there,

    I'm (still) having the problem with Minecarts and own velocities in curves.
    I'm using very slow velocities like 0.01 and they get stucked in curves and tried so much things.
    It'd be very nice, if someone could help me there.

    Best regards
  2. SteelPhoenix


    What code are you using?
  3. We used the Drupi plugin to use JavaScript. Please don't ask why we use JS.
    This basically everthing we use determine the speed for each direction.
    currentSpeed is 0.01
    Code (Text):
    let d = e.getVehicle().getFacing().getDirection()
    let b = e.getVehicle().getLocation().getBlock()
    let s = b.getBlockData().getShape();
    let currentSpeeds = speeds(currentSpeed);
    v = new org.bukkit.util.Vector(currentSpeeds[s][0], currentSpeeds[s][1], s == org.bukkit.block.data.Rail.Shape.NORTH_SOUTH ? (d.z != 0.0 ? currentSpeeds[s][2] * d.z : currentSpeeds[s][2]) : currentSpeeds[s][2]);
    Code (Text):
    var speeds = (speed) => ({
        EAST_WEST: [-speed, 0.0, 0.0],
        NORTH_EAST: [-speed, 0.0, -speed],
        NORTH_SOUTH: [0.0, 0.0, speed],
        NORTH_WEST: [-speed, 0.0, -speed],
        SOUTH_EAST: [-speed, 0.0, speed],
        SOUTH_WEST: [-speed, 0.0, speed]
  4. Or how could you solve it in Java?