1.15.2 Vehicles which you can walk inside

Discussion in 'Spigot Plugin Development' started by Darakandar17, Feb 6, 2020.

  1. I am working on a plugin which creates multi-block (I am using 3D models on armor stands) vehicles. While it is easy to put a seat and just make the player sit, what I want is a vehicle that you can walk inside like the model has collision.

    Setting the velocity for passengers looks easy but how can I make the player-vehicle collision? I tried using invisible shulkers riding armor stands so you can walk on air the problem is though you get glitched collision (https://bugs.mojang.com/browse/MC-156980) is there any way of doing that? Thanks in advance.

    This is what I am trying to achieve. (The first part)
     
    #1 Darakandar17, Feb 6, 2020
    Last edited: Feb 6, 2020
  2. I have spent a significant amount of time trying to get it to work, to the point of reading decompiled client source code to figure out what is going on. The takeaway for you is this:
    • Whenever an entity you are standing on moves up, you WILL clip through, there is no avoiding it
    • The shulker moving down or moving horizontal works fine
    • Using the shulker open animation does allow for very slow upward motion, but even here players risk sliding off. On the client all it does is add the same animation y delta to the entity y position, there are no collision physics involved
    • Players being lifted up, either using levitation or constant velocity boosts, can not move horizontally very well (fly slowness)
    • You cannot boost this movement, because of an inherent problem in packet synchronization. When the server sends a velocity packet to the client, due to server and client running on different clock cycles, the server has no guarantee that that particular packet is actually processed, or that two velocity packets arrived in a single client tick cancelling out the previous.
    • By giving players flight mode temporarily while the vehicle is moving up, and a lot of serverside calculations, you might be able to allow for upwards moving mobility. But players cannot jump without server assistance
    • When shulkers move horizontally, they do not move players on top. You can use velocity boosts to simulate it, but that causes horizontal player input to fail completely because there is a maximum speed players can walk
    Reference: I've been busy trying to implement a Platform attachment for Traincarts so that players can walk inside a train/vehicle as you describe.

    Here's some source code:
    https://github.com/bergerhealer/Tra...tachments/control/CartAttachmentPlatform.java
    https://github.com/bergerhealer/Tra...s/control/CartAttachmentPlatformOriginal.java
     
    #2 TeamBergerhealer, Feb 7, 2020
    Last edited: Feb 7, 2020
    • Informative Informative x 4
  3. Thanks a lot for this informative reply. From what I understand, it looks like Minecraft does not support the idea to work properly.
     
  4. Well it works good when you move player vertically but as you said it doesn't look possible to boost player velocity horizontally and also let him move. Am I right?
     
  5. Well maybe there is an other way to get these input though? I saw a post about putting (Making them sit I guess?) passengers to armor stands then reading the inputs of player. Would it work? Also could I really take inputs while player is sitting on an armor stand? Thanks a lot!

    https://www.spigotmc.org/threads/creating-pirate-ships.367626/#post-3363474

    By the way even if it works, would it really look like walking or just floating while sitting?
     
  6. @Darakandar17 It would work for sure, but in first person the player will see himself sitting in the air, and there is no way around that. With packet manipulation you can make it so other players see the player standing.
     
  7. Hmm, I guess another way of doing that is using different way to get inputs like, an external software to listen player inputs? Maybe a web page that sends keyboard input to server? So you can know when a player press W and etc.
     
  8. @Darakandar17 at that point you might as well write a custom mod for this
     
    • Agree Agree x 1