Added option to completely hide invisible entities like Armor Stands instead of them being rendered semi-transparent

This commit is contained in:
CrushedPixel
2015-09-04 01:32:57 +02:00
parent 89e51ef515
commit 9d4fdccb0f
4 changed files with 17 additions and 14 deletions

View File

@@ -1,12 +1,16 @@
package eu.crushedpixel.replaymod.mixin;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.settings.ReplaySettings;
import eu.crushedpixel.replaymod.video.EntityRendererHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RendererLivingEntity.class)
@@ -19,4 +23,12 @@ public abstract class MixinRendererLivingEntity {
ci.cancel();
}
}
@Redirect(method = "renderModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;isInvisibleToPlayer(Lnet/minecraft/entity/player/EntityPlayer;)Z"))
private boolean shouldInvisibleNotBeRendered(EntityLivingBase entity, EntityPlayer thePlayer) {
if(ReplaySettings.ReplayOptions.renderInvisible.getValue() == Boolean.TRUE|| !ReplayHandler.isInReplay()) {
return entity.isInvisibleToPlayer(thePlayer);
}
return true; //the original method inverts the return value
}
}