[NMS] Vertical Minecarts?

Discussion in 'Plugin Help/Development/Requests' started by KamikazePlatypus, Apr 9, 2015.

Thread Status:
Not open for further replies.
  1. So a friend of mine and I are working on a custom TrainCarts clone for our server, and we've made a lot of progress. We've got train spawning and cart linking down, but we're stuck on implementing the vertical minecarts feature. In TrainCarts, minecarts can travel up and down vertically on ladders. We're using a custom entity for our carts so we can edit things like speed, yaw, and pitch, but we can't figure out how to get them to travel up. The issue is that the carts are tied to the rails, and whenever they reach the ladder, it is treated as a solid block. We're thinking that maybe we could get the cart to travel through the ladders as if they weren't there, but we don't know how to implement that, or if it's the best way to go about doing it.

    Here's an example of what we're trying to achieve:

    [​IMG]

    And here's our custom entity class:

    Code:
    package mca.traincarts;
    
    import java.util.Iterator;
    
    import net.minecraft.server.v1_8_R2.BlockPosition;
    import net.minecraft.server.v1_8_R2.BlockMinecartTrackAbstract;
    import net.minecraft.server.v1_8_R2.BlockPoweredRail;
    import net.minecraft.server.v1_8_R2.Blocks;
    import net.minecraft.server.v1_8_R2.DamageSource;
    import net.minecraft.server.v1_8_R2.Entity;
    import net.minecraft.server.v1_8_R2.EntityMinecartAbstract;
    import net.minecraft.server.v1_8_R2.EntityMinecartRideable;
    import net.minecraft.server.v1_8_R2.IBlockData;
    import net.minecraft.server.v1_8_R2.IBlockState;
    import net.minecraft.server.v1_8_R2.MathHelper;
    import net.minecraft.server.v1_8_R2.MinecraftServer;
    import net.minecraft.server.v1_8_R2.World;
    import net.minecraft.server.v1_8_R2.WorldServer;
    
    import org.bukkit.Location;
    import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
    import org.bukkit.entity.Vehicle;
    import org.bukkit.event.vehicle.VehicleMoveEvent;
    import org.bukkit.event.vehicle.VehicleUpdateEvent;
    import org.bukkit.metadata.FixedMetadataValue;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.util.Vector;
    
    public class TCEntity extends EntityMinecartRideable {
        public static Plugin plugin;
        public TCEntity(World world) {
            super(world);
            this.setCustomName("TCEntity");
            this.setCustomNameVisible(false);
            this.getBoundingBox().grow(-2, -2, -2);
            this.slowWhenEmpty=false;
        }
        public static TCEntity spawnCar(Location loc, org.bukkit.World worlds, float yaw, float pitch)
        {
            CraftWorld world = ((CraftWorld) worlds);
            final TCEntity car = new TCEntity(world.getHandle());
            car.yaw = yaw;
            car.pitch = pitch;
            car.setPosition(loc.getX(),loc.getY(),loc.getZ());
            world.getHandle().addEntity(car);
        
            return car;
        }
    
        public void setMaxSpeed(int speed)
        {
            this.maxSpeed=speed;
    
        }
        @Override
        public void collide(Entity e)
        {
            return;
        }
    
    
    
    }

    How would one go about implementing this feature?
     
  2. Offline

    Duuuckkky

    Don't think this is possible on servers. Without mods.
     
  3. It's possible with NMS.
     
Thread Status:
Not open for further replies.

Share This Page