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:
@@ -5,8 +5,8 @@
|
||||
//$$ import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
//$$ import net.minecraft.client.Minecraft;
|
||||
//$$ import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
//$$ import net.minecraftforge.eventbus.api.EventPriority;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//$$
|
||||
//$$ import static com.replaymod.core.versions.MCVer.*;
|
||||
//$$
|
||||
@@ -17,7 +17,7 @@
|
||||
//$$ * To fix this issue, we simply cancel the RenderLivingEvent.Pre before it gets to ArmorAnimation if the entity is invisible.
|
||||
//$$ */
|
||||
//$$ public class HideInvisibleEntities extends EventRegistrations {
|
||||
//$$ private final Minecraft mc = Minecraft.getInstance();
|
||||
//$$ private final Minecraft mc = Minecraft.getMinecraft();
|
||||
//$$ private final boolean modLoaded = isModLoaded("animations");
|
||||
//$$
|
||||
//$$ @SubscribeEvent(priority = EventPriority.HIGH)
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.getRenderPartialTicks;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//#endif
|
||||
|
||||
public class ShaderBeginRender extends EventRegistrations {
|
||||
@@ -25,7 +25,7 @@ public class ShaderBeginRender extends EventRegistrations {
|
||||
* as this would usually get called by EntityRenderer#renderWorld,
|
||||
* which we're not calling during rendering.
|
||||
*/
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreRenderCallback.EVENT, this::onRenderTickStart); }
|
||||
private void onRenderTickStart() {
|
||||
//#else
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.util.crash.CrashReport;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.versions.LangResourcePack;
|
||||
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
@@ -38,7 +38,7 @@ import java.util.Map;
|
||||
|
||||
public class KeyBindingRegistry extends EventRegistrations {
|
||||
private static final String CATEGORY = "replaymod.title";
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
static { net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry.INSTANCE.addCategory(CATEGORY); }
|
||||
//#endif
|
||||
|
||||
@@ -58,7 +58,7 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
private KeyBinding registerKeyBinding(String name, int keyCode) {
|
||||
KeyBinding keyBinding = keyBindings.get(name);
|
||||
if (keyBinding == null) {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
if (keyCode == 0) {
|
||||
keyCode = -1;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.resource.DirectoryResourcePack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.LiteralText;
|
||||
@@ -30,17 +31,18 @@ import org.apache.commons.io.FileUtils;
|
||||
|
||||
//#if MC>=11400
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.options.Option;
|
||||
import net.minecraft.resource.DirectoryResourcePack;
|
||||
import net.minecraft.resource.ResourcePackCreator;
|
||||
import net.minecraft.resource.ResourcePackContainer;
|
||||
import net.minecraft.util.NonBlockingThreadExecutor;
|
||||
//#endif
|
||||
|
||||
//#if FABRIC>=1
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
//#else
|
||||
//$$ import com.google.common.util.concurrent.ListenableFutureTask;
|
||||
//$$ import net.minecraft.resources.FolderPack;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import java.util.Queue;
|
||||
//$$ import java.util.concurrent.FutureTask;
|
||||
@@ -80,8 +82,10 @@ import net.minecraft.util.NonBlockingThreadExecutor;
|
||||
//#endif
|
||||
//#endif
|
||||
//$$ import net.minecraftforge.fml.common.Mod;
|
||||
//#if MC<11400
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
@@ -97,7 +101,7 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
//#if MC<11400
|
||||
//#if FABRIC<=0
|
||||
//#if MC>=11300
|
||||
//$$ @Mod(ReplayMod.MOD_ID)
|
||||
//#else
|
||||
@@ -114,7 +118,7 @@ import static com.replaymod.core.versions.MCVer.*;
|
||||
//#endif
|
||||
//#endif
|
||||
public class ReplayMod implements
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
ClientModInitializer,
|
||||
//#endif
|
||||
Module
|
||||
@@ -299,7 +303,7 @@ public class ReplayMod implements
|
||||
//#endif
|
||||
}}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
modules.forEach(Module::initCommon);
|
||||
@@ -470,10 +474,12 @@ public class ReplayMod implements
|
||||
return mcThread;
|
||||
}
|
||||
|
||||
//#if FABRIC>=1
|
||||
@Override
|
||||
public void send(Runnable runnable) {
|
||||
method_18858(runnable);
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public void executeTaskQueue() {
|
||||
@@ -573,7 +579,7 @@ public class ReplayMod implements
|
||||
//#endif
|
||||
|
||||
public String getVersion() {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
return FabricLoader.getInstance().getModContainer(MOD_ID)
|
||||
.orElseThrow(IllegalStateException::new)
|
||||
.getMetadata().getVersion().toString();
|
||||
|
||||
@@ -13,7 +13,7 @@ import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
//#else
|
||||
@@ -28,13 +28,13 @@ import static com.replaymod.core.versions.MCVer.getMinecraft;
|
||||
public class GuiBackgroundProcesses extends EventRegistrations {
|
||||
private GuiPanel panel = new GuiPanel().setLayout(new VerticalLayout().setSpacing(10));
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, (screen, buttons) -> onGuiInit(screen)); }
|
||||
private void onGuiInit(Screen guiScreen) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ net.minecraft.client.gui.GuiScreen guiScreen = getGui(event);
|
||||
//$$ net.minecraft.client.gui.screen.Screen guiScreen = getGui(event);
|
||||
//#endif
|
||||
if (guiScreen != getMinecraft().currentScreen) return; // people tend to construct GuiScreens without opening them
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
package com.replaymod.core.gui;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
|
||||
@@ -12,29 +12,33 @@ import java.util.List;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
//$$ import net.minecraftforge.common.MinecraftForge;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.gui.GuiButton;
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
//$$ import net.minecraftforge.common.MinecraftForge;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#endif
|
||||
|
||||
/**
|
||||
* Moves certain buttons on the main menu upwards so we can inject our own.
|
||||
*/
|
||||
public class MainMenuHandler extends EventRegistrations {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::onInit); }
|
||||
public void onInit(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ GuiScreen guiScreen = getGui(event);
|
||||
//$$ List<GuiButton> buttonList = getButtonList(event);
|
||||
//$$ Screen guiScreen = getGui(event);
|
||||
//$$ List<Widget> buttonList = getButtonList(event);
|
||||
//#endif
|
||||
if (guiScreen instanceof TitleScreen) {
|
||||
TitleScreen gui = (TitleScreen) guiScreen;
|
||||
|
||||
@@ -18,10 +18,11 @@ import net.minecraft.client.gui.Element;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public interface GuiScreenAccessor {
|
||||
@Accessor
|
||||
//#if MC>=11400
|
||||
@Accessor
|
||||
List<AbstractButtonWidget> getButtons();
|
||||
//#else
|
||||
//$$ @Accessor("buttonList")
|
||||
//$$ List<GuiButton> getButtons();
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
package com.replaymod.core.mixin;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.replaymod.core.utils;
|
||||
import com.replaymod.replaystudio.data.ModInfo;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -32,7 +32,7 @@ public class ModCompat {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Collection<ModInfo> getInstalledNetworkMods() {
|
||||
//#if MC>=11300
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
Map<String, ModInfo> modInfoMap = FabricLoader.getInstance().getAllMods().stream()
|
||||
.map(ModContainer::getMetadata)
|
||||
.map(m -> new ModInfo(m.getId(), m.getName(), m.getVersion().toString()))
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.replaymod.core.versions;
|
||||
import com.replaymod.core.mixin.GuiScreenAccessor;
|
||||
import com.replaymod.core.mixin.MinecraftAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
@@ -24,14 +23,21 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
//#if MC>=11400
|
||||
import com.replaymod.core.mixin.AbstractButtonWidgetAccessor;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
//#else
|
||||
//$$ import com.google.common.util.concurrent.FutureCallback;
|
||||
//$$ import com.google.common.util.concurrent.Futures;
|
||||
//$$ import com.google.common.util.concurrent.ListenableFuture;
|
||||
//$$ import net.minecraft.entity.EntityLivingBase;
|
||||
//$$ import net.minecraft.client.gui.GuiButton;
|
||||
//#endif
|
||||
|
||||
//#if FABRIC>=1
|
||||
//#else
|
||||
//$$ import net.minecraft.entity.LivingEntity;
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
@@ -80,9 +86,8 @@ import net.minecraft.client.render.chunk.ChunkRenderTask;
|
||||
//$$ import static org.lwjgl.opengl.GL11.*;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.SharedConstants;
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
//$$ import net.minecraftforge.fml.ModList;
|
||||
@@ -104,7 +109,7 @@ import java.util.function.Consumer;
|
||||
public class MCVer {
|
||||
private static Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
//#if MC<11400
|
||||
//#if FABRIC<=0
|
||||
//$$ public static IEventBus FORGE_BUS = MinecraftForge.EVENT_BUS;
|
||||
//#if MC>=10809
|
||||
//$$ public static IEventBus FML_BUS = FORGE_BUS;
|
||||
@@ -114,7 +119,7 @@ public class MCVer {
|
||||
//#endif
|
||||
|
||||
public static boolean isModLoaded(String id) {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
return FabricLoader.getInstance().isModLoaded(id.toLowerCase());
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
@@ -171,7 +176,24 @@ public class MCVer {
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC<11400
|
||||
//#if FABRIC<=0
|
||||
//#if MC>=11400
|
||||
//$$ public static void addButton(GuiScreenEvent.InitGuiEvent event, Widget button) {
|
||||
//$$ event.addWidget(button);
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ public static void removeButton(GuiScreenEvent.InitGuiEvent event, Widget button) {
|
||||
//$$ event.removeWidget(button);
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ public static List<Widget> getButtonList(GuiScreenEvent.InitGuiEvent event) {
|
||||
//$$ return event.getWidgetList();
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ public static Widget getButton(GuiScreenEvent.ActionPerformedEvent event) {
|
||||
//$$ return event.getButton();
|
||||
//$$ }
|
||||
//#else
|
||||
//$$ public static void addButton(GuiScreenEvent.InitGuiEvent event, GuiButton button) {
|
||||
//#if MC>=11300
|
||||
//$$ event.addButton(button);
|
||||
@@ -204,8 +226,9 @@ public class MCVer {
|
||||
//$$ return event.button;
|
||||
//#endif
|
||||
//$$ }
|
||||
//#endif
|
||||
//$$
|
||||
//$$ public static GuiScreen getGui(GuiScreenEvent event) {
|
||||
//$$ public static Screen getGui(GuiScreenEvent event) {
|
||||
//#if MC>=10904
|
||||
//$$ return event.getGui();
|
||||
//#else
|
||||
@@ -213,7 +236,7 @@ public class MCVer {
|
||||
//#endif
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ public static EntityLivingBase getEntity(RenderLivingEvent event) {
|
||||
//$$ public static LivingEntity getEntity(RenderLivingEvent event) {
|
||||
//#if MC>=10904
|
||||
//$$ return event.getEntity();
|
||||
//#else
|
||||
@@ -234,7 +257,7 @@ public class MCVer {
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#if MC<11400
|
||||
//#if FABRIC<=0
|
||||
//$$ public static RenderGameOverlayEvent.ElementType getType(RenderGameOverlayEvent event) {
|
||||
//#if MC>=10904
|
||||
//$$ return event.getType();
|
||||
@@ -475,7 +498,14 @@ public class MCVer {
|
||||
return ((MinecraftAccessor) getMinecraft()).getTimer().tickDelta;
|
||||
}
|
||||
|
||||
public static void addButton(Screen screen, ButtonWidget button) {
|
||||
public static void addButton(
|
||||
Screen screen,
|
||||
//#if MC>=11400
|
||||
ButtonWidget button
|
||||
//#else
|
||||
//$$ GuiButton button
|
||||
//#endif
|
||||
) {
|
||||
GuiScreenAccessor acc = (GuiScreenAccessor) screen;
|
||||
//#if MC>=11400
|
||||
if (screen instanceof TitleScreen && isModLoaded("modmenu")) {
|
||||
@@ -635,9 +665,8 @@ public class MCVer {
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11300
|
||||
@SuppressWarnings("unused")
|
||||
public static abstract class Keyboard {
|
||||
//#if MC>=11300
|
||||
public static final int KEY_LCONTROL = GLFW.GLFW_KEY_LEFT_CONTROL;
|
||||
public static final int KEY_LSHIFT = GLFW.GLFW_KEY_LEFT_SHIFT;
|
||||
public static final int KEY_ESCAPE = GLFW.GLFW_KEY_ESCAPE;
|
||||
@@ -678,14 +707,69 @@ public class MCVer {
|
||||
public static final int KEY_X = GLFW.GLFW_KEY_X;
|
||||
public static final int KEY_Y = GLFW.GLFW_KEY_Y;
|
||||
public static final int KEY_Z = GLFW.GLFW_KEY_Z;
|
||||
//#else
|
||||
//$$ public static final int KEY_LCONTROL = org.lwjgl.input.Keyboard.KEY_LCONTROL;
|
||||
//$$ public static final int KEY_LSHIFT = org.lwjgl.input.Keyboard.KEY_LSHIFT;
|
||||
//$$ public static final int KEY_ESCAPE = org.lwjgl.input.Keyboard.KEY_ESCAPE;
|
||||
//$$ public static final int KEY_HOME = org.lwjgl.input.Keyboard.KEY_HOME;
|
||||
//$$ public static final int KEY_END = org.lwjgl.input.Keyboard.KEY_END;
|
||||
//$$ public static final int KEY_UP = org.lwjgl.input.Keyboard.KEY_UP;
|
||||
//$$ public static final int KEY_DOWN = org.lwjgl.input.Keyboard.KEY_DOWN;
|
||||
//$$ public static final int KEY_LEFT = org.lwjgl.input.Keyboard.KEY_LEFT;
|
||||
//$$ public static final int KEY_RIGHT = org.lwjgl.input.Keyboard.KEY_RIGHT;
|
||||
//$$ public static final int KEY_BACK = org.lwjgl.input.Keyboard.KEY_BACK;
|
||||
//$$ public static final int KEY_DELETE = org.lwjgl.input.Keyboard.KEY_DELETE;
|
||||
//$$ public static final int KEY_RETURN = org.lwjgl.input.Keyboard.KEY_RETURN;
|
||||
//$$ public static final int KEY_TAB = org.lwjgl.input.Keyboard.KEY_TAB;
|
||||
//$$ public static final int KEY_F1 = org.lwjgl.input.Keyboard.KEY_F1;
|
||||
//$$ public static final int KEY_A = org.lwjgl.input.Keyboard.KEY_A;
|
||||
//$$ public static final int KEY_B = org.lwjgl.input.Keyboard.KEY_B;
|
||||
//$$ public static final int KEY_C = org.lwjgl.input.Keyboard.KEY_C;
|
||||
//$$ public static final int KEY_D = org.lwjgl.input.Keyboard.KEY_D;
|
||||
//$$ public static final int KEY_E = org.lwjgl.input.Keyboard.KEY_E;
|
||||
//$$ public static final int KEY_F = org.lwjgl.input.Keyboard.KEY_F;
|
||||
//$$ public static final int KEY_G = org.lwjgl.input.Keyboard.KEY_G;
|
||||
//$$ public static final int KEY_H = org.lwjgl.input.Keyboard.KEY_H;
|
||||
//$$ public static final int KEY_I = org.lwjgl.input.Keyboard.KEY_I;
|
||||
//$$ public static final int KEY_J = org.lwjgl.input.Keyboard.KEY_J;
|
||||
//$$ public static final int KEY_K = org.lwjgl.input.Keyboard.KEY_K;
|
||||
//$$ public static final int KEY_L = org.lwjgl.input.Keyboard.KEY_L;
|
||||
//$$ public static final int KEY_M = org.lwjgl.input.Keyboard.KEY_M;
|
||||
//$$ public static final int KEY_N = org.lwjgl.input.Keyboard.KEY_N;
|
||||
//$$ public static final int KEY_O = org.lwjgl.input.Keyboard.KEY_O;
|
||||
//$$ public static final int KEY_P = org.lwjgl.input.Keyboard.KEY_P;
|
||||
//$$ public static final int KEY_Q = org.lwjgl.input.Keyboard.KEY_Q;
|
||||
//$$ public static final int KEY_R = org.lwjgl.input.Keyboard.KEY_R;
|
||||
//$$ public static final int KEY_S = org.lwjgl.input.Keyboard.KEY_S;
|
||||
//$$ public static final int KEY_T = org.lwjgl.input.Keyboard.KEY_T;
|
||||
//$$ public static final int KEY_U = org.lwjgl.input.Keyboard.KEY_U;
|
||||
//$$ public static final int KEY_V = org.lwjgl.input.Keyboard.KEY_V;
|
||||
//$$ public static final int KEY_W = org.lwjgl.input.Keyboard.KEY_W;
|
||||
//$$ public static final int KEY_X = org.lwjgl.input.Keyboard.KEY_X;
|
||||
//$$ public static final int KEY_Y = org.lwjgl.input.Keyboard.KEY_Y;
|
||||
//$$ public static final int KEY_Z = org.lwjgl.input.Keyboard.KEY_Z;
|
||||
//#endif
|
||||
|
||||
public static boolean isKeyDown(int keyCode) {
|
||||
//#if MC>=11400
|
||||
return InputUtil.isKeyPressed(getMinecraft().window.getHandle(), keyCode);
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
//$$ return InputMappings.isKeyDown(keyCode);
|
||||
//#else
|
||||
//$$ return org.lwjgl.input.Keyboard.isKeyDown(keyCode);
|
||||
//#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#if MC<11300
|
||||
//$$ public static int getEventKey() {
|
||||
//$$ return org.lwjgl.input.Keyboard.getEventKey();
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ public static boolean getEventKeyState() {
|
||||
//$$ return org.lwjgl.input.Keyboard.getEventKeyState();
|
||||
//$$ }
|
||||
//#endif
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
@@ -25,13 +25,13 @@ import java.io.IOException;
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
public class GuiHandler extends EventRegistrations {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoReplayViewer); }
|
||||
public void injectIntoReplayViewer(Screen vanillaGuiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoReplayViewer(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ net.minecraft.client.gui.GuiScreen vanillaGuiScreen = getGui(event);
|
||||
//$$ net.minecraft.client.gui.screen.Screen vanillaGuiScreen = getGui(event);
|
||||
//#endif
|
||||
AbstractGuiScreen guiScreen = GuiScreen.from(vanillaGuiScreen);
|
||||
if (!(guiScreen instanceof GuiReplayViewer)) {
|
||||
|
||||
@@ -12,12 +12,12 @@ import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import com.replaymod.core.events.PostRenderCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//#endif
|
||||
|
||||
public class FullBrightness extends EventRegistrations implements Extra {
|
||||
@@ -58,7 +58,7 @@ public class FullBrightness extends EventRegistrations implements Extra {
|
||||
register();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreRenderCallback.EVENT, this::preRender); }
|
||||
private void preRender() {
|
||||
//#else
|
||||
@@ -72,7 +72,7 @@ public class FullBrightness extends EventRegistrations implements Extra {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PostRenderCallback.EVENT, this::postRender); }
|
||||
private void postRender() {
|
||||
//#else
|
||||
|
||||
@@ -7,7 +7,7 @@ import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
//#else
|
||||
@@ -23,13 +23,13 @@ public class YoutubeUpload extends EventRegistrations implements Extra {
|
||||
register();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(OpenGuiScreenCallback.EVENT, this::onGuiOpen); }
|
||||
private void onGuiOpen(Screen vanillaGui) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onGuiOpen(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ net.minecraft.client.gui.GuiScreen vanillaGui = getGui(event);
|
||||
//$$ net.minecraft.client.gui.screen.Screen vanillaGui = getGui(event);
|
||||
//#endif
|
||||
if (GuiScreen.from(vanillaGui) instanceof GuiRenderingDone) {
|
||||
GuiRenderingDone gui = (GuiRenderingDone) GuiScreen.from(vanillaGui);
|
||||
|
||||
@@ -9,14 +9,13 @@ import com.replaymod.replay.gui.screen.GuiReplayViewer;
|
||||
import com.replaymod.replay.handler.GuiHandler.InjectedButton;
|
||||
import de.johni0702.minecraft.gui.container.AbstractGuiScreen;
|
||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import java.util.List;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
@@ -36,19 +35,19 @@ public class GuiHandler extends EventRegistrations {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoMainMenu); }
|
||||
public void injectIntoMainMenu(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoMainMenu(GuiScreenEvent.InitGuiEvent event) {
|
||||
//$$ final net.minecraft.client.gui.GuiScreen guiScreen = getGui(event);
|
||||
//$$ final net.minecraft.client.gui.screen.Screen guiScreen = getGui(event);
|
||||
//#endif
|
||||
if (!(guiScreen instanceof TitleScreen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonWidget button = new InjectedButton(
|
||||
InjectedButton button = new InjectedButton(
|
||||
guiScreen,
|
||||
BUTTON_REPLAY_CENTER,
|
||||
guiScreen.width / 2 + 2,
|
||||
@@ -61,13 +60,13 @@ public class GuiHandler extends EventRegistrations {
|
||||
addButton(guiScreen, button);
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoReplayViewer); }
|
||||
public void injectIntoReplayViewer(Screen vanillaGuiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoReplayViewer(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ net.minecraft.client.gui.GuiScreen vanillaGuiScreen = getGui(event);
|
||||
//$$ net.minecraft.client.gui.screen.Screen vanillaGuiScreen = getGui(event);
|
||||
//#endif
|
||||
AbstractGuiScreen guiScreen = GuiScreen.from(vanillaGuiScreen);
|
||||
if (!(guiScreen instanceof GuiReplayViewer)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -166,20 +166,32 @@ public class BlendMeshBuilder
|
||||
//#endif
|
||||
switch (element.getType()) {
|
||||
case POSITION:
|
||||
//#if MC>=11400
|
||||
if (element.getFormat() != VertexFormatElement.Format.FLOAT) {
|
||||
//#else
|
||||
//$$ if (element.getType() != VertexFormatElement.EnumType.FLOAT) {
|
||||
//#endif
|
||||
throw new UnsupportedOperationException("Only float is supported for position elements!");
|
||||
}
|
||||
posOffset = offset;
|
||||
break;
|
||||
case COLOR:
|
||||
//#if MC>=11400
|
||||
if (element.getFormat() != VertexFormatElement.Format.UBYTE) {
|
||||
//#else
|
||||
//$$ if (element.getType() != VertexFormatElement.EnumType.UBYTE) {
|
||||
//#endif
|
||||
throw new UnsupportedOperationException("Only unsigned byte is supported for color elements!");
|
||||
}
|
||||
colorOffset = offset;
|
||||
break;
|
||||
case UV:
|
||||
if (element.getIndex() != 0) break;
|
||||
//#if MC>=11400
|
||||
if (element.getFormat() != VertexFormatElement.Format.FLOAT) {
|
||||
//#else
|
||||
//$$ if (element.getType() != VertexFormatElement.EnumType.UBYTE) {
|
||||
//#endif
|
||||
throw new UnsupportedOperationException("Only float is supported for UV elements!");
|
||||
}
|
||||
uvOffset = offset;
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
//#if MC>=11400
|
||||
@Mixin(targets = "net/minecraft/client/render/WorldRenderer/ChunkInfo")
|
||||
@Mixin(targets = "net.minecraft.client.render.WorldRenderer$ChunkInfo")
|
||||
//#else
|
||||
//#if MC>=11300
|
||||
//$$ @Mixin(targets = "net/minecraft/client/renderer/WorldRenderer$ContainerLocalRenderInformation")
|
||||
|
||||
@@ -21,7 +21,11 @@ import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
//$$ @Mixin(RendererLivingEntity.class)
|
||||
//#endif
|
||||
public abstract class MixinRenderLivingBase {
|
||||
//#if FABRIC>=1
|
||||
@Inject(method = "method_4054", at = @At(
|
||||
//#else
|
||||
//$$ @Inject(method = "doRender(Lnet/minecraft/entity/LivingEntity;DDDFF)V", at = @At(
|
||||
//#endif
|
||||
value = "INVOKE",
|
||||
//#if MC>=10904
|
||||
target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;scaleAndTranslate(Lnet/minecraft/entity/LivingEntity;F)F",
|
||||
|
||||
@@ -18,13 +18,13 @@ import static com.replaymod.core.versions.MCVer.*;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.world.BlockView;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.renderer.GameRenderer;
|
||||
//$$ import net.minecraft.client.renderer.EntityRenderer;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
@Mixin(value = Camera.class)
|
||||
//#else
|
||||
//$$ @Mixin(value = GameRenderer.class)
|
||||
//$$ @Mixin(value = EntityRenderer.class)
|
||||
//#endif
|
||||
public abstract class MixinCamera {
|
||||
private EntityRendererHandler getHandler() {
|
||||
|
||||
@@ -29,17 +29,48 @@ import net.minecraft.network.NetworkState;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
import net.minecraft.client.network.packet.ChatMessageS2CPacket;
|
||||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.client.network.packet.DisconnectS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntitiesDestroyS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntitySpawnGlobalS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntitySpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.ExperienceBarUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.ExperienceOrbSpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.GameJoinS2CPacket;
|
||||
import net.minecraft.client.network.packet.GameStateChangeS2CPacket;
|
||||
import net.minecraft.client.network.packet.GuiCloseS2CPacket;
|
||||
import net.minecraft.client.network.packet.GuiOpenS2CPacket;
|
||||
import net.minecraft.client.network.packet.GuiSlotUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.GuiUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.HealthUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.LoginSuccessS2CPacket;
|
||||
import net.minecraft.client.network.packet.*;
|
||||
import net.minecraft.client.network.packet.MobSpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.PaintingSpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.ParticleS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerAbilitiesS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerPositionLookS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerRespawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.PlayerSpawnS2CPacket;
|
||||
import net.minecraft.client.network.packet.SignEditorOpenS2CPacket;
|
||||
import net.minecraft.client.network.packet.StatisticsS2CPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkProvider;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.class_4463;
|
||||
import net.minecraft.client.network.packet.OpenContainerPacket;
|
||||
import net.minecraft.client.network.packet.OpenWrittenBookS2CPacket;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
//#else
|
||||
@@ -49,8 +80,6 @@ import net.minecraft.text.TranslatableText;
|
||||
//$$ import net.minecraft.world.EnumDifficulty;
|
||||
//$$ import net.minecraft.world.WorldType;
|
||||
//$$ import net.minecraft.world.chunk.Chunk;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import java.util.ArrayList;
|
||||
//$$ import java.util.Collection;
|
||||
//$$ import java.util.Iterator;
|
||||
@@ -65,6 +94,9 @@ import net.minecraft.util.Identifier;
|
||||
|
||||
//#if MC>=11200
|
||||
import com.replaymod.core.utils.WrappedTimer;
|
||||
import net.minecraft.client.network.packet.AdvancementUpdateS2CPacket;
|
||||
import net.minecraft.client.network.packet.SelectAdvancementTabS2CPacket;
|
||||
import net.minecraft.client.network.packet.SynchronizeRecipesS2CPacket;
|
||||
//#endif
|
||||
//#if MC>=11002
|
||||
import net.minecraft.world.GameMode;
|
||||
@@ -72,7 +104,16 @@ import net.minecraft.world.GameMode;
|
||||
//$$ import net.minecraft.world.WorldSettings.GameType;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10904
|
||||
import net.minecraft.client.network.packet.UnloadChunkS2CPacket;
|
||||
//#else
|
||||
//$$ import net.minecraft.network.play.server.S21PacketChunkData;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
import net.minecraft.client.network.packet.ResourcePackSendS2CPacket;
|
||||
import net.minecraft.client.network.packet.SetCameraEntityS2CPacket;
|
||||
import net.minecraft.client.network.packet.TitleS2CPacket;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
//#else
|
||||
//$$ import org.apache.commons.io.Charsets;
|
||||
@@ -320,7 +361,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//$$ public // All event handlers need to be public in 1.7.10
|
||||
//#endif
|
||||
class EventHandler extends EventRegistrations {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreTickCallback.EVENT, this::onWorldTick); }
|
||||
private void onWorldTick() {
|
||||
//#else
|
||||
@@ -387,7 +428,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//$$ Iterator<Entity> iter = loadedEntityList(world).iterator();
|
||||
//$$ while (iter.hasNext()) {
|
||||
//$$ Entity entity = iter.next();
|
||||
//$$ if (entity.removed) {
|
||||
//$$ if (entity.isDead) {
|
||||
//$$ int chunkX = entity.chunkCoordX;
|
||||
//$$ int chunkY = entity.chunkCoordZ;
|
||||
//$$
|
||||
@@ -400,7 +441,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
//$$ if (entity.addedToChunk && world.getChunkProvider().chunkExists(chunkX, chunkY)) {
|
||||
//#endif
|
||||
//#endif
|
||||
//$$ world.getChunk(chunkX, chunkY).removeEntity(entity);
|
||||
//$$ world.getChunkFromChunkCoords(chunkX, chunkY).removeEntity(entity);
|
||||
//$$ }
|
||||
//$$
|
||||
//$$ iter.remove();
|
||||
@@ -592,7 +633,7 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
p = new PlayerRespawnS2CPacket(respawn.getDimension(), respawn.getGeneratorType(), GameMode.SPECTATOR);
|
||||
//#else
|
||||
//#if MC>=10809
|
||||
//$$ p = new SPacketRespawn(respawn.func_212643_b(),
|
||||
//$$ p = new SPacketRespawn(respawn.getDimensionID(),
|
||||
//$$ respawn.getDifficulty(), respawn.getWorldType(), GameType.SPECTATOR);
|
||||
//#else
|
||||
//$$ p = new S07PacketRespawn(respawn.func_149082_c(),
|
||||
@@ -622,14 +663,21 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
|
||||
CameraEntity cent = replayHandler.getCameraEntity();
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=10904
|
||||
//#if MC>=11400
|
||||
for (PlayerPositionLookS2CPacket.Flag relative : ppl.getFlags()) {
|
||||
//#else
|
||||
//$$ for (Object relative : ppl.func_179834_f()) {
|
||||
//#endif
|
||||
if (relative == PlayerPositionLookS2CPacket.Flag.X
|
||||
|| relative == PlayerPositionLookS2CPacket.Flag.Y
|
||||
|| relative == PlayerPositionLookS2CPacket.Flag.Z) {
|
||||
//#else
|
||||
//#if MC>=10904
|
||||
//$$ for (SPacketPlayerPosLook.EnumFlags relative : ppl.getFlags()) {
|
||||
//#else
|
||||
//$$ for (Object relative : ppl.func_179834_f()) {
|
||||
//#endif
|
||||
//$$ if (relative == SPacketPlayerPosLook.EnumFlags.X
|
||||
//$$ || relative == SPacketPlayerPosLook.EnumFlags.Y
|
||||
//$$ || relative == SPacketPlayerPosLook.EnumFlags.Z) {
|
||||
//#endif
|
||||
return null; // At least one of the coordinates is relative, so we don't care
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,16 +64,20 @@ import net.minecraft.network.NetworkSide;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
//#else
|
||||
//$$ import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//$$
|
||||
//$$ import static com.replaymod.core.versions.MCVer.FML_BUS;
|
||||
//#endif
|
||||
|
||||
//#if FABRIC>=1
|
||||
//#else
|
||||
//$$ import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;
|
||||
//#endif
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
@@ -279,7 +283,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
|
||||
}
|
||||
|
||||
private class EventHandler extends EventRegistrations {
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreTickCallback.EVENT, this::onTick); }
|
||||
private void onTick() {
|
||||
//#else
|
||||
|
||||
@@ -25,30 +25,34 @@ import net.minecraft.stat.StatHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.events.KeyBindingEventCallback;
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
import com.replaymod.replay.events.RenderSpectatorCrosshairCallback;
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
//#else
|
||||
//$$ import com.replaymod.core.versions.MCVer;
|
||||
//$$ import com.replaymod.replay.events.ReplayChatMessageEvent;
|
||||
//$$ import net.minecraft.util.math.RayTraceResult;
|
||||
//$$ import net.minecraft.util.text.ITextComponent;
|
||||
//$$ import net.minecraft.world.World;
|
||||
//$$ import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
//$$ import net.minecraftforge.client.event.RenderHandEvent;
|
||||
//$$ import net.minecraftforge.common.MinecraftForge;
|
||||
//$$ import net.minecraftforge.eventbus.api.EventPriority;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//$$ import net.minecraftforge.event.TickEvent;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
//#else
|
||||
//$$ import com.replaymod.replay.events.ReplayChatMessageEvent;
|
||||
//$$ import net.minecraft.util.math.RayTraceResult;
|
||||
//$$ import net.minecraft.util.text.ITextComponent;
|
||||
//$$ import net.minecraft.world.World;
|
||||
//$$
|
||||
//#if MC>=11300
|
||||
//$$ import net.minecraft.util.math.RayTraceFluidMode;
|
||||
@@ -622,7 +626,7 @@ public class CameraEntity
|
||||
|
||||
private EventHandler() {}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreTickCallback.EVENT, this::onPreClientTick); }
|
||||
private void onPreClientTick() {
|
||||
//#else
|
||||
@@ -633,7 +637,7 @@ public class CameraEntity
|
||||
updateArmYawAndPitch();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreRenderCallback.EVENT, this::onRenderUpdate); }
|
||||
private void onRenderUpdate() {
|
||||
//#else
|
||||
@@ -644,11 +648,11 @@ public class CameraEntity
|
||||
update();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(KeyBindingEventCallback.EVENT, CameraEntity.this::handleInputEvents); }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(RenderSpectatorCrosshairCallback.EVENT, this::shouldRenderSpectatorCrosshair); }
|
||||
private Boolean shouldRenderSpectatorCrosshair() {
|
||||
return canSpectate(mc.targetedEntity);
|
||||
@@ -678,7 +682,7 @@ public class CameraEntity
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PreRenderHandCallback.EVENT, this::onRenderHand); }
|
||||
private boolean onRenderHand() {
|
||||
// Unless we are spectating another player, don't render our hand
|
||||
@@ -693,13 +697,13 @@ public class CameraEntity
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onRenderHand(RenderHandEvent event) {
|
||||
//$$ // Unless we are spectating another player, don't render our hand
|
||||
//$$ if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof EntityPlayer)) {
|
||||
//$$ if (getRenderViewEntity(mc) == CameraEntity.this || !(getRenderViewEntity(mc) instanceof PlayerEntity)) {
|
||||
//$$ event.setCanceled(true);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
private void onRenderHandMonitor() {
|
||||
//#else
|
||||
//$$ @SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
@@ -753,7 +757,7 @@ public class CameraEntity
|
||||
|
||||
private boolean heldItemTooltipsWasTrue;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
// FIXME fabric
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#if MC<11400
|
||||
//#if FABRIC<=0
|
||||
//$$ package com.replaymod.replay.events;
|
||||
//$$
|
||||
//$$ import com.replaymod.replay.camera.CameraEntity;
|
||||
|
||||
@@ -3,21 +3,24 @@ package com.replaymod.replay.handler;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import com.replaymod.replay.gui.screen.GuiReplayViewer;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
//#endif
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -36,14 +39,14 @@ public class GuiHandler extends EventRegistrations {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoIngameMenu); }
|
||||
private void injectIntoIngameMenu(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoIngameMenu(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ GuiScreen guiScreen = getGui(event);
|
||||
//$$ List<GuiButton> buttonList = getButtonList(event);
|
||||
//$$ Screen guiScreen = getGui(event);
|
||||
//$$ List<Widget> buttonList = getButtonList(event);
|
||||
//#endif
|
||||
if (!(guiScreen instanceof GameMenuScreen)) {
|
||||
return;
|
||||
@@ -163,13 +166,13 @@ public class GuiHandler extends EventRegistrations {
|
||||
.forEach(button -> button.y -= 24);
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::ensureReplayStopped); }
|
||||
private void ensureReplayStopped(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void ensureReplayStopped(GuiScreenEvent.InitGuiEvent event) {
|
||||
//$$ GuiScreen guiScreen = getGui(event);
|
||||
//$$ Screen guiScreen = getGui(event);
|
||||
//#endif
|
||||
if (!(guiScreen instanceof TitleScreen || guiScreen instanceof MultiplayerScreen)) {
|
||||
return;
|
||||
@@ -190,18 +193,18 @@ public class GuiHandler extends EventRegistrations {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoMainMenu); }
|
||||
private void injectIntoMainMenu(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoMainMenu(GuiScreenEvent.InitGuiEvent event) {
|
||||
//$$ GuiScreen guiScreen = getGui(event);
|
||||
//$$ Screen guiScreen = getGui(event);
|
||||
//#endif
|
||||
if (!(guiScreen instanceof TitleScreen)) {
|
||||
return;
|
||||
}
|
||||
ButtonWidget button = new InjectedButton(
|
||||
InjectedButton button = new InjectedButton(
|
||||
guiScreen,
|
||||
BUTTON_REPLAY_VIEWER,
|
||||
guiScreen.width / 2 - 100,
|
||||
@@ -243,7 +246,13 @@ public class GuiHandler extends EventRegistrations {
|
||||
}
|
||||
}
|
||||
|
||||
public static class InjectedButton extends ButtonWidget {
|
||||
public static class InjectedButton extends
|
||||
//#if MC>=11400
|
||||
ButtonWidget
|
||||
//#else
|
||||
//$$ GuiButton
|
||||
//#endif
|
||||
{
|
||||
public final Screen guiScreen;
|
||||
public final int id;
|
||||
private Consumer<InjectedButton> onClick;
|
||||
|
||||
@@ -2,21 +2,18 @@
|
||||
package com.replaymod.replay.mixin;
|
||||
|
||||
import com.replaymod.replay.camera.CameraEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.world.GameMode;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.getMinecraft;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public abstract class MixinGameRenderer {
|
||||
@Accessor
|
||||
abstract MinecraftClient getClient();
|
||||
|
||||
@Redirect(
|
||||
method = "renderHand",
|
||||
at = @At(
|
||||
@@ -25,7 +22,7 @@ public abstract class MixinGameRenderer {
|
||||
)
|
||||
)
|
||||
private GameMode getGameMode(ClientPlayerInteractionManager interactionManager) {
|
||||
ClientPlayerEntity camera = getClient().player;
|
||||
ClientPlayerEntity camera = getMinecraft().player;
|
||||
if (camera instanceof CameraEntity) {
|
||||
// alternative doesn't really matter, the caller only checks for equality to SPECTATOR
|
||||
return camera.isSpectator() ? GameMode.SPECTATOR : GameMode.SURVIVAL;
|
||||
|
||||
@@ -23,7 +23,11 @@ import static com.replaymod.core.versions.MCVer.*;
|
||||
//$$ @Mixin(RendererLivingEntity.class)
|
||||
//#endif
|
||||
public abstract class MixinRenderLivingBase {
|
||||
//#if FABRIC>=1
|
||||
@Inject(method = "method_4055", at = @At("HEAD"), cancellable = true)
|
||||
//#else
|
||||
//$$ @Inject(method = "canRenderName(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true)
|
||||
//#endif
|
||||
private void replayModReplay_canRenderInvisibleName(LivingEntity entity, CallbackInfoReturnable<Boolean> ci) {
|
||||
PlayerEntity thePlayer = getMinecraft().player;
|
||||
if (thePlayer instanceof CameraEntity && entity.isInvisible()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//#if MC>=10800 && MC<11400
|
||||
//$$ package com.replaymod.replay.mixin;
|
||||
//$$
|
||||
//$$ import net.minecraft.client.GameSettings;
|
||||
//$$ import net.minecraft.client.settings.GameSettings;
|
||||
//$$ import net.minecraft.client.gui.FontRenderer;
|
||||
//$$ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
//$$ import net.minecraft.entity.Entity;
|
||||
|
||||
@@ -18,8 +18,11 @@ public class MixinTileEntityEndPortalRenderer {
|
||||
//#if MC>=11300
|
||||
@Redirect(method = "method_3591", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/SystemUtil;getMeasuringTimeMs()J"))
|
||||
//#else
|
||||
//#if MC>=11200
|
||||
//$$ @Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityEndPortal;DDDFIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
//#else
|
||||
//#if MC>=10809
|
||||
//$$ @Redirect(method = "renderTileEntityAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
//$$ @Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityEndPortal;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//$$ @Redirect(method = "func_180544_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))
|
||||
@@ -28,6 +31,7 @@ public class MixinTileEntityEndPortalRenderer {
|
||||
//#endif
|
||||
//#endif
|
||||
//#endif
|
||||
//#endif
|
||||
private long replayModReplay_getEnchantmentTime() {
|
||||
ReplayHandler replayHandler = ReplayModReplay.instance.getReplayHandler();
|
||||
if (replayHandler != null) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
import com.replaymod.core.events.PostRenderWorldCallback;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
@@ -53,7 +53,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
||||
this.replayHandler = replayHandler;
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//#if FABRIC>=1
|
||||
{ on(PostRenderWorldCallback.EVENT, this::renderCameraPath); }
|
||||
private void renderCameraPath() {
|
||||
//#else
|
||||
|
||||
Reference in New Issue
Block a user