Add 1.7.10 version
This commit is contained in:
@@ -2,14 +2,19 @@ package com.replaymod.extras.playeroverview.mixin;
|
||||
|
||||
import com.replaymod.extras.ReplayModExtras;
|
||||
import com.replaymod.extras.playeroverview.PlayerOverview;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
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;
|
||||
|
||||
//#if MC>=10800
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
//#else
|
||||
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
//#endif
|
||||
|
||||
/**
|
||||
* This mixin prevents players that are hidden in the PlayerOverview from being rendered.
|
||||
@@ -23,9 +28,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
* One example of the previous solution breaking is when used with VanillaEnhancements because it replaces the
|
||||
* RenderManager with a new custom one which in turn will reset our registered RenderPlayer instances because
|
||||
* it does so after we have already registered with the old RenderManager.
|
||||
*
|
||||
* For 1.7.10, that method doesn't exist, so we use a combination of the event and inject into
|
||||
*/
|
||||
@Mixin(value = Render.class, priority = 1200)
|
||||
public abstract class MixinRender {
|
||||
//#if MC>=10800
|
||||
@Inject(method = "shouldRender", at=@At("HEAD"), cancellable = true)
|
||||
public void replayModExtras_isPlayerHidden(Entity entity, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> ci) {
|
||||
ReplayModExtras.instance.get(PlayerOverview.class).ifPresent(playerOverview -> {
|
||||
@@ -37,4 +45,17 @@ public abstract class MixinRender {
|
||||
}
|
||||
});
|
||||
}
|
||||
//#else
|
||||
//$$ @Inject(method = "doRenderShadowAndFire", at=@At("HEAD"), cancellable = true)
|
||||
//$$ private void replayModExtras_isPlayerHidden(Entity entity, double x, double y, double z, float yaw, float time, CallbackInfo ci) {
|
||||
//$$ ReplayModExtras.instance.get(PlayerOverview.class).ifPresent(playerOverview -> {
|
||||
//$$ if (entity instanceof EntityPlayer) {
|
||||
//$$ EntityPlayer player = (EntityPlayer) entity;
|
||||
//$$ if (playerOverview.isHidden(player.getUniqueID())) {
|
||||
//$$ ci.cancel();
|
||||
//$$ }
|
||||
//$$ }
|
||||
//$$ });
|
||||
//$$ }
|
||||
//#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user