Port to MC 1.18-pre1
This commit is contained in:
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
11
build.gradle
11
build.gradle
@@ -243,6 +243,7 @@ dependencies {
|
||||
11604: '1.16.4',
|
||||
11700: '1.17',
|
||||
11701: '1.17.1',
|
||||
11800: '1.18-pre1',
|
||||
][mcVersion]
|
||||
mappings 'net.fabricmc:yarn:' + [
|
||||
11404: '1.14.4+build.16',
|
||||
@@ -252,8 +253,9 @@ 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',
|
||||
][mcVersion]
|
||||
modImplementation 'net.fabricmc:fabric-loader:0.11.6'
|
||||
modImplementation 'net.fabricmc:fabric-loader:0.12.5'
|
||||
def fabricApiVersion = [
|
||||
11404: '0.4.3+build.247-1.14',
|
||||
11502: '0.5.1+build.294-1.15',
|
||||
@@ -262,6 +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',
|
||||
][mcVersion]
|
||||
def fabricApiModules = [
|
||||
"api-base",
|
||||
@@ -332,7 +335,7 @@ dependencies {
|
||||
|
||||
shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8'
|
||||
|
||||
shadow "com.github.ReplayMod:ReplayStudio:c9de2f5", shadeExclusions
|
||||
shadow "com.github.ReplayMod:ReplayStudio:a5a92b6", 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
|
||||
@@ -340,7 +343,9 @@ dependencies {
|
||||
shadow 'com.github.ReplayMod:lwjgl-utils:27dcd66'
|
||||
|
||||
if (FABRIC) {
|
||||
if (mcVersion >= 11700) {
|
||||
if (mcVersion >= 11800) {
|
||||
modImplementation 'com.terraformersmc:modmenu:3.0.0'
|
||||
} else if (mcVersion >= 11700) {
|
||||
modImplementation 'com.terraformersmc:modmenu:2.0.0-beta.7'
|
||||
} else if (mcVersion >= 11602) {
|
||||
modImplementation 'com.terraformersmc:modmenu:1.16.8'
|
||||
|
||||
2
jGui
2
jGui
Submodule jGui updated: 8b28d1ce0c...de380210d7
@@ -189,6 +189,7 @@ val doRelease by tasks.registering {
|
||||
defaultTasks("bundleJar")
|
||||
|
||||
preprocess {
|
||||
val mc11800 = createNode("1.18", 11800, "yarn")
|
||||
val mc11701 = createNode("1.17.1", 11701, "yarn")
|
||||
val mc11700 = createNode("1.17", 11700, "yarn")
|
||||
val mc11604 = createNode("1.16.4", 11604, "yarn")
|
||||
@@ -207,6 +208,7 @@ preprocess {
|
||||
val mc10800 = createNode("1.8", 10800, "srg")
|
||||
val mc10710 = createNode("1.7.10", 10710, "srg")
|
||||
|
||||
mc11800.link(mc11701, file("versions/mapping-fabric-1.18-1.17.1.txt"))
|
||||
mc11701.link(mc11700)
|
||||
mc11700.link(mc11604, file("versions/mapping-fabric-1.17-1.16.4.txt"))
|
||||
mc11604.link(mc11601)
|
||||
|
||||
@@ -31,6 +31,7 @@ val jGuiVersions = listOf(
|
||||
"1.16.4",
|
||||
"1.17",
|
||||
"1.17.1",
|
||||
"1.18",
|
||||
)
|
||||
val replayModVersions = listOf(
|
||||
// "1.7.10",
|
||||
@@ -50,6 +51,7 @@ val replayModVersions = listOf(
|
||||
"1.16.4",
|
||||
"1.17",
|
||||
"1.17.1",
|
||||
"1.18",
|
||||
)
|
||||
|
||||
rootProject.buildFileName = "root.gradle.kts"
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
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.gradle.remap.Pattern;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
@@ -23,6 +26,12 @@ import net.minecraft.world.chunk.WorldChunk;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11600
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
//#else
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.util.Window;
|
||||
@@ -509,4 +518,26 @@ class Patterns {
|
||||
GL11.glRotatef(angle, x, y, z);
|
||||
//#endif
|
||||
}
|
||||
|
||||
// FIXME preprocessor bug: there are mappings for this, not sure why it doesn't remap by itself
|
||||
//#if MC>=11600
|
||||
@Pattern
|
||||
private static Matrix4f getPositionMatrix(MatrixStack.Entry stack) {
|
||||
//#if MC>=11800
|
||||
//$$ return stack.getPositionMatrix();
|
||||
//#else
|
||||
return stack.getModel();
|
||||
//#endif
|
||||
}
|
||||
//#endif
|
||||
|
||||
@SuppressWarnings("rawtypes") // preprocessor bug: doesn't work with generics
|
||||
@Pattern
|
||||
private static void Futures_addCallback(ListenableFuture future, FutureCallback callback) {
|
||||
//#if MC>=11800
|
||||
//$$ Futures.addCallback(future, callback, Runnable::run);
|
||||
//#else
|
||||
Futures.addCallback(future, callback);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.replaystudio.PacketData;
|
||||
import com.replaymod.replaystudio.data.Marker;
|
||||
import com.replaymod.replaystudio.filter.DimensionTracker;
|
||||
import com.replaymod.replaystudio.filter.SquashFilter;
|
||||
import com.replaymod.replaystudio.filter.StreamFilter;
|
||||
import com.replaymod.replaystudio.io.ReplayInputStream;
|
||||
@@ -122,7 +123,8 @@ public class MarkerProcessor {
|
||||
int splitCounter = 0;
|
||||
|
||||
PacketTypeRegistry registry = MCVer.getPacketTypeRegistry(true);
|
||||
SquashFilter squashFilter = new SquashFilter();
|
||||
DimensionTracker dimensionTracker = new DimensionTracker();
|
||||
SquashFilter squashFilter = new SquashFilter(null, null);
|
||||
|
||||
List<Pair<Path, ReplayMetaData>> outputPaths = new ArrayList<>();
|
||||
|
||||
@@ -180,7 +182,7 @@ public class MarkerProcessor {
|
||||
cutFilter.release();
|
||||
}
|
||||
startCutOffset = nextMarker.getTime();
|
||||
cutFilter = new SquashFilter();
|
||||
cutFilter = new SquashFilter(dimensionTracker);
|
||||
} else if (MARKER_NAME_END_CUT.equals(nextMarker.getName())) {
|
||||
timeOffset += nextMarker.getTime() - startCutOffset;
|
||||
if (cutFilter != null) {
|
||||
@@ -208,6 +210,7 @@ public class MarkerProcessor {
|
||||
continue;
|
||||
}
|
||||
|
||||
dimensionTracker.onPacket(null, nextPacket);
|
||||
if (hasFurtherOutputs) {
|
||||
squashFilter.onPacket(null, nextPacket);
|
||||
}
|
||||
|
||||
@@ -183,12 +183,16 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String getTileEntityId(BlockEntity tileEntity) {
|
||||
//#if MC>=11800
|
||||
//$$ NbtCompound nbt = tileEntity.createNbt();
|
||||
//#else
|
||||
CompoundTag nbt = new CompoundTag();
|
||||
//#if MC>=11400
|
||||
tileEntity.toTag(nbt);
|
||||
//#else
|
||||
//$$ tileEntity.writeToNBT(nbt);
|
||||
//#endif
|
||||
//#endif
|
||||
return nbt.getString("id");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// 1.18+
|
||||
@@ -24,7 +24,20 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHook.IBlockOnChunkRebuilds {
|
||||
@Shadow @Final private Queue<BlockBufferBuilderStorage> threadBuffers;
|
||||
|
||||
//#if MC>=11800
|
||||
//$$ @org.spongepowered.asm.mixin.Unique
|
||||
//$$ private boolean upload() {
|
||||
//$$ boolean anything = false;
|
||||
//$$ Runnable runnable;
|
||||
//$$ while ((runnable = this.uploadQueue.poll()) != null) {
|
||||
//$$ runnable.run();
|
||||
//$$ anything = true;
|
||||
//$$ }
|
||||
//$$ return anything;
|
||||
//$$ }
|
||||
//#else
|
||||
@Shadow public abstract boolean upload();
|
||||
//#endif
|
||||
|
||||
@Shadow @Final private TaskExecutor<Runnable> mailbox;
|
||||
|
||||
|
||||
@@ -20,7 +20,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public abstract class Mixin_ChromaKeyColorSky {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
//#if MC>=11400 || 10710>=MC
|
||||
//#if MC>=11800
|
||||
//$$ @Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLjava/lang/Runnable;)V",
|
||||
//$$ at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", remap = false, shift = At.Shift.AFTER),
|
||||
//$$ cancellable = true)
|
||||
//#elseif MC>=11400 || 10710>=MC
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
//#else
|
||||
//$$ @Inject(method = "renderSky(FI)V", at = @At("HEAD"), cancellable = true)
|
||||
|
||||
@@ -604,14 +604,19 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#if MC>=11400
|
||||
p = new GameJoinS2CPacket(
|
||||
entId,
|
||||
//#if MC>=11800
|
||||
//$$ packet.hardcore(),
|
||||
//#endif
|
||||
GameMode.SPECTATOR,
|
||||
//#if MC>=11600
|
||||
GameMode.SPECTATOR,
|
||||
//#endif
|
||||
//#if MC<11800
|
||||
//#if MC>=11500
|
||||
packet.getSha256Seed(),
|
||||
//#endif
|
||||
false,
|
||||
//#endif
|
||||
//#if MC>=11600
|
||||
//#if MC>=11603
|
||||
packet.getDimensionIds(),
|
||||
@@ -626,11 +631,17 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//#else
|
||||
//$$ packet.getDimension(),
|
||||
//#endif
|
||||
//#if MC>=11800
|
||||
//$$ packet.sha256Seed(),
|
||||
//#endif
|
||||
0, // max players (has no getter -> never actually used)
|
||||
//#if MC<11600
|
||||
//$$ packet.getGeneratorType(),
|
||||
//#endif
|
||||
packet.getViewDistance(),
|
||||
//#if MC>=11800
|
||||
//$$ packet.simulationDistance(),
|
||||
//#endif
|
||||
packet.hasReducedDebugInfo()
|
||||
//#if MC>=11500
|
||||
, packet.showsDeathScreen()
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"mixins": [],
|
||||
"server": [],
|
||||
"client": [
|
||||
//#if MC>=11800
|
||||
//$$ "ChunkInfoAccessor",
|
||||
//#endif
|
||||
"Mixin_ChromaKeyColorSky",
|
||||
"Mixin_ChromaKeyDisableFog",
|
||||
"Mixin_ChromaKeyForceSky",
|
||||
|
||||
0
versions/1.18/.gitkeep
Normal file
0
versions/1.18/.gitkeep
Normal file
@@ -0,0 +1,12 @@
|
||||
// 1.18+
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import net.minecraft.client.render.chunk.ChunkBuilder;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.render.WorldRenderer$ChunkInfo")
|
||||
public interface ChunkInfoAccessor {
|
||||
@Accessor
|
||||
ChunkBuilder.BuiltChunk getChunk();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import com.replaymod.render.hooks.ForceChunkLoadingHook;
|
||||
import com.replaymod.render.hooks.IForceChunkLoading;
|
||||
import com.replaymod.render.utils.FlawlessFrames;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.Frustum;
|
||||
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.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
@Mixin(WorldRenderer.class)
|
||||
public abstract class Mixin_ForceChunkLoading implements IForceChunkLoading {
|
||||
private ForceChunkLoadingHook replayModRender_hook;
|
||||
|
||||
@Override
|
||||
public void replayModRender_setHook(ForceChunkLoadingHook hook) {
|
||||
this.replayModRender_hook = hook;
|
||||
}
|
||||
|
||||
@Shadow private ChunkBuilder chunkBuilder;
|
||||
|
||||
@Shadow protected abstract void setupTerrain(Camera par1, Frustum par2, boolean par3, boolean par4);
|
||||
|
||||
@Shadow private Frustum frustum;
|
||||
|
||||
@Shadow private Frustum capturedFrustum;
|
||||
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Shadow @Final private ObjectArrayList<ChunkInfoAccessor> field_34807;
|
||||
|
||||
@Shadow private boolean field_34810;
|
||||
|
||||
@Shadow @Final private BlockingQueue<ChunkBuilder.BuiltChunk> field_34816;
|
||||
|
||||
@Shadow private Future<?> field_34808;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V"))
|
||||
private void forceAllChunks(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci) {
|
||||
if (replayModRender_hook == null) {
|
||||
return;
|
||||
}
|
||||
if (FlawlessFrames.hasSodium()) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert this.client.player != null;
|
||||
|
||||
do {
|
||||
// Determine which chunks shall be visible
|
||||
setupTerrain(camera, this.frustum, this.capturedFrustum != null, this.client.player.isSpectator());
|
||||
|
||||
// Wait for async processing to be complete
|
||||
if (this.field_34808 != null) {
|
||||
try {
|
||||
this.field_34808.get(5, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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.cancelRebuild();
|
||||
}
|
||||
|
||||
// Upload all chunks
|
||||
this.field_34810 |= ((ForceChunkLoadingHook.IBlockOnChunkRebuilds) this.chunkBuilder).uploadEverythingBlocking();
|
||||
|
||||
// Repeat until no more updates are needed
|
||||
} while (this.field_34810 || !this.field_34816.isEmpty());
|
||||
}
|
||||
}
|
||||
16
versions/mapping-fabric-1.18-1.17.1.txt
Normal file
16
versions/mapping-fabric-1.18-1.17.1.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
net.minecraft.client.util.math.MatrixStack multiplyPositionMatrix() method_34425()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket playerEntityId() getEntityId()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket hardcore() isHardcore()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket gameMode() getGameMode()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket previousGameMode() getPreviousGameMode()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket dimensionIds() getDimensionIds()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket registryManager() getRegistryManager()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket dimensionType() getDimensionType()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket dimensionId() getDimensionId()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket sha256Seed() getSha256Seed()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket maxPlayers() getMaxPlayers()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket viewDistance() getViewDistance()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket reducedDebugInfo() hasReducedDebugInfo()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket showDeathScreen() showsDeathScreen()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket debugWorld() isDebugWorld()
|
||||
net.minecraft.network.packet.s2c.play.GameJoinS2CPacket flatWorld() isFlatWorld()
|
||||
Reference in New Issue
Block a user