Port to MC 1.18-pre1
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user