I am trying to make passive mobs ridable and i was following a tutorial https://bukkit.org/threads/tutorial-1-7-5-wasd-entity-riding.163019/ and i believe that since it was made for 1.7 ( a version from over 5 years ago) it isnt accurate for 1.15, could someone help me make passive mobs ridable without making a seperate class for each mob?
https://hub.spigotmc.org/javadocs/s...y.html#addPassenger-org.bukkit.entity.Entity- Any Entity has that method
Well, put the player to ride the mob and store its UUID and the mob somewhere, then have a repeating task that will go throw all the UUIDs and will get the player direction and move the entity in that way A Map will work perfectly
I'm still very confused on creating a class, what do I need to extend, as it keeps telling me that the e function needs to return int
Fixed mounting rotating but i cant seem to get it to move forward, i tried multipling velocity but im unusre how to do it.
Thank you all for your help I eventually found It out and instead of hitting, I made it work like a carrot on a stick would, where the mobs only move when holding the stick
Also, I didn't save any data, I just looked through all players to see if they are a passenger and if so then if they have a certain item, this would be bad for larger servers but my server has never had more than 10 people on it
I'd just like to point out: https://www.spigotmc.org/resources/...control-any-mob-with-full-wasd-control.58985/ https://papermc.io/forums/t/1-13-2-ridables-ride-and-control-any-mob-with-full-wasd-controls/102 It's open source so you can take some inspiration.
Thanks for everyones support i finished mob riding a few days ago! what i did was if you click a mob hile holding a certain item, you become a passenger of said mob, then the mob matches your yaw and pitch in a runnable, with also makes the mob walk when said item is held.
O of course! here you go Code (Java): @Override public void run() { for(Player p:Bukkit.getOnlinePlayers()){ if(p.isInsideVehicle()&&p.getVehicle() instanceof Horse== false) { Entity v = p.getVehicle(); p.setFallDistance(0);//stops fall damage if(v instanceof Player) {return;} v.setRotation(p.getLocation().getYaw(),p.getLocation().getPitch()); if(p.getInventory().getItemInMainHand()==null) {return;} if(p.getInventory().getItemInMainHand().getItemMeta()==null) {return;} if(p.getInventory().getItemInMainHand().getType==Material.SADDLE){//checks to see if they are holding item Vector current_velocity = p.getVelocity(); Vector walk_velocity = p.getLocation().getDirection().multiply(1.15);//propels them forward walk_velocity.setY(current_velocity.getY());//stops the mob from flying, remove this line to allow mob flight v.setVelocity(current_velocity.add(walk_velocity));//sets velocity //Code by hidden1nin } }} }
please don't just copy paste that though, take some time to try and understand whats happening Also feel free to critique that and give me suggestions, im sure it could be alot cleaner!
It is a good idea to learn Java before you try to write code in it. You also cannot write a book when you do not know how to write letters.
Was that directed towards me? i never specifically learned java, i just scrounge what i can learn and throw it all together
Thank you for showing the code. I understand all the code But I want to move the entity using w, a, s, d. Therefore, you need to find a way. Thank you