Carpet-Fixes

Carpet-Fixes

383k Downloads

When converting, mobs switch positions in boats

Ghoulboy78 opened this issue ยท 2 comments

commented

It's in the code for Mob#convertTo. I might even fix it myself tbh, cos I've looked at the code recently, so I kinda know how where to begin.
https://discord.com/channels/882822986795716608/882826588348092457/1005362908085108897
This is probably relevant too

commented
@Inject(
    method = "convertTo",
    at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Mob;stopRiding()V")
)
public <T extends Mob> void isControllingBoat(EntityType<T> entityType, boolean bl, CallbackInfoReturnable<T> cir){
    Mob mob = null; //gotta figure out how to get this
    Entity vehicle = mob.getVehicle();
    boolean isController = false, needsAction = false;
    if(vehicle instanceof Boat boat) {
        isController = boat.hasPassenger(mob) && boat.hasControllingPassenger() && boat.getControllingPassenger().is(mob);
        needsAction = isController && boat.getPassengers().size()==2; // cos then back passenger will get shoved forward
    }
}

I think this code may be useful, not too sure tho ngl. This would be mixing into Mob.class

commented

((Mob)(Object)this)