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

View File

@@ -7,10 +7,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
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.Coerce;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
//#if MC>=10800 //#if MC>=10800
import net.minecraft.client.render.VisibleRegion;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
//#else //#else
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -35,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public abstract class MixinRender { public abstract class MixinRender {
//#if MC>=10800 //#if MC>=10800
@Inject(method = "isVisible", at=@At("HEAD"), cancellable = true) @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 -> { ReplayModExtras.instance.get(PlayerOverview.class).ifPresent(playerOverview -> {
if (entity instanceof PlayerEntity) { if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity; 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.BlendState;
import com.replaymod.render.blend.exporters.EntityExporter; import com.replaymod.render.blend.exporters.EntityExporter;
import com.replaymod.render.blend.exporters.TileEntityExporter; import com.replaymod.render.blend.exporters.TileEntityExporter;
import net.minecraft.client.render.VisibleRegion;
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.callback.CallbackInfo; 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 //#if MC>=11400
import net.minecraft.client.render.Camera; import net.minecraft.client.render.Camera;
//#else //#else
@@ -31,6 +36,9 @@ public abstract class MixinRenderGlobal {
// FIXME wither skull ._. mojang pls // FIXME wither skull ._. mojang pls
//#if MC>=11500
//$$ @Inject(method = "renderEntity", at = @At("HEAD"))
//#else
@Inject(method = "renderEntities", @Inject(method = "renderEntities",
at = @At(value = "INVOKE", at = @At(value = "INVOKE",
//#if MC>=10904 //#if MC>=10904
@@ -38,19 +46,17 @@ public abstract class MixinRenderGlobal {
//#else //#else
//$$ target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z")) //$$ target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z"))
//#endif //#endif
private void preEntityRender( //#endif
//#if MC>=11400 private void preEntityRender(CallbackInfo ci) {
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
BlendState blendState = BlendState.getState(); BlendState blendState = BlendState.getState();
if (blendState != null) { if (blendState != null) {
blendState.get(EntityExporter.class).preEntitiesRender(); blendState.get(EntityExporter.class).preEntitiesRender();
} }
} }
//#if MC>=11500
//$$ @Inject(method = "renderEntity", at = @At("RETURN"))
//#else
@Inject(method = "renderEntities", @Inject(method = "renderEntities",
at = @At(value = "INVOKE", at = @At(value = "INVOKE",
//#if MC>=10904 //#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", //$$ target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z",
//#endif //#endif
shift = At.Shift.AFTER)) shift = At.Shift.AFTER))
private void postEntityRender( //#endif
//#if MC>=11400 private void postEntityRender(CallbackInfo ci) {
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
BlendState blendState = BlendState.getState(); BlendState blendState = BlendState.getState();
if (blendState != null) { if (blendState != null) {
blendState.get(EntityExporter.class).postEntitiesRender(); blendState.get(EntityExporter.class).postEntitiesRender();
} }
} }
//#if MC>=11500
//$$ // FIXME
//#else
@Inject(method = "renderEntities", at = @At( @Inject(method = "renderEntities", at = @At(
value = "INVOKE", value = "INVOKE",
//#if MC>=11400 //#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" //$$ target = "Lnet/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher;renderTileEntity(Lnet/minecraft/tileentity/TileEntity;FI)V"
//#endif //#endif
)) ))
private void preTileEntityRender( private void preTileEntityRender(CallbackInfo ci) {
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
BlendState blendState = BlendState.getState(); BlendState blendState = BlendState.getState();
if (blendState != null) { if (blendState != null) {
blendState.get(TileEntityExporter.class).preTileEntitiesRender(); blendState.get(TileEntityExporter.class).preTileEntitiesRender();
@@ -102,17 +100,12 @@ public abstract class MixinRenderGlobal {
//#endif //#endif
shift = At.Shift.AFTER shift = At.Shift.AFTER
)) ))
private void postTileEntityRender( private void postTileEntityRender(CallbackInfo ci) {
//#if MC>=11400
Camera view,
//#else
//$$ Entity view,
//#endif
VisibleRegion camera, float renderPartialTicks, CallbackInfo ci) {
BlendState blendState = BlendState.getState(); BlendState blendState = BlendState.getState();
if (blendState != null) { if (blendState != null) {
blendState.get(TileEntityExporter.class).postTileEntitiesRender(); blendState.get(TileEntityExporter.class).postTileEntitiesRender();
} }
} }
//#endif
} }
//#endif //#endif

View File

@@ -2,13 +2,18 @@
package com.replaymod.replay.mixin; package com.replaymod.replay.mixin;
import com.replaymod.replay.ReplayModReplay; import com.replaymod.replay.ReplayModReplay;
import net.minecraft.client.render.VisibleRegion;
import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.ArrowEntityRenderer; import net.minecraft.client.render.entity.ArrowEntityRenderer;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin; 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) @Mixin(ArrowEntityRenderer.class)
public abstract class MixinRenderArrow extends EntityRenderer { public abstract class MixinRenderArrow extends EntityRenderer {
protected MixinRenderArrow(EntityRenderDispatcher renderManager) { protected MixinRenderArrow(EntityRenderDispatcher renderManager) {
@@ -17,7 +22,13 @@ public abstract class MixinRenderArrow extends EntityRenderer {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @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 // 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); return ReplayModReplay.instance.getReplayHandler() != null || super.isVisible(entity, camera, camX, camY, camZ);
} }

View File

@@ -1,6 +1,5 @@
net.fabricmc.fabric.impl.resource.loader.ModResourcePackUtil net.fabricmc.fabric.impl.resources.ModResourcePackUtil net.fabricmc.fabric.impl.resource.loader.ModResourcePackUtil net.fabricmc.fabric.impl.resources.ModResourcePackUtil
net.minecraft.client.render.entity.EntityRenderer shouldRender() isVisible() net.minecraft.client.render.entity.EntityRenderer shouldRender() isVisible()
net.minecraft.client.render.Frustum net.minecraft.client.render.VisibleRegion
net.minecraft.client.render.GameRenderer renderWorld() renderCenter() net.minecraft.client.render.GameRenderer renderWorld() renderCenter()
net.minecraft.entity.LivingEntity serverX field_6224 net.minecraft.entity.LivingEntity serverX field_6224
net.minecraft.entity.LivingEntity serverY field_6245 net.minecraft.entity.LivingEntity serverY field_6245
@@ -11,3 +10,4 @@ net.minecraft.client.render.WorldRenderer drawBlockOutline() drawHighlightedBloc
net.minecraft.client.render.GameRenderer method_22973() applyCameraTransformations() net.minecraft.client.render.GameRenderer method_22973() applyCameraTransformations()
net.minecraft.client.util.math.Matrix4f viewboxMatrix() method_4929() net.minecraft.client.util.math.Matrix4f viewboxMatrix() method_4929()
net.minecraft.client.util.ScreenshotUtils takeScreenshot() method_1663() net.minecraft.client.util.ScreenshotUtils takeScreenshot() method_1663()
net.minecraft.client.render.WorldRenderer setupTerrain() setUpTerrain()