Posted April 12, 20169 yr Hi, I'm attempting to use the passengers system in 1.9, but when the entity riding is dismounted, it reverts back to it's original position before riding my entity. Here's the relevant code: Adding a passenger (in my entity): private void handleImpact(){ if (!this.worldObj.isRemote && this.getLassoer() != null && this.getPassengers().isEmpty()) { ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>) this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox()); for(int i = 0; i < entities.size(); i++){ if(!entities.get(i).isRiding() && entities.get(i) != getLassoer()){ if (this.toofaraway()) return; entities.get(i).startRiding(this, true); return; } } } } Dismounting the entity (In an item, on right click): if(player.isSneaking() && !lasso.getPassengers().isEmpty()){ for(int i = 0; i < lasso.getPassengers().size(); i++){ lasso.getPassengers().get(i).dismountRidingEntity(); } lasso.removePassengers(); }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.