GeckoLib

GeckoLib

146M Downloads

Entities using GeoEntityRenderer still render when being invisible

mcpecommander opened this issue ยท 1 comments

commented

Invisibility potions don't affect mobs or entities extending GeoEntityRenderer.
The reason is because mobs by default have renderType entityCutout which ignores the alpha value in the renderRecursively method.

(float) renderColor.getBlue() / 255f, invis ? 0.0F : (float) renderColor.getAlpha() / 255);

An easier solution to this, is to simply move the check to the shouldRender method or do the boolean check for the whole render call:

if(entity.isInvisibleTo(Minecraft.getInstance().player)) render(model, entity, partialTicks, renderType, stack, bufferIn, null, packedLightIn,
				getPackedOverlay(entity, 0), (float) renderColor.getRed() / 255f, (float) renderColor.getGreen() / 255f,
				(float) renderColor.getBlue() / 255f, invis ? 0.0F : (float) renderColor.getAlpha() / 255);

You might as well use the method isVisible that is sitting there not doing anything.
This line:

protected boolean isVisible(T livingEntityIn) {

instead of rewriting entity.isInvisibleTo.

commented

Can not reproduce, please provide an example of this not working as I have tested with and without entityCutout. We do the check in the normal render call not renderRecursively anyway, not sure where you are seeing that done.