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

@@ -69,23 +69,12 @@ public class GuiReplaySettings extends GuiScreen {
int xPos = this.width / 2 - 155 + i % 2 * 160; int xPos = this.width / 2 - 155 + i % 2 * 160;
int yPos = this.height / 6 + 24 * (i >> 1); int yPos = this.height / 6 + 24 * (i >> 1);
if(o == ReplayOptions.lighting) { if(o == ReplayOptions.linear) {
GuiToggleButton lightingButton = new GuiSettingsOnOffButton(REPLAY_SETTINGS_ENABLE_LIGHTING, xPos, yPos, 150, 20, o);
buttonList.add(lightingButton);
} else if(o == ReplayOptions.linear) {
GuiToggleButton linearButton = new GuiSettingsOnOffButton(REPLAY_SETTINGS_FORCE_LINEAR, xPos, yPos, 150, 20, o, GuiToggleButton linearButton = new GuiSettingsOnOffButton(REPLAY_SETTINGS_FORCE_LINEAR, xPos, yPos, 150, 20, o,
I18n.format("replaymod.gui.settings.interpolation.linear"), I18n.format("replaymod.gui.settings.interpolation.cubic")); I18n.format("replaymod.gui.settings.interpolation.linear"), I18n.format("replaymod.gui.settings.interpolation.cubic"));
buttonList.add(linearButton); buttonList.add(linearButton);
} else if(o == ReplayOptions.previewPath) { } else {
GuiToggleButton pathPreviewButton = new GuiSettingsOnOffButton(REPLAY_SETTINGS_PATHPREVIEW_ID, xPos, yPos, 150, 20, o);
buttonList.add(pathPreviewButton);
} else if(o == ReplayOptions.keyframeCleanCallback) {
GuiToggleButton keyframeClearCallbackButton = new GuiSettingsOnOffButton(REPLAY_SETTINGS_CLEARCALLBACK_ID, xPos, yPos, 150, 20, o);
buttonList.add(keyframeClearCallbackButton);
} else if(o == ReplayOptions.showChat) {
buttonList.add(new GuiSettingsOnOffButton(0, xPos, yPos, 150, 20, o)); buttonList.add(new GuiSettingsOnOffButton(0, xPos, yPos, 150, 20, o));
} }

View File

@@ -1,12 +1,16 @@
package eu.crushedpixel.replaymod.mixin; package eu.crushedpixel.replaymod.mixin;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.settings.ReplaySettings;
import eu.crushedpixel.replaymod.video.EntityRendererHandler; import eu.crushedpixel.replaymod.video.EntityRendererHandler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RendererLivingEntity.class) @Mixin(RendererLivingEntity.class)
@@ -19,4 +23,12 @@ public abstract class MixinRendererLivingEntity {
ci.cancel(); 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
}
} }

View File

@@ -204,7 +204,8 @@ public class ReplaySettings {
lighting(false, "replaymod.gui.settings.lighting"), lighting(false, "replaymod.gui.settings.lighting"),
previewPath(false, "replaymod.gui.settings.pathpreview"), previewPath(false, "replaymod.gui.settings.pathpreview"),
keyframeCleanCallback(true, "replaymod.gui.settings.keyframecleancallback"), keyframeCleanCallback(true, "replaymod.gui.settings.keyframecleancallback"),
showChat(false, "options.chat.visibility"); showChat(false, "options.chat.visibility"),
renderInvisible(true, "replaymod.gui.settings.renderinvisible");
private Object value; private Object value;
private String name; private String name;

View File

@@ -261,6 +261,7 @@ replaymod.gui.settings.resources=Server Resource Packs
replaymod.gui.settings.interpolation=Path Interpolation replaymod.gui.settings.interpolation=Path Interpolation
replaymod.gui.settings.pathpreview=Show Path Preview replaymod.gui.settings.pathpreview=Show Path Preview
replaymod.gui.settings.keyframecleancallback=Clear Confirmation replaymod.gui.settings.keyframecleancallback=Clear Confirmation
replaymod.gui.settings.renderinvisible=Render invisible Entities
replaymod.gui.settings.warning.linea=WARNING: Recording settings will be replaymod.gui.settings.warning.linea=WARNING: Recording settings will be
replaymod.gui.settings.warning.lineb=applied the next time you join a world. replaymod.gui.settings.warning.lineb=applied the next time you join a world.