Remove forge/fml event bus from MCVer
This commit is contained in:
@@ -34,12 +34,6 @@ import net.minecraft.text.TranslatableText;
|
|||||||
//$$ import net.minecraft.realms.RealmsSharedConstants;
|
//$$ import net.minecraft.realms.RealmsSharedConstants;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if FABRIC>=1
|
|
||||||
//#else
|
|
||||||
//$$ import net.minecraftforge.common.MinecraftForge;
|
|
||||||
//$$ import net.minecraftforge.eventbus.api.IEventBus;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -58,11 +52,6 @@ import net.minecraft.client.particle.Particle;
|
|||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if MC>=10809
|
|
||||||
//#else
|
|
||||||
//$$ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if MC>=10800
|
//#if MC>=10800
|
||||||
import net.minecraft.client.render.VertexFormat;
|
import net.minecraft.client.render.VertexFormat;
|
||||||
import net.minecraft.client.render.VertexFormatElement;
|
import net.minecraft.client.render.VertexFormatElement;
|
||||||
@@ -89,15 +78,6 @@ import java.util.Optional;
|
|||||||
* Abstraction over things that have changed between different MC versions.
|
* Abstraction over things that have changed between different MC versions.
|
||||||
*/
|
*/
|
||||||
public class MCVer {
|
public class MCVer {
|
||||||
//#if FABRIC<=0
|
|
||||||
//$$ public static IEventBus FORGE_BUS = MinecraftForge.EVENT_BUS;
|
|
||||||
//#if MC>=10809
|
|
||||||
//$$ public static IEventBus FML_BUS = FORGE_BUS;
|
|
||||||
//#else
|
|
||||||
//$$ public static EventBus FML_BUS = FMLCommonHandler.instance().bus();
|
|
||||||
//#endif
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
public static int getProtocolVersion() {
|
public static int getProtocolVersion() {
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
return SharedConstants.getGameVersion().getProtocolVersion();
|
return SharedConstants.getGameVersion().getProtocolVersion();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.google.common.util.concurrent.ListenableFutureTask;
|
|||||||
import com.replaymod.core.mixin.MinecraftAccessor;
|
import com.replaymod.core.mixin.MinecraftAccessor;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.ReportedException;
|
import net.minecraft.util.ReportedException;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventBus;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
@@ -13,15 +14,25 @@ import java.util.concurrent.FutureTask;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
//#if MC>=10809
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
//#else
|
||||||
|
//$$ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC<10800
|
//#if MC<10800
|
||||||
//$$ import java.util.ArrayDeque;
|
//$$ import java.util.ArrayDeque;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
import static com.replaymod.core.versions.MCVer.FML_BUS;
|
|
||||||
|
|
||||||
public class SchedulerImpl implements Scheduler {
|
public class SchedulerImpl implements Scheduler {
|
||||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
|
//#if MC>=10809
|
||||||
|
private static final EventBus FML_BUS = MinecraftForge.EVENT_BUS;
|
||||||
|
//#else
|
||||||
|
//$$ private static final EventBus FML_BUS = FMLCommonHandler.instance().bus();
|
||||||
|
//#endif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runSync(Runnable runnable) throws InterruptedException, ExecutionException, TimeoutException {
|
public void runSync(Runnable runnable) throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
if (mc.isCallingFromMinecraftThread()) {
|
if (mc.isCallingFromMinecraftThread()) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.replaymod.recording.mixin;
|
|||||||
|
|
||||||
import de.johni0702.minecraft.gui.container.VanillaGuiScreen;
|
import de.johni0702.minecraft.gui.container.VanillaGuiScreen;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -10,8 +11,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import static com.replaymod.core.versions.MCVer.*;
|
|
||||||
|
|
||||||
@Mixin(GuiScreen.class)
|
@Mixin(GuiScreen.class)
|
||||||
public abstract class MixinGuiScreen {
|
public abstract class MixinGuiScreen {
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ public abstract class MixinGuiScreen {
|
|||||||
ci.cancel();
|
ci.cancel();
|
||||||
if (Mouse.isCreated()) {
|
if (Mouse.isCreated()) {
|
||||||
while (Mouse.next()) {
|
while (Mouse.next()) {
|
||||||
if (FORGE_BUS.post(new VanillaGuiScreen.MouseInputEvent())) {
|
if (MinecraftForge.EVENT_BUS.post(new VanillaGuiScreen.MouseInputEvent())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
handleMouseInput();
|
handleMouseInput();
|
||||||
@@ -29,7 +28,7 @@ public abstract class MixinGuiScreen {
|
|||||||
|
|
||||||
if (Keyboard.isCreated()) {
|
if (Keyboard.isCreated()) {
|
||||||
while (Keyboard.next()) {
|
while (Keyboard.next()) {
|
||||||
if (FORGE_BUS.post(new VanillaGuiScreen.KeyboardInputEvent())) {
|
if (MinecraftForge.EVENT_BUS.post(new VanillaGuiScreen.KeyboardInputEvent())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
handleKeyboardInput();
|
handleKeyboardInput();
|
||||||
|
|||||||
Reference in New Issue
Block a user