More 1.15 mapping fixes

This commit is contained in:
Jonas Herzig
2020-03-31 16:50:20 +02:00
parent 5315c66943
commit a3e1792fe7
5 changed files with 49 additions and 35 deletions

View File

@@ -4,14 +4,19 @@ package com.replaymod.compat.shaders.mixin;
import com.replaymod.compat.shaders.ShaderReflection;
import com.replaymod.render.hooks.EntityRendererHandler;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Frustum;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.VisibleRegion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11500
//#else
import net.minecraft.client.render.VisibleRegion;
//#endif
//#if MC>=11400
import net.minecraft.client.render.Camera;
//#else
@@ -38,7 +43,12 @@ public abstract class MixinShaderRenderGlobal {
//$$ double partialTicks,
//#endif
//#endif
//#if MC>=11500
//$$ Frustum camera,
//$$ boolean skipUpdate,
//#else
VisibleRegion camera,
//#endif
int frameCount,
boolean playerSpectator,
CallbackInfo ci

View File

@@ -7,10 +7,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
import org.spongepowered.asm.mixin.injection.Inject;
//#if MC>=10800
import net.minecraft.client.render.VisibleRegion;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
//#else
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -35,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public abstract class MixinRender {
//#if MC>=10800
@Inject(method = "isVisible", at=@At("HEAD"), cancellable = true)
public void replayModExtras_isPlayerHidden(Entity entity, VisibleRegion camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> ci) {
public void replayModExtras_isPlayerHidden(Entity entity, @Coerce Object camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> ci) {
ReplayModExtras.instance.get(PlayerOverview.class).ifPresent(playerOverview -> {
if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity;

View File

@@ -4,12 +4,17 @@ package com.replaymod.render.blend.mixin;
import com.replaymod.render.blend.BlendState;
import com.replaymod.render.blend.exporters.EntityExporter;
import com.replaymod.render.blend.exporters.TileEntityExporter;
import net.minecraft.client.render.VisibleRegion;
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.CallbackInfo;
//#if MC>=11500
//$$ import net.minecraft.client.render.Frustum;
//#else
import net.minecraft.client.render.VisibleRegion;
//#endif
//#if MC>=11400
import net.minecraft.client.render.Camera;
//#else
@@ -31,6 +36,9 @@ public abstract class MixinRenderGlobal {
// FIXME wither skull ._. mojang pls
//#if MC>=11500
//$$ @Inject(method = "renderEntity", at = @At("HEAD"))
//#else
@Inject(method = "renderEntities",
at = @At(value = "INVOKE",
//#if MC>=10904
@@ -38,19 +46,17 @@ public abstract class MixinRenderGlobal {
//#else
//$$ target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z"))
//#endif
private void preEntityRender(
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
//#endif
private void preEntityRender(CallbackInfo ci) {
BlendState blendState = BlendState.getState();
if (blendState != null) {
blendState.get(EntityExporter.class).preEntitiesRender();
}
}
//#if MC>=11500
//$$ @Inject(method = "renderEntity", at = @At("RETURN"))
//#else
@Inject(method = "renderEntities",
at = @At(value = "INVOKE",
//#if MC>=10904
@@ -59,19 +65,17 @@ public abstract class MixinRenderGlobal {
//$$ target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z",
//#endif
shift = At.Shift.AFTER))
private void postEntityRender(
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
//#endif
private void postEntityRender(CallbackInfo ci) {
BlendState blendState = BlendState.getState();
if (blendState != null) {
blendState.get(EntityExporter.class).postEntitiesRender();
}
}
//#if MC>=11500
//$$ // FIXME
//#else
@Inject(method = "renderEntities", at = @At(
value = "INVOKE",
//#if MC>=11400
@@ -80,13 +84,7 @@ public abstract class MixinRenderGlobal {
//$$ target = "Lnet/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher;renderTileEntity(Lnet/minecraft/tileentity/TileEntity;FI)V"
//#endif
))
private void preTileEntityRender(
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
private void preTileEntityRender(CallbackInfo ci) {
BlendState blendState = BlendState.getState();
if (blendState != null) {
blendState.get(TileEntityExporter.class).preTileEntitiesRender();
@@ -102,17 +100,12 @@ public abstract class MixinRenderGlobal {
//#endif
shift = At.Shift.AFTER
))
private void postTileEntityRender(
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
private void postTileEntityRender(CallbackInfo ci) {
BlendState blendState = BlendState.getState();
if (blendState != null) {
blendState.get(TileEntityExporter.class).postTileEntitiesRender();
}
}
//#endif
}
//#endif

View File

@@ -2,13 +2,18 @@
package com.replaymod.replay.mixin;
import com.replaymod.replay.ReplayModReplay;
import net.minecraft.client.render.VisibleRegion;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.ArrowEntityRenderer;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
//#if MC>=11500
//$$ import net.minecraft.client.render.Frustum;
//#else
import net.minecraft.client.render.VisibleRegion;
//#endif
@Mixin(ArrowEntityRenderer.class)
public abstract class MixinRenderArrow extends EntityRenderer {
protected MixinRenderArrow(EntityRenderDispatcher renderManager) {
@@ -17,7 +22,13 @@ public abstract class MixinRenderArrow extends EntityRenderer {
@SuppressWarnings("unchecked")
@Override
public boolean isVisible(Entity entity, VisibleRegion camera, double camX, double camY, double camZ) {
public boolean isVisible(Entity entity,
//#if MC>=11500
//$$ Frustum camera,
//#else
VisibleRegion camera,
//#endif
double camX, double camY, double camZ) {
// Force arrows to always render, otherwise they stop rendering when you get close to them
return ReplayModReplay.instance.getReplayHandler() != null || super.isVisible(entity, camera, camX, camY, camZ);
}