Skip to content

Commit

Permalink
Rename legacy references through parameter names to VertexConsumerPro…
Browse files Browse the repository at this point in the history
…vider
  • Loading branch information
coderbot16 committed Sep 14, 2021
1 parent 9d823af commit 1c1e8fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public abstract class MixinLivingEntityRenderer {
abstract float getAttackAnim(LivingEntity entity, float tickDelta);

@ModifyVariable(method = "render", at = @At("HEAD"))
private MultiBufferSource iris$wrapProvider(MultiBufferSource provider, LivingEntity entity, float yaw, float tickDelta, PoseStack pose, MultiBufferSource bufferSource, int light) {
if (!(provider instanceof Groupable)) {
private MultiBufferSource iris$wrapProvider(MultiBufferSource bufferSource, LivingEntity entity, float yaw,
float tickDelta, PoseStack pose, MultiBufferSource bufferSourceArg,
int light) {
if (!(bufferSource instanceof Groupable)) {
// Entity color is not supported in this context, no buffering available.
return provider;
return bufferSource;
}

boolean hurt;
Expand All @@ -35,9 +37,9 @@ public abstract class MixinLivingEntityRenderer {

if (hurt || whiteFlash > 0.0) {
EntityColorRenderStateShard phase = new EntityColorRenderStateShard(hurt, whiteFlash);
return new EntityColorMultiBufferSource(provider, phase);
return new EntityColorMultiBufferSource(bufferSource, phase);
} else {
return provider;
return bufferSource;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
@Mixin(TntMinecartRenderer.class)
public abstract class MixinTntMinecartRenderer {
@ModifyVariable(method = "renderWhiteSolidBlock", at = @At("HEAD"))
private static MultiBufferSource iris$wrapProvider(MultiBufferSource provider, BlockState blockState,
PoseStack poseStack, MultiBufferSource bufferSource, int light,
private static MultiBufferSource iris$wrapProvider(MultiBufferSource bufferSource, BlockState blockState,
PoseStack poseStack, MultiBufferSource bufferSourceArg, int light,
boolean drawFlash) {
if (!(provider instanceof Groupable)) {
if (!(bufferSource instanceof Groupable)) {
// Entity color is not supported in this context, no buffering available.
return provider;
return bufferSource;
}

if (drawFlash) {
EntityColorRenderStateShard phase = new EntityColorRenderStateShard(false, 1.0F);
return new EntityColorMultiBufferSource(provider, phase);
return new EntityColorMultiBufferSource(bufferSource, phase);
} else {
return provider;
return bufferSource;
}
}
}
8 changes: 4 additions & 4 deletions src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame
((DrawCallTrackingRenderBuffers) buffers).resetDrawCounts();
}

MultiBufferSource.BufferSource provider = buffers.bufferSource();
MultiBufferSource.BufferSource bufferSource = buffers.bufferSource();
EntityRenderDispatcher dispatcher = levelRenderer.getEntityRenderDispatcher();

int shadowEntities = 0;
Expand All @@ -517,7 +517,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame
levelRenderer.getLevel().getProfiler().popPush("build geometry");

for (Entity entity : renderedEntities) {
levelRenderer.invokeRenderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, modelView, provider);
levelRenderer.invokeRenderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
shadowEntities++;
}

Expand All @@ -532,7 +532,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame
modelView.pushPose();
BlockPos pos = entity.getBlockPos();
modelView.translate(pos.getX() - cameraX, pos.getY() - cameraY, pos.getZ() - cameraZ);
BlockEntityRenderDispatcher.instance.render(entity, tickDelta, modelView, provider);
BlockEntityRenderDispatcher.instance.render(entity, tickDelta, modelView, bufferSource);
modelView.popPose();

shadowBlockEntities++;
Expand All @@ -546,7 +546,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame
// NB: Don't try to draw the translucent parts of entities afterwards. It'll cause problems since some
// shader packs assume that everything drawn afterwards is actually translucent and should cast a colored
// shadow...
provider.endBatch();
bufferSource.endBatch();

levelRenderer.getLevel().getProfiler().popPush("translucent depth copy");

Expand Down

0 comments on commit 1c1e8fa

Please sign in to comment.