Update to Minecraft 1.9.4
This commit is contained in:
@@ -12,12 +12,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(GuiSpectator.class)
|
||||
public abstract class MixinGuiSpectator {
|
||||
@Shadow
|
||||
private Minecraft field_175268_g;
|
||||
private Minecraft mc;
|
||||
|
||||
@Inject(method = "func_175260_a", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "onHotbarSelected", at = @At("HEAD"), cancellable = true)
|
||||
public void isInReplay(int i, CallbackInfo ci) {
|
||||
// Prevent spectator gui from opening while in a replay
|
||||
if (field_175268_g.thePlayer instanceof CameraEntity) {
|
||||
if (mc.thePlayer instanceof CameraEntity) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.replaymod.replay.mixin;
|
||||
|
||||
import com.replaymod.replay.camera.CameraEntity;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import com.replaymod.replay.camera.CameraEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.stats.StatFileWriter;
|
||||
import net.minecraft.stats.StatisticsManager;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -21,12 +21,12 @@ public abstract class MixinPlayerControllerMP {
|
||||
private Minecraft mc;
|
||||
|
||||
@Shadow
|
||||
private NetHandlerPlayClient netClientHandler;
|
||||
private NetHandlerPlayClient connection;
|
||||
|
||||
@Inject(method = "func_178892_a", at=@At("HEAD"), cancellable = true)
|
||||
private void replayModReplay_createReplayCamera(World worldIn, StatFileWriter statFileWriter, CallbackInfoReturnable<EntityPlayerSP> ci) {
|
||||
@Inject(method = "createClientPlayer", at=@At("HEAD"), cancellable = true)
|
||||
private void replayModReplay_createReplayCamera(World worldIn, StatisticsManager statisticsManager, CallbackInfoReturnable<EntityPlayerSP> ci) {
|
||||
if (ReplayModReplay.instance.getReplayHandler() != null) {
|
||||
ci.setReturnValue(new CameraEntity(mc, worldIn, netClientHandler, statFileWriter));
|
||||
ci.setReturnValue(new CameraEntity(mc, worldIn, connection, statisticsManager));
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ 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.client.renderer.entity.RenderArmorStand;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -10,9 +10,9 @@ 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)
|
||||
@Mixin(RenderArmorStand.class)
|
||||
public abstract class MixinRenderArmorStand {
|
||||
@Inject(method = "canRenderName", 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()) {
|
||||
@@ -14,6 +14,7 @@ public abstract class MixinRenderArrow extends Render {
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean shouldRender(Entity entity, ICamera camera, double camX, double camY, double camZ) {
|
||||
// Force arrows to always render, otherwise they stop rendering when you get close to them
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.replaymod.replay.mixin;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@@ -2,7 +2,7 @@ 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.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -11,8 +11,8 @@ 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 {
|
||||
@Mixin(RenderLivingBase.class)
|
||||
public abstract class MixinRenderLivingBase {
|
||||
@Inject(method = "canRenderName", at = @At("HEAD"), cancellable = true)
|
||||
private void replayModReplay_canRenderInvisibleName(EntityLivingBase entity, CallbackInfoReturnable<Boolean> ci) {
|
||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
||||
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(TileEntityEndPortalRenderer.class)
|
||||
public class MixinTileEntityEndPortalRenderer {
|
||||
@Redirect(method = "func_180544_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
@Redirect(method = "renderTileEntityAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
private long replayModReplay_getEnchantmentTime() {
|
||||
ReplayHandler replayHandler = ReplayModReplay.instance.getReplayHandler();
|
||||
if (replayHandler != null) {
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.ViewFrustum;
|
||||
import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
|
||||
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -31,7 +31,7 @@ public abstract class MixinViewFrustum {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instead of calling {@link RenderChunk#setPosition(BlockPos)} we recreate the render chunk
|
||||
* Instead of calling {@link RenderChunk#setOrigin(int, int, int)} we recreate the render chunk
|
||||
* which seems to solve the problem that chunks are invisible when you leave an area and return
|
||||
* to it.
|
||||
* Any better fixes are welcome.
|
||||
@@ -48,17 +48,18 @@ public abstract class MixinViewFrustum {
|
||||
int k = this.countChunksX * 16;
|
||||
|
||||
for (int l = 0; l < this.countChunksX; ++l) {
|
||||
int i1 = this.func_178157_a(i, k, l);
|
||||
int i1 = this.getBaseCoordinate(i, k, l);
|
||||
for (int j1 = 0; j1 < this.countChunksZ; ++j1) {
|
||||
int k1 = this.func_178157_a(j, k, j1);
|
||||
int k1 = this.getBaseCoordinate(j, k, j1);
|
||||
for (int l1 = 0; l1 < this.countChunksY; ++l1) {
|
||||
int i2 = l1 * 16;
|
||||
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
|
||||
BlockPos blockpos = new BlockPos(i1, i2, k1);
|
||||
if (!blockpos.equals(renderchunk.getPosition())) {
|
||||
// Recreate render chunk instead of setting its position
|
||||
renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l] =
|
||||
renderChunkFactory.makeRenderChunk(world, renderGlobal, blockpos, 0);
|
||||
(renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l] =
|
||||
renderChunkFactory.create(world, renderGlobal, 0)
|
||||
).setOrigin(blockpos.getX(), blockpos.getY(), blockpos.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,5 +67,5 @@ public abstract class MixinViewFrustum {
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Shadow abstract int func_178157_a(int p_178157_1_, int p_178157_2_, int p_178157_3_);
|
||||
@Shadow abstract int getBaseCoordinate(int p_178157_1_, int p_178157_2_, int p_178157_3_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user