Как сделать свой рендер игрока, работающий с OptiFine?

Версия Minecraft
1.7.10
API
Forge
56
1
У нас не помогают с декомпилом. Говорят, мод с закрытыми исходниками.
Столкнулся с такой проблемой. Сделал нестандартный рендер игрока, но если ставлю свой мод и оптифайн, естественно, мой рендер перестает работать. Можно ли как-то извратиться и исправить этот неприятный момент?
 
56
1
Вот основная часть кода:
Java:
public class WFMRenderPlayer extends RenderPlayer

{



    private Minecraft mc = Minecraft.getMinecraft();

    private final LOTRModelBiped modelBiped = new LOTRModelBiped();

    private final LOTRModelBiped modelBipedArmorChestPlate = new LOTRModelBiped(1.0f);

    private final LOTRModelBiped modelBipedArmor = new LOTRModelBiped(0.5f);



    private final WFMModelSkaven modelSkaven = new WFMModelSkaven();

    private final WFMModelSkaven modelSkavenArmorChestPlate = new WFMModelSkaven(1.0f);

    private final WFMModelSkaven modelSkavenArmor = new WFMModelSkaven(0.5f);



    private final WFMModelSkeleton modelSkeleton = new WFMModelSkeleton(0.0f);

    private final WFMModelSkeleton modelSkeletonArmorChestPlate = new WFMModelSkeleton(1.0f);

    private final WFMModelSkeleton modelSkeletonArmor = new WFMModelSkeleton(0.5f);



    private final WFMModelDwarf modelDwarf = new WFMModelDwarf();

    private final WFMModelDwarf modelDwarfArmorChestPlate = new WFMModelDwarf(1.0f);

    private final WFMModelDwarf modelDwarfArmor = new WFMModelDwarf(0.5f);



    private final WFMModelOrc modelOrc = new WFMModelOrc();

    private final WFMModelOrc modelOrcArmorChestPlate = new WFMModelOrc(1.0f);

    private final WFMModelOrc modelOrcArmor = new WFMModelOrc(0.5f);



    private final WFMModelGoblin modelGoblin = new WFMModelGoblin();

    private final WFMModelGoblin modelGoblinArmorChestPlate = new WFMModelGoblin(1.0f);

    private final WFMModelGoblin modelGoblinArmor = new WFMModelGoblin(0.5f);



    private final WFMModelOgre modelOgre = new WFMModelOgre();

    private final WFMModelOgre modelOgreArmorChestPlate = new WFMModelOgre(1.0f);

    private final WFMModelOgre modelOgreArmor = new WFMModelOgre(0.5f);



    private final WFMModelBeastman modelBeastmenGor = new WFMModelBeastman();

    private final WFMModelBeastman modelBeastmenGorArmorChestPlate = new WFMModelBeastman(1.0f);

    private final WFMModelBeastman modelBeastmenGorArmor = new WFMModelBeastman(0.5f);



    private final WFMModelBeastmanUngor modelBeastmenUngor = new WFMModelBeastmanUngor();

    private final WFMModelBeastmanUngor modelBeastmenUngorArmorChestPlate = new WFMModelBeastmanUngor(1.0f);

    private final WFMModelBeastmanUngor modelBeastmenUngorArmor = new WFMModelBeastmanUngor(0.5f);



    private final WFMModelLizardmenSaurus modelSaurus = new WFMModelLizardmenSaurus();

    private final WFMModelLizardmenSaurus modelSaurusArmorChestPlate = new WFMModelLizardmenSaurus(1.0f);

    private final WFMModelLizardmenSaurus modelSaurusArmor = new WFMModelLizardmenSaurus(0.5f);



    private final WFMModelLizardmenSkink modelSkink = new WFMModelLizardmenSkink();

    private final WFMModelLizardmenSkink modelSkinkArmorChestPlate = new WFMModelLizardmenSkink(1.0f);

    private final WFMModelLizardmenSkink modelSkinkArmor = new WFMModelLizardmenSkink(0.5f);



    public WFMRenderPlayer()

    {

        super();

    }



    @Override

    public void doRender(AbstractClientPlayer player, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)

