Update preprocessor and replace 1.13.2 subproject with 1.14.4-forge
The new preprocessor version brings first-party support for fabric, in particular for automatically fetching mappings loom and for automatically remapping between MC versions via intermediary mappings. This will come in handy when updating to 1.15. It also supports automatic remapping between fabric and forge on the same MC version (by going mcp<->srg<->mojang<->intermediary<->yarn). Therefore this commit replaces the previous 1.13.2 (forge) subproject with a 1.14.4-forge one. Instead of manually providing full mappings for 1.14.4-fabric to 1.13.2-forge and partial (classes) for 1.13.2-forge to 1.12.2-forge, we now only need partial (classes) for 1.12.2-forge to 1.14.4-forge and preprocessor will take care of the forge to fabric step (in fact, our mapping file for that is currently completely empty). In an attempt to write an IDE (IntelliJ) plugin for quicker and easier working with the preprocessor (e.g. immediately mapping single files from within the IDE, jumping between different versions for the same file), the preprocessor gradle plugin declaration now requires you to explicitly specify variables in the common.gradle and the overall relationship between projects in the build.gradle (latter is required anyway, so the plugin can know where it should map between forge and fabric and which subprojects are which versions). Since that necessitated some changes to the build.gradle file, I took the opportunity to convert it to Kotlin. As such we now also use Gradle's newer plugin-block with the pluginManagement-block instead of manually declaring buildScript (not for the common.gradle though), which imo is nicer anyway and comes with various advantages (see gradle docs). There were also some remapping bugs fixed and some new ones introduced (e.g. manually declared inner class mappings seem to no longer function properly under certain conditions). There's also support for remapping Kotlin now. Just saying.
This commit is contained in:
@@ -15,7 +15,7 @@ import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
@@ -67,7 +67,7 @@ public class ReplayModRecording implements Module {
|
||||
|
||||
new GuiHandler(core).register();
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
ClientSidePacketRegistry.INSTANCE.register(Restrictions.PLUGIN_CHANNEL, (packetContext, packetByteBuf) -> {});
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
|
||||
@@ -15,7 +15,7 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
@@ -70,7 +70,7 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
updateState();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, (screen, buttons) -> {
|
||||
if (screen instanceof GameMenuScreen) {
|
||||
show((GameMenuScreen) screen);
|
||||
@@ -79,8 +79,8 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ if (getGui(event) instanceof GuiIngameMenu) {
|
||||
//$$ show((GuiIngameMenu) getGui(event));
|
||||
//$$ if (getGui(event) instanceof IngameMenuScreen) {
|
||||
//$$ show((IngameMenuScreen) getGui(event));
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderHudCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
@@ -40,7 +40,7 @@ public class GuiRecordingOverlay extends EventRegistrations {
|
||||
/**
|
||||
* Render the recording icon and text in the top left corner of the screen.
|
||||
*/
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PostRenderHudCallback.EVENT, partialTicks -> renderRecordingIndicator()); }
|
||||
private void renderRecordingIndicator() {
|
||||
//#else
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
//$$ public class FMLHandshakeFilter extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
|
||||
//$$ @Override
|
||||
//$$ protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception {
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.RegistryData)) {
|
||||
//#if MC>=10800
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.RegistryData)) {
|
||||
//#else
|
||||
//$$ if (!(msg instanceof FMLHandshakeMessage.ModIdData)) {
|
||||
//#endif
|
||||
//$$ // Pass on everything but RegistryData messages
|
||||
//$$ ctx.fireChannelRead(msg);
|
||||
//$$ }
|
||||
|
||||
@@ -11,7 +11,7 @@ import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
//#else
|
||||
@@ -30,13 +30,13 @@ public class GuiHandler extends EventRegistrations {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, (screen, buttons) -> onGuiInit(screen)); }
|
||||
private void onGuiInit(Screen gui) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ net.minecraft.client.gui.GuiScreen gui = getGui(event);
|
||||
//$$ net.minecraft.client.gui.screen.Screen gui = getGui(event);
|
||||
//#endif
|
||||
if (gui instanceof SelectWorldScreen || gui instanceof MultiplayerScreen) {
|
||||
boolean sp = gui instanceof SelectWorldScreen;
|
||||
|
||||
@@ -5,25 +5,42 @@ import com.replaymod.recording.packet.PacketListener;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.network.packet.BlockBreakingProgressS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityAnimationS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityAttachS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityEquipmentUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityPositionS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntitySetHeadYawS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityVelocityUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerSpawnS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.client.network.packet.*;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
// FIXME not (yet?) 1.13 import net.minecraftforge.event.entity.minecart.MinecartInteractEvent;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.SCollectItemPacket;
|
||||
//$$ import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import net.minecraftforge.event.entity.player.PlayerEvent.ItemPickupEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.SPacketUseBed;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10904
|
||||
import com.replaymod.recording.mixin.EntityLivingBaseAccessor;
|
||||
import net.minecraft.client.network.packet.EntityTrackerUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlaySoundS2CPacket;
|
||||
import net.minecraft.client.network.packet.WorldEventS2CPacket;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.data.DataTracker;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -120,7 +137,7 @@ public class RecordingEventHandler extends EventRegistrations {
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreTickCallback.EVENT, this::onPlayerTick); }
|
||||
private void onPlayerTick() {
|
||||
if (mc.player == null) return;
|
||||
@@ -178,7 +195,11 @@ public class RecordingEventHandler extends EventRegistrations {
|
||||
byte newYaw = (byte) ((int) (player.yaw * 256.0F / 360.0F));
|
||||
byte newPitch = (byte) ((int) (player.pitch * 256.0F / 360.0F));
|
||||
|
||||
//#if MC>=11400
|
||||
packet = new EntityS2CPacket.RotateAndMoveRelative(
|
||||
//#else
|
||||
//$$ packet = new SPacketEntity.S17PacketEntityLookMove(
|
||||
//#endif
|
||||
player.getEntityId(),
|
||||
//#if MC>=10904
|
||||
(short) Math.round(dx * 4096), (short) Math.round(dy * 4096), (short) Math.round(dz * 4096),
|
||||
@@ -346,7 +367,7 @@ public class RecordingEventHandler extends EventRegistrations {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
// FIXME fabric
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
@@ -356,7 +377,7 @@ public class RecordingEventHandler extends EventRegistrations {
|
||||
//#if MC>=11200
|
||||
//#if MC>=11300
|
||||
//$$ ItemStack stack = event.getStack();
|
||||
//$$ packetListener.save(new SPacketCollectItem(
|
||||
//$$ packetListener.save(new SCollectItemPacket(
|
||||
//$$ event.getOriginalEntity().getEntityId(),
|
||||
//$$ event.getPlayer().getEntityId(),
|
||||
//$$ event.getStack().getCount()
|
||||
@@ -456,7 +477,7 @@ public class RecordingEventHandler extends EventRegistrations {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreRenderCallback.EVENT, this::checkForGamePaused); }
|
||||
private void checkForGamePaused() {
|
||||
//#else
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.recording.handler.RecordingEventHandler;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.packet.*;
|
||||
import net.minecraft.client.network.packet.PlayerRespawnS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -24,6 +24,8 @@ import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.S01PacketJoinGame;
|
||||
//#endif
|
||||
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
@@ -49,7 +51,11 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
* @param ci Callback info
|
||||
*/
|
||||
//#if MC>=10800
|
||||
//#if FABRIC>=1
|
||||
@Inject(method = "onPlayerList", at=@At("HEAD"))
|
||||
//#else
|
||||
//$$ @Inject(method = "handlePlayerListItem", at=@At("HEAD"))
|
||||
//#endif
|
||||
public void recordOwnJoin(PlayerListS2CPacket packet, CallbackInfo ci) {
|
||||
if (mcStatic.player == null) return;
|
||||
|
||||
@@ -101,7 +107,11 @@ public abstract class MixinNetHandlerPlayClient {
|
||||
* @param packet The packet
|
||||
* @param ci Callback info
|
||||
*/
|
||||
//#if FABRIC>=1
|
||||
@Inject(method = "onPlayerRespawn", at=@At("RETURN"))
|
||||
//#else
|
||||
//$$ @Inject(method = "handleRespawn", at=@At("RETURN"))
|
||||
//#endif
|
||||
public void recordOwnRespawn(PlayerRespawnS2CPacket packet, CallbackInfo ci) {
|
||||
RecordingEventHandler handler = getRecordingEventHandler();
|
||||
if (handler != null) {
|
||||
|
||||
@@ -71,9 +71,14 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
||||
// other clients so we have to record them manually.
|
||||
// E.g. Block place sounds
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
@Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FF)V",
|
||||
at = @At("HEAD"))
|
||||
//#else
|
||||
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/util/SoundEvent;Lnet/minecraft/util/SoundCategory;FF)V",
|
||||
//$$ at = @At("HEAD"))
|
||||
//#endif
|
||||
//#else
|
||||
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/EntityPlayer;DDDLnet/minecraft/util/SoundEvent;Lnet/minecraft/util/SoundCategory;FF)V",
|
||||
//$$ at = @At("HEAD"))
|
||||
//#endif
|
||||
|
||||
@@ -23,12 +23,16 @@ import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.client.network.packet.DisconnectS2CPacket;
|
||||
import net.minecraft.client.network.packet.ItemPickupAnimationS2CPacket;
|
||||
import net.minecraft.client.network.packet.MobSpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerSpawnS2CPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.data.DataTracker;
|
||||
import net.minecraft.network.NetworkState;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
import net.minecraft.client.network.packet.*;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,7 +50,11 @@ import net.minecraft.client.network.packet.LoginSuccessS2CPacket;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC<10904
|
||||
//$$ import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
|
||||
//#endif
|
||||
import net.minecraft.client.network.packet.LoginCompressionS2CPacket;
|
||||
import net.minecraft.client.network.packet.ResourcePackSendS2CPacket;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class ResourcePackRecorder {
|
||||
//$$ //noinspection Convert2Lambda
|
||||
//$$ mc.addScheduledTask(() -> mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {
|
||||
//$$ @Override
|
||||
//$$ public void confirmResult(boolean result, int id) {
|
||||
//$$ public void confirmClicked(boolean result, int id) {
|
||||
//#endif
|
||||
if (serverData != null) {
|
||||
serverData.setResourcePackState(result ? ServerEntry.ResourcePackState.ENABLED : ServerEntry.ResourcePackState.DISABLED);
|
||||
|
||||
Reference in New Issue
Block a user