Bug Open

Conflict with Independent Mount Plugin

#6333 opened by Unknown 1 year ago

Unknownreported this bug

I wrote a mount plugin, which is a new entity. Players can right-click to ride the entity and operate it normally, including flying. However, when I add a ModelEngine4 model to this entity, the player mounts it but immediately dismounts! How can I resolve this issue?

@Override
public void setModel(Entity entity, String model) {
    String[] args = model.split(" ");

    ModelBlueprint blueprint = ModelEngineAPI.getBlueprint(args[0]);
    if (blueprint != null) {
        ModelOptionParser options = ModelOptionParser.parse(1, args);
        Location location = entity.getLocation();
        BukkitEntity base = new BukkitEntity(entity);
        base.getBodyRotationController().setYBodyRot(location.getYaw());
        ModeledEntity modeledEntity = ModelEngineAPI.createModeledEntity(base);
        modeledEntity.setBaseEntityVisible(false);
        ActiveModel activeModel = ModelEngineAPI.createActiveModel(blueprint);
        activeModel.setAutoRendererInitialization(false);
        options.applyDisguiseOptions(activeModel);
        modeledEntity.addModel(activeModel, true);
        activeModel.initializeRenderer();

        activeModel.getMountManager().ifPresent((mountManager) -> {
            mountManager.setCanRide(true);
            mountManager.setCanDrive(true);
            modeledEntity.getMountData().setMainMountManager(mountManager);
        });
    }
}
Sign in to join the discussion.