Skip to content

Commit

Permalink
Clean up rendering code
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Jul 27, 2019
1 parent bc2c052 commit 3cccc93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.CreeperEntityModel;
import net.minecraft.util.Identifier;
import org.lwjgl.opengl.GL11;

public class CreeperlingChargeFeatureRenderer extends FeatureRenderer<CreeperlingEntity, CreeperEntityModel<CreeperlingEntity>> {
private static final Identifier SKIN = new Identifier("textures/entity/creeper/creeper_armor.png");
Expand All @@ -35,31 +36,31 @@ public CreeperlingChargeFeatureRenderer(FeatureRendererContext<CreeperlingEntity
}

@Override
public void render(CreeperlingEntity creeper, float float_1, float float_2, float tickDelta, float float_4, float float_5, float float_6, float float_7) {
public void render(CreeperlingEntity creeper, float f1, float f2, float tickDelta, float f4, float f5, float f6, float f7) {
if (creeper.isCharged()) {
boolean boolean_1 = creeper.isInvisible();
GlStateManager.pushMatrix();
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
GlStateManager.translatef(0.0F, 1.5f, 0.0F);
GlStateManager.depthMask(!boolean_1);
this.bindTexture(SKIN);
GlStateManager.matrixMode(5890);
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
float age = (float)creeper.age + tickDelta;
GlStateManager.translatef(age * 0.01F, age * 0.01F, 0.0F);
GlStateManager.matrixMode(5888);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.enableBlend();
GlStateManager.color4f(0.5F, 0.5F, 0.5F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
this.getModel().copyStateTo(this.creeperModel);
GameRenderer gameRenderer = MinecraftClient.getInstance().gameRenderer;
gameRenderer.setFogBlack(true);
this.creeperModel.render(creeper, float_1, float_2, float_4, float_5, float_6, float_7);
this.creeperModel.render(creeper, f1, f2, f4, f5, f6, f7);
gameRenderer.setFogBlack(false);
GlStateManager.matrixMode(5890);
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void render(CreeperlingEntity creeper, float x, float y, float z, floa

@Nullable
@Override
protected Identifier getTexture(CreeperlingEntity var1) {
protected Identifier getTexture(CreeperlingEntity creeperling) {
return SKIN;
}
}

0 comments on commit 3cccc93

Please sign in to comment.