mojira.dev

dejordzta incognito

Assigned

No issues.

Reported

MC-5500 Player stops moving on block click Duplicate

Comments

I have found through testing that this can be remedied and fixes the odd way the ears render, through changing the code a little more drastically. I'm not sure when this change came in to play and broke the mau5 ears, but I image it was since layers were introduced.

Note: I created a entirely new Layer to test and fix this. customMau5Ears is simply a new ModelRenderer, and LayerCustomMau5Ears is the entirely new class.

 

To fix this I first changed the way mau5 ears are created in ModelPlayer to add two boxes as follows:

 

// ...
this.customMau5Ears = new ModelRenderer(this, 24, 0);
this.customMau5Ears.addBox(1.5F, -10.5F, -1.0F, 6, 6, 1, modelSize);
this.customMau5Ears.addBox(-7.5F, -10.5F, -1.0F, 6, 6, 1, modelSize);
this.customMau5Ears.setRotationPoint(0.0F, 0.0F, 0.0F);
// ...

This creates two separate boxes at the correct positions, rather than creating one box and rendering it twice; this is what creates the odd rotations when you rotate your head quick enough.

Second, I duplicated the renderDeadmau5Ears function to the following:

 

public void renderCustomMau5Ears(float scale) {
    GlStateManager.scale(1.3333334F, 1.3333334F,1.3333334F);
    this.customMau5Ears.render(scale);
    GlStateManager.scale(1.0F, 1.0F, 1.0F);
}

This takes the scaling from the original LayerDeadmau5Ears class and handles it here; I guess it really wouldn't matter exactly where this is called.

Third, I made sure the angles were replicated from the head, and set the layer to invisible in the setInvisible function:

 

// ...
copyModelAngles(this.bipedHead, this.customMau5Ears);
...
this.customMau5Ears.showModel = invisible;
// ...

Fourth, I created a brand new Layer class that simply implements the LayerRenderer class:

public class LayerCustomMau5Ears implements LayerRenderer<AbstractClientPlayer> {
    private final RenderPlayer playerRenderer;

    public LayerCustomMau5Ears(RenderPlayer playerRendererIn) {
        this.playerRenderer = playerRendererIn;
    }

    public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
        if (entitylivingbaseIn.hasSkin() && !entitylivingbaseIn.isInvisible()) {
                this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationSkin());

            if(entitylivingbaseIn.isSneaking())
                GlStateManager.translate(0F, 0.2F, 0F);
            this.playerRenderer.getMainModel().renderCustomMau5Ears(0.0625F);
        }
    }

    public boolean shouldCombineTextures() {
        return true;
    }
}

Lastly, I instantiated this new layer in RenderPlayer:

 

// ...
this.addLayer(new LayerCustomMau5Ears(this));
// ...

 

The ears are now fixed; they stick to the head as they used to/should do and I haven't noticed any bugs i.e when sneaking or gliding. 

 

 

 

Sorry, due to failing internet I failed to return any search results, nor did I notice anything on the first 12 or so pages. Thanks, though.