    {



        //String playerRace = WFMPlayerClassInfo.get(player).getPlayerClass();

        if (LOTRLevelData.getData(player).needsSave()) {

            WFMPlayerClass playerRace = LOTRLevelData.getData(player).playerClass;

            this.mainModel.textureHeight = 32;

            this.mainModel.textureWidth = 64;

            if (playerRace.isSkaven()) {

                this.mainModel = this.modelSkaven;

                this.mainModel.textureHeight = 256;

                this.mainModel.textureWidth = 128;

                this.modelBipedMain = (ModelBiped) this.mainModel;

                this.modelArmorChestplate = modelSkavenArmorChestPlate;

                this.modelArmor = modelSkavenArmor;

            } else if (playerRace.isOgre()) {

                this.mainModel = this.modelOgre;

                this.mainModel.textureHeight = 128;

                this.mainModel.textureWidth = 128;

                this.modelBipedMain = (ModelBiped) this.mainModel;

                this.modelArmorChestplate = modelOgreArmorChestPlate;

                this.modelArmor = modelOgreArmor;

            } else if (playerRace.isOrc()) {

                this.mainModel = this.modelOrc;

                this.mainModel.textureHeight = 64;

                this.mainModel.textureWidth = 64;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelOrcArmorChestPlate;

                this.modelArmor = modelOrcArmor;

            } else if (playerRace.isGoblin()) {

                this.mainModel = this.modelGoblin;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelGoblinArmorChestPlate;

                this.modelArmor = modelGoblinArmor;

            } else if (playerRace.isDwarf()) {

                this.mainModel = this.modelDwarf;

                this.modelBipedMain = (WFMModelDwarf)this.mainModel;

                this.modelArmorChestplate = modelDwarfArmorChestPlate;

                this.modelArmor = modelDwarfArmor;

            } else if (playerRace.isBeastmanGor()) {

                this.mainModel = this.modelBeastmenGor;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelBeastmenGorArmorChestPlate;

                this.modelArmor = modelBeastmenGorArmor;

            } else if (playerRace.equals(WFMPlayerClass.BEASTMAN_UNGOR)) {

                this.mainModel = this.modelBeastmenUngor;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelBeastmenUngorArmorChestPlate;

                this.modelArmor = modelBeastmenUngorArmor;

            } else if (playerRace.isSaurus()) {

                this.mainModel = this.modelSaurus;

                this.mainModel.textureHeight = 256;

                this.mainModel.textureWidth = 128;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelSaurusArmorChestPlate;

                this.modelArmor = modelSaurusArmor;

            } else if (playerRace.isSkink()) {

                this.mainModel = this.modelSkink;

                this.mainModel.textureHeight = 256;

                this.mainModel.textureWidth = 128;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelSkinkArmorChestPlate;

                this.modelArmor = modelSkinkArmor;

            } else  if (playerRace.isSkeleton()) {

                this.mainModel = this.modelSkeleton;

                this.modelBipedMain = (WFMModelSkeleton)this.mainModel;

                this.modelArmorChestplate = modelSkeletonArmorChestPlate;

                this.modelArmor = modelSkeletonArmor;

            } else if (playerRace.isNorthman()) {

                this.mainModel = this.modelBiped;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelBipedArmorChestPlate;

                this.modelArmor = modelBipedArmor;

                GL11.glScalef(1.0f, 1.0f, 1.0f);

            } else {

                this.mainModel = this.modelBiped;

                this.modelBipedMain = (ModelBiped)this.mainModel;

                this.modelArmorChestplate = modelBipedArmorChestPlate;

                this.modelArmor = modelBipedArmor;

            }

        }

        super.doRender(player, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);

    }
 
7,099
324
1,510
А как именно перестает работать?

Что, если ловить событие RenderLivingEvent.Pre, отменять для игрока и вызывать свой рендер?
 
56
1
А как именно перестает работать?

Что, если ловить событие RenderLivingEvent.Pre, отменять для игрока и вызывать свой рендер?
Хм, можно попробовать. Я только не совсем понимаю, как именно вызвать там свой рендер.
 
56
1
А как именно перестает работать?

Что, если ловить событие RenderLivingEvent.Pre, отменять для игрока и вызывать свой рендер?
Возможно я что-то не так делаю, но когда пытаюсь сделать как вы сказали, выскакивает StackOverflowError
 
7,099
324
1,510
Если ты вызываешь из этого события рендер игрока, то он рекурсивно вызывает это событие.
Тебе нужно не регать свой рендер для игрока, а просто вызывать его логику из ивента
 
Сверху