Port to MC 1.18-rc4

This commit is contained in:
Jonas Herzig
2021-11-28 13:57:51 +01:00
parent b6f623efb8
commit ce5886a427
7 changed files with 46 additions and 14 deletions

View File

@@ -108,9 +108,9 @@ preprocess {
def mcVersionStr = "${(int)(mcVersion/10000)}.${(int)(mcVersion/100)%100}" + (mcVersion%100==0 ? '' : ".${mcVersion%100}")
sourceCompatibility = targetCompatibility = mcVersion >= 11700 ? 16 : 1.8
sourceCompatibility = targetCompatibility = mcVersion >= 11800 ? 17 : mcVersion >= 11700 ? 16 : 1.8
tasks.withType(JavaCompile).configureEach {
options.release = mcVersion >= 11700 ? 16 : 8
options.release = mcVersion >= 11800 ? 17 : mcVersion >= 11700 ? 16 : 8
}
if (mcVersion >= 11400) {
@@ -243,7 +243,7 @@ dependencies {
11604: '1.16.4',
11700: '1.17',
11701: '1.17.1',
11800: '1.18-pre1',
11800: '1.18-rc4',
][mcVersion]
mappings 'net.fabricmc:yarn:' + [
11404: '1.14.4+build.16',
@@ -253,7 +253,7 @@ dependencies {
11604: '1.16.4+build.6:v2',
11700: '1.17+build.13:v2',
11701: '1.17.1+build.29:v2',
11800: '1.18-pre1+build.5:v2',
11800: '1.18-rc4+build.1:v2',
][mcVersion]
modImplementation 'net.fabricmc:fabric-loader:0.12.5'
def fabricApiVersion = [
@@ -264,7 +264,7 @@ dependencies {
11604: '0.25.1+build.416-1.16',
11700: '0.36.0+1.17',
11701: '0.37.1+1.17',
11800: '0.42.2+1.18',
11800: '0.43.1+1.18',
][mcVersion]
def fabricApiModules = [
"api-base",
@@ -335,7 +335,7 @@ dependencies {
shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8'
shadow "com.github.ReplayMod:ReplayStudio:a5a92b6", shadeExclusions
shadow "com.github.ReplayMod:ReplayStudio:69b1296", shadeExclusions
implementation(FABRIC ? dependencies.project(path: jGui.path, configuration: "namedElements") : jGui) {
transitive = false // FG 1.2 puts all MC deps into the compile configuration and we don't want to shade those

2
jGui

Submodule jGui updated: de380210d7...37b1273be4

View File

@@ -10,6 +10,10 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.Queue;
//#if MC>=11800
//$$ import java.util.function.Supplier;
//#endif
//#if MC>=11400
import java.util.concurrent.CompletableFuture;
//#endif
@@ -49,7 +53,11 @@ public interface MinecraftAccessor {
//#endif
@Accessor("crashReport")
//#if MC>=11800
//$$ Supplier<CrashReport> getCrashReporter();
//#else
CrashReport getCrashReporter();
//#endif
//#if MC<11400
//$$ @Accessor

View File

@@ -3,6 +3,7 @@ package com.replaymod.core.versions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.replaymod.core.mixin.MinecraftAccessor;
import com.replaymod.gradle.remap.Pattern;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
@@ -13,6 +14,8 @@ import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.crash.CrashException;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.crash.CrashReportSection;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
@@ -542,4 +545,22 @@ class Patterns {
Futures.addCallback(future, callback);
//#endif
}
@Pattern
private static void setCrashReport(MinecraftClient mc, CrashReport report) {
//#if MC>=11800
//$$ mc.setCrashReportSupplier(() -> report);
//#else
mc.setCrashReport(report);
//#endif
}
@Pattern
private static CrashException crashReportToException(MinecraftClient mc) {
//#if MC>=11800
//$$ return new CrashException(((MinecraftAccessor) mc).getCrashReporter().get());
//#else
return new CrashException(((MinecraftAccessor) mc).getCrashReporter());
//#endif
}
}

View File

@@ -1,6 +1,5 @@
package com.replaymod.extras.playeroverview;
import com.google.common.base.Optional;
import com.replaymod.core.ReplayMod;
import com.replaymod.core.events.PreRenderHandCallback;
import com.replaymod.core.utils.Utils;
@@ -10,6 +9,7 @@ import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.camera.CameraEntity;
import com.replaymod.replay.events.ReplayClosedCallback;
import com.replaymod.replay.events.ReplayOpenedCallback;
import com.replaymod.replaystudio.lib.guava.base.Optional;
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;

View File

@@ -1,12 +1,12 @@
package com.replaymod.render.utils;
import com.google.common.base.Optional;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.replaymod.render.RenderSettings;
import com.replaymod.replaystudio.lib.guava.base.Optional;
import com.replaymod.replaystudio.pathing.PathingRegistry;
import com.replaymod.replaystudio.pathing.path.Timeline;
import com.replaymod.replaystudio.pathing.serialize.TimelineSerialization;

View File

@@ -11,6 +11,7 @@ import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.chunk.ChunkBuilder;
import net.minecraft.client.render.chunk.ChunkRendererRegionBuilder;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Matrix4f;
import org.spongepowered.asm.mixin.Final;
@@ -45,11 +46,11 @@ public abstract class Mixin_ForceChunkLoading implements IForceChunkLoading {
@Shadow @Final private MinecraftClient client;
@Shadow @Final private ObjectArrayList<ChunkInfoAccessor> field_34807;
@Shadow @Final private ObjectArrayList<ChunkInfoAccessor> chunkInfos;
@Shadow private boolean field_34810;
@Shadow @Final private BlockingQueue<ChunkBuilder.BuiltChunk> field_34816;
@Shadow @Final private BlockingQueue<ChunkBuilder.BuiltChunk> builtChunks;
@Shadow private Future<?> field_34808;
@@ -64,6 +65,8 @@ public abstract class Mixin_ForceChunkLoading implements IForceChunkLoading {
assert this.client.player != null;
ChunkRendererRegionBuilder chunkRendererRegionBuilder = new ChunkRendererRegionBuilder();
do {
// Determine which chunks shall be visible
setupTerrain(camera, this.frustum, this.capturedFrustum != null, this.client.player.isSpectator());
@@ -84,14 +87,14 @@ public abstract class Mixin_ForceChunkLoading implements IForceChunkLoading {
// Schedule all chunks which need rebuilding (we schedule even important rebuilds because we wait for
// all of them anyway and this way we can take advantage of threading)
for (ChunkInfoAccessor chunkInfo : this.field_34807) {
for (ChunkInfoAccessor chunkInfo : this.chunkInfos) {
ChunkBuilder.BuiltChunk builtChunk = chunkInfo.getChunk();
if (!builtChunk.needsRebuild()) {
continue;
}
// MC sometimes schedules invalid chunks when you're outside of loaded chunks (e.g. y > 256)
if (builtChunk.shouldBuild()) {
builtChunk.scheduleRebuild(this.chunkBuilder);
builtChunk.scheduleRebuild(this.chunkBuilder, chunkRendererRegionBuilder);
}
builtChunk.cancelRebuild();
}
@@ -100,6 +103,6 @@ public abstract class Mixin_ForceChunkLoading implements IForceChunkLoading {
this.field_34810 |= ((ForceChunkLoadingHook.IBlockOnChunkRebuilds) this.chunkBuilder).uploadEverythingBlocking();
// Repeat until no more updates are needed
} while (this.field_34810 || !this.field_34816.isEmpty());
} while (this.field_34810 || !this.builtChunks.isEmpty());
}
}