Completely hide invisible entities during replay
Fixes invisible entities when in spectator mode during recording
This commit is contained in:
@@ -4,11 +4,9 @@ import com.replaymod.render.hooks.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,20 +17,5 @@ public abstract class MixinRendererLivingEntity {
|
|||||||
if (handler != null && !handler.getSettings().isRenderNameTags()) {
|
if (handler != null && !handler.getSettings().isRenderNameTags()) {
|
||||||
ci.setReturnValue(false); //this calls the cancel method
|
ci.setReturnValue(false); //this calls the cancel method
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
// if(ReplayHandler.isInReplay() && entity.isInvisible()
|
|
||||||
// && ReplaySettings.ReplayOptions.renderInvisible.getValue() == Boolean.FALSE) {
|
|
||||||
// ci.setReturnValue(false);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "renderModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;isInvisibleToPlayer(Lnet/minecraft/entity/player/EntityPlayer;)Z"))
|
|
||||||
private boolean replayModRender_shouldInvisibleNotBeRendered(EntityLivingBase entity, EntityPlayer thePlayer) {
|
|
||||||
// TODO
|
|
||||||
// if(ReplaySettings.ReplayOptions.renderInvisible.getValue() == Boolean.TRUE|| !ReplayHandler.isInReplay()) {
|
|
||||||
// return entity.isInvisibleToPlayer(thePlayer);
|
|
||||||
// }
|
|
||||||
return true; //the original method inverts the return value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.replaymod.replay.mixin;
|
||||||
|
|
||||||
|
import com.replaymod.replay.camera.CameraEntity;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.entity.ArmorStandRenderer;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
|
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.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(ArmorStandRenderer.class)
|
||||||
|
public abstract class MixinArmorStandRenderer {
|
||||||
|
@Inject(method = "func_177099_b", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void replayModReplay_canRenderInvisibleName(EntityArmorStand entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
||||||
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
|
ci.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.replaymod.replay.mixin;
|
||||||
|
|
||||||
|
import com.replaymod.replay.camera.CameraEntity;
|
||||||
|
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)
|
||||||
|
public abstract class MixinRendererLivingEntity {
|
||||||
|
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
||||||
|
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||||
|
ci.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "renderModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;isInvisibleToPlayer(Lnet/minecraft/entity/player/EntityPlayer;)Z"))
|
||||||
|
private boolean replayModReplay_shouldInvisibleNotBeRendered(EntityLivingBase entity, EntityPlayer thePlayer) {
|
||||||
|
return thePlayer instanceof CameraEntity || entity.isInvisibleToPlayer(thePlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,11 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"package": "com.replaymod.replay.mixin",
|
"package": "com.replaymod.replay.mixin",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"MixinArmorStandRenderer",
|
||||||
"MixinGuiSpectator",
|
"MixinGuiSpectator",
|
||||||
"MixinPlayerControllerMP",
|
"MixinPlayerControllerMP",
|
||||||
"MixinRenderArrow",
|
"MixinRenderArrow",
|
||||||
|
"MixinRendererLivingEntity",
|
||||||
"MixinRenderItem",
|
"MixinRenderItem",
|
||||||
"MixinRenderManager",
|
"MixinRenderManager",
|
||||||
"MixinTileEntityEndPortalRenderer",
|
"MixinTileEntityEndPortalRenderer",
|
||||||
|
|||||||
Reference in New Issue
Block a user