Filled in some param names + fixed borked texture

This commit is contained in:
Sarinsa 2022-06-21 03:19:57 +02:00 committed by Sarinsa
parent 459487d051
commit 5b67ac53b9
4 changed files with 14 additions and 15 deletions

View file

@ -25,7 +25,7 @@ public class SpecialCreeperRenderer extends CreeperRenderer {
public SpecialCreeperRenderer( EntityRendererManager rendererManager ) {
super( rendererManager );
baseShadowRadius = shadowRadius;
// addLayer( new SpecialMobEyesLayer<>( this ) );TODO
addLayer( new SpecialMobEyesLayer<>( this ) );
addLayer( new SpecialMobOverlayLayer<>( this, new CreeperModel<>( 0.25F ) ) );
}

View file

@ -6,6 +6,7 @@ import fathertoast.specialmobs.common.core.SpecialMobs;
import fathertoast.specialmobs.common.entity.ISpecialMob;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.IEntityRenderer;
import net.minecraft.client.renderer.entity.layers.AbstractEyesLayer;
@ -27,17 +28,16 @@ public class SpecialMobEyesLayer<T extends Entity, M extends EntityModel<T>> ext
public SpecialMobEyesLayer( IEntityRenderer<T, M> renderer ) {
super( renderer );
}
// I have no clue what all these floats mean, but also I don't really care right now. Would be nice to know eventually.
@Override
public void render( MatrixStack matrixStack, IRenderTypeBuffer buffer, int layer, T entity,
float a, float b, float c, float d, float e, float f ) {
public void render( MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight, T entity, float limbSwing,
float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch ) {
final ResourceLocation eyesTexture = ((ISpecialMob<?>) entity).getSpecialData().getTextureEyes();
if( eyesTexture == null ) return;
//TODO does not work; for some reason, all the transparency renders as white
IVertexBuilder ivertexbuilder = buffer.getBuffer( RenderType.eyes( eyesTexture ) );
this.getParentModel().renderToBuffer( matrixStack, ivertexbuilder, 15728640, OverlayTexture.NO_OVERLAY,
IVertexBuilder vertexBuilder = buffer.getBuffer( RenderType.eyes(eyesTexture) );
this.getParentModel().renderToBuffer( matrixStack, vertexBuilder, LightTexture.pack(15, 15), OverlayTexture.NO_OVERLAY,
1.0F, 1.0F, 1.0F, 1.0F );
}

View file

@ -28,22 +28,21 @@ public class SpecialMobOverlayLayer<T extends Entity, M extends EntityModel<T>>
super( renderer );
layerModel = model;
}
// I have no clue what all these floats mean, but also I don't really care right now. Would be nice to know eventually.
@Override
public void render( MatrixStack matrixStack, IRenderTypeBuffer buffer, int layer, T entity,
float a, float b, float c, float d, float e, float f ) {
public void render( MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight, T entity,
float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch ) {
final ResourceLocation overlayTexture = ((ISpecialMob<?>) entity).getSpecialData().getTextureOverlay();
if( overlayTexture == null ) return;
//TODO this renders oddly dark, look for way to fix lighting
//float f0 = (float) entity.tickCount + c;
layerModel.prepareMobModel( entity, a, b, c );
layerModel.prepareMobModel( entity, limbSwing, limbSwingAmount, partialTicks );
this.getParentModel().copyPropertiesTo( layerModel );
IVertexBuilder ivertexbuilder = buffer.getBuffer( RenderType.entityCutoutNoCull( overlayTexture, false ) );
layerModel.setupAnim( entity, a, b, d, e, f );
layerModel.renderToBuffer( matrixStack, ivertexbuilder, layer, OverlayTexture.NO_OVERLAY,
IVertexBuilder vertexBuilder = buffer.getBuffer( RenderType.entityCutoutNoCull( overlayTexture, false ) );
layerModel.setupAnim( entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch );
layerModel.renderToBuffer( matrixStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY,
0.5F, 0.5F, 0.5F, 1.0F );
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB