Skip to content

Commit

Permalink
Revert "Fix entityColor not being set for glowing entities"
Browse files Browse the repository at this point in the history
This reverts commit 546b5b8
  • Loading branch information
IMS212 committed Jan 6, 2022
1 parent e587844 commit 7b9cb34
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public String toString() {
return "iris_wrapped:" + this.wrapped.toString();
}

public RenderStateShard getExtra() {
return extra;
}

private static boolean shouldSortOnUpload(RenderType type) {
return ((RenderTypeAccessor) type).shouldSortOnUpload();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.coderbot.iris.Iris;
import net.coderbot.iris.layer.EntityColorRenderStateShard;
import net.coderbot.iris.layer.InnerWrappedRenderType;
import net.coderbot.iris.layer.IrisRenderTypeWrapper;
import net.coderbot.iris.mixin.rendertype.RenderStateShardAccessor;
Expand All @@ -14,26 +13,13 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MultiBufferSource.BufferSource.class)
public class MixinBufferSource_WrapperChecking {
@Unique
private final Set<String> unwrapped = new ObjectOpenHashSet<>();

@ModifyVariable(method = "getBuffer", at = @At("HEAD"))
private RenderType unwrapBufferIfNeeded(RenderType renderType) {
// Ensure that entity color wrapped render layers do not take effect when entity batching is inoperable.
if (renderType instanceof InnerWrappedRenderType) {
if (((InnerWrappedRenderType) renderType).getExtra() instanceof EntityColorRenderStateShard) {
return ((InnerWrappedRenderType) renderType).unwrap();
}
}

return renderType;
}

@Inject(method = "endBatch(Lnet/minecraft/client/renderer/RenderType;)V", at = @At("HEAD"))
private void iris$beginDraw(RenderType renderType, CallbackInfo ci) {
if (!(renderType instanceof IrisRenderTypeWrapper) && !(renderType instanceof InnerWrappedRenderType)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.coderbot.iris.mixin;

import com.mojang.blaze3d.vertex.PoseStack;
import net.coderbot.batchedentityrendering.impl.Groupable;
import net.coderbot.iris.Iris;
import net.coderbot.iris.layer.EntityColorRenderStateShard;
import net.coderbot.iris.layer.EntityColorMultiBufferSource;
Expand All @@ -21,6 +22,11 @@ public abstract class MixinLivingEntityRenderer {
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 bufferSource;
}

boolean hurt;
if (Iris.isPhysicsModInstalled()) {
hurt = entity.hurtTime > 0 && !entity.isDeadOrDying();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.coderbot.iris.mixin;

import com.mojang.blaze3d.vertex.PoseStack;
import net.coderbot.batchedentityrendering.impl.Groupable;
import net.coderbot.iris.layer.EntityColorRenderStateShard;
import net.coderbot.iris.layer.EntityColorMultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource;
Expand All @@ -16,6 +17,11 @@ public abstract class MixinTntMinecartRenderer {
private static MultiBufferSource iris$wrapProvider(MultiBufferSource bufferSource, BlockState blockState,
PoseStack poseStack, MultiBufferSource bufferSourceArg, int light,
boolean drawFlash) {
if (!(bufferSource instanceof Groupable)) {
// Entity color is not supported in this context, no buffering available.
return bufferSource;
}

if (drawFlash) {
EntityColorRenderStateShard phase = new EntityColorRenderStateShard(false, 1.0F);
return new EntityColorMultiBufferSource(bufferSource, phase);
Expand Down

0 comments on commit 7b9cb34

Please sign in to comment.