1.13 is dead (followup to 8bc0b0a)

This commit is contained in:
Jonas Herzig
2020-03-30 01:27:57 +02:00
parent 49ea1ae40a
commit 8b7ef8d1e3
105 changed files with 300 additions and 300 deletions

View File

@@ -19,7 +19,7 @@ import static com.replaymod.core.ReplayMod.MOD_ID;
//$$ import net.minecraftforge.fml.client.registry.ClientRegistry;
//#endif
//#if MC>=11300
//#if MC>=11400
import com.replaymod.core.events.KeyBindingEventCallback;
import com.replaymod.core.events.KeyEventCallback;
import com.replaymod.core.events.PreRenderCallback;
@@ -83,7 +83,7 @@ public class KeyBindingRegistry extends EventRegistrations {
return Collections.unmodifiableMap(keyBindings);
}
//#if MC>=11300
//#if MC>=11400
{ on(KeyBindingEventCallback.EVENT, this::handleKeyBindings); }
{ on(KeyEventCallback.EVENT, (keyCode, scanCode, action, modifiers) -> handleRaw(keyCode, action)); }
{ on(PreRenderCallback.EVENT, this::handleRepeatedKeyBindings); }
@@ -131,7 +131,7 @@ public class KeyBindingRegistry extends EventRegistrations {
}
}
//#if MC>=11300
//#if MC>=11400
private void handleRaw(int keyCode, int action) {
if (action != 0) return;
//#else

View File

@@ -1,6 +1,6 @@
package com.replaymod.core;
//#if MC<11300
//#if MC<11400
//$$ import org.apache.logging.log4j.LogManager;
//$$ import org.spongepowered.asm.launch.MixinBootstrap;
//$$ import org.spongepowered.asm.mixin.Mixins;

View File

@@ -47,7 +47,7 @@ import net.fabricmc.loader.api.FabricLoader;
//$$ import java.util.Queue;
//$$ import java.util.concurrent.FutureTask;
//$$
//#if MC>=11300
//#if MC>=11400
//$$ import com.replaymod.core.versions.LangResourcePack;
//$$ import net.minecraft.resources.IPackFinder;
//$$ import net.minecraft.resources.ResourcePackInfo;
@@ -65,7 +65,7 @@ import net.fabricmc.loader.api.FabricLoader;
//$$ import net.minecraft.client.GameSettings;
//#endif
//$$
//#if MC>=11300
//#if MC>=11400
//$$ import net.minecraftforge.fml.ModList;
//#else
//$$ import net.minecraftforge.fml.common.Loader;
@@ -101,7 +101,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
//#if FABRIC<=0
//#if MC>=11300
//#if MC>=11400
//$$ @Mod(ReplayMod.MOD_ID)
//#else
//$$ @Mod(modid = ReplayMod.MOD_ID,
@@ -127,7 +127,7 @@ public class ReplayMod implements
//#if MC>=11400
private static final String minecraftVersion = MinecraftClient.getInstance().getGame().getVersion().getName();
//#else
//#if MC>=11300
//#if MC>=11400
//$$ private static final String minecraftVersion = MCPVersion.getMCVersion();
//#else
//$$ private static final String minecraftVersion = Loader.MC_VERSION;
@@ -141,7 +141,7 @@ public class ReplayMod implements
private static final MinecraftClient mc = MCVer.getMinecraft();
//#if MC<11300
//#if MC<11400
//$$ @Deprecated
//$$ public static Configuration config;
//#endif
@@ -153,7 +153,7 @@ public class ReplayMod implements
}
// The instance of your mod that Forge uses.
//#if MC>=11300
//#if MC>=11400
{ instance = this; }
//#else
//$$ @Instance(MOD_ID)
@@ -187,7 +187,7 @@ public class ReplayMod implements
//#if MC>=11400
// Not needed on fabric, using MixinModResourcePackUtil instead. Could in theory also use it on 1.13 but it already works as is.
//#else
//#if MC>=11300
//#if MC>=11400
//$$ DeferredWorkQueue.runLater(() -> MCVer.getMinecraft().getResourcePackList().addPackFinder(new LangResourcePack.Finder()));
//#endif
//#endif
@@ -204,12 +204,12 @@ public class ReplayMod implements
modules.add(new ReplayModExtras(this));
modules.add(new ReplayModCompat());
//#if MC>=11300
//#if MC>=11400
settingsRegistry.register();
//#endif
}
//#if MC<=11300
//#if MC<=11400
//$$ @EventHandler
//$$ public void init(FMLPreInitializationEvent event) {
//$$ config = new Configuration(event.getSuggestedConfigurationFile());
@@ -261,7 +261,7 @@ public class ReplayMod implements
}
}
};
//#if MC>=11300
//#if MC>=11400
mc.getResourcePackContainerManager().addCreator(new ResourcePackCreator() {
@Override
public <T extends ResourcePackContainer> void registerContainer(Map<String, T> map, ResourcePackContainer.Factory<T> factory) {
@@ -299,7 +299,7 @@ public class ReplayMod implements
modules.forEach(m -> m.registerKeyBindings(keyBindingRegistry));
}
//#else
//#if MC>=11300
//#if MC>=11400
//$$ {
//$$ FMLJavaModLoadingContext.get().getModEventBus().addListener((FMLCommonSetupEvent event) -> modules.forEach(Module::initCommon));
//$$ FMLJavaModLoadingContext.get().getModEventBus().addListener((FMLClientSetupEvent event) -> modules.forEach(Module::initClient));
@@ -575,7 +575,7 @@ public class ReplayMod implements
.orElseThrow(IllegalStateException::new)
.getMetadata().getVersion().toString();
//#else
//#if MC>=11300
//#if MC>=11400
//$$ return ModList.get().getModContainerById(MOD_ID).get().getModInfo().getVersion().toString();
//#else
//$$ return Loader.instance().getIndexedModList().get(MOD_ID).getVersion();

View File

@@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
//#else
//#if MC>=11300
//#if MC>=11400
//$$ import net.minecraftforge.common.ForgeConfigSpec;
//$$ import net.minecraftforge.fml.ModLoadingContext;
//$$ import net.minecraftforge.fml.config.ModConfig;
@@ -38,7 +38,7 @@ public class SettingsRegistry {
private final Path configFile = getMinecraft().runDirectory.toPath().resolve("config/replaymod.json");
//#else
//$$ private static final Object NULL_OBJECT = new Object();
//#if MC>=11300
//#if MC>=11400
//$$ private ForgeConfigSpec spec;
//$$ private ModConfig config;
//#else
@@ -90,7 +90,7 @@ public class SettingsRegistry {
}
}
//#else
//#if MC>=11300
//#if MC>=11400
//$$ public void register() {
//$$ if (spec == null) {
//$$ ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
@@ -143,7 +143,7 @@ public class SettingsRegistry {
//#if MC>=11400
settings.put(key, key.getDefault());
//#else
//#if MC>=11300
//#if MC>=11400
//$$ if (spec != null) {
//$$ throw new IllegalStateException("Cannot register more settings are spec has been built.");
//$$ }
@@ -184,7 +184,7 @@ public class SettingsRegistry {
public <T> void set(SettingKey<T> key, T value) {
//#if MC<11400
//#if MC>=11300
//#if MC>=11400
//$$ if (config != null) {
//$$ config.getConfigData().set(key.getCategory() + "." + key.getKey(), value);
//$$ }
@@ -237,7 +237,7 @@ public class SettingsRegistry {
e.printStackTrace();
}
//#else
//#if MC>=11300
//#if MC>=11400
//$$ if (config != null) {
//$$ config.save();
//$$ }

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.events;
import de.johni0702.minecraft.gui.utils.Event;

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.events;
import de.johni0702.minecraft.gui.utils.Event;

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.events;
import de.johni0702.minecraft.gui.utils.Event;

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.events;
import de.johni0702.minecraft.gui.utils.Event;

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.events;
import de.johni0702.minecraft.gui.utils.Event;

View File

@@ -58,7 +58,7 @@ public class MainMenuHandler extends EventRegistrations {
int offset = -1 * 24 + 10;
button.y += offset;
//#if MC>=11300
//#if MC>=11400
//#if MC>=11400
if (BUTTON_REALMS.equals(button.getMessage())) {
//#else
@@ -68,7 +68,7 @@ public class MainMenuHandler extends EventRegistrations {
}
//#endif
}
//#if MC>=11300
//#if MC>=11400
GuiMainMenuAccessor guiA = (GuiMainMenuAccessor) gui;
if (realmsOffset != 0 && guiA.getRealmsNotification() instanceof RealmsScreenProxy) {
guiA.setRealmsNotification(new RealmsNotificationProxy((RealmsScreenProxy) guiA.getRealmsNotification(), realmsOffset));
@@ -77,7 +77,7 @@ public class MainMenuHandler extends EventRegistrations {
}
}
//#if MC>=11300
//#if MC>=11400
private static class RealmsNotificationProxy extends Screen {
private final RealmsScreenProxy proxy;
private final int offset;

View File

@@ -12,7 +12,7 @@ import net.minecraft.client.gui.widget.AbstractButtonWidget;
//$$ import net.minecraft.client.gui.GuiButton;
//#endif
//#if MC>=11300
//#if MC>=11400
import net.minecraft.client.gui.Element;
//#endif
@@ -26,7 +26,7 @@ public interface GuiScreenAccessor {
//$$ List<GuiButton> getButtons();
//#endif
//#if MC>=11300
//#if MC>=11400
@Accessor
List<Element> getChildren();
//#endif

View File

@@ -12,7 +12,7 @@ import java.util.Queue;
//$$ import java.util.concurrent.FutureTask;
//#endif
//#if MC<11300
//#if MC<11400
//$$ import net.minecraft.client.resources.IResourcePack;
//$$ import java.util.List;
//#endif
@@ -35,7 +35,7 @@ public interface MinecraftAccessor {
@Accessor("crashReport")
CrashReport getCrashReporter();
//#if MC<11300
//#if MC<11400
//$$ @Accessor
//$$ List<IResourcePack> getDefaultResourcePacks();
//#endif

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.mixin;
import com.replaymod.core.events.KeyBindingEventCallback;

View File

@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11300
//#if MC>=11400
import com.replaymod.core.events.PostRenderCallback;
import com.replaymod.core.events.PreRenderCallback;
//#else
@@ -33,7 +33,7 @@ public abstract class MixinMinecraft
public MixinMinecraft(String string_1) { super(string_1); }
//#endif
//#if MC>=11300
//#if MC>=11400
@Shadow protected abstract void handleInputEvents();
@Override

View File

@@ -16,7 +16,7 @@ import net.minecraft.util.registry.Registry;
//$$ import java.util.stream.Stream;
//#endif
//$$
//#if MC>=11300
//#if MC>=11400
//$$ import net.minecraftforge.fml.ModList;
//#else
//$$ import net.minecraftforge.fml.common.Loader;
@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
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)

View File

@@ -17,7 +17,7 @@ import static com.replaymod.core.versions.MCVer.readString;
* @see <a href="https://gist.github.com/Johni0702/2547c463e51f65f312cb">Replay Restrictions Gist</a>
*/
public class Restrictions {
//#if MC>=11300
//#if MC>=11400
public static final Identifier PLUGIN_CHANNEL = new Identifier("replaymod", "restrict");
//#else
//$$ public static final String PLUGIN_CHANNEL = "Replay|Restrict";

View File

@@ -33,7 +33,7 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
//#if MC>=11300
//#if MC>=11400
//#else
//$$ import org.lwjgl.input.Keyboard;
//#endif
@@ -209,7 +209,7 @@ public class Utils {
}
public static boolean isCtrlDown() {
//#if MC>=11300
//#if MC>=11400
return Screen.hasControlDown();
//#else
//$$ return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);

View File

@@ -9,7 +9,7 @@ public class WrappedTimer extends RenderTickCounter {
protected final RenderTickCounter wrapped;
public WrappedTimer(RenderTickCounter wrapped) {
//#if MC>=11300
//#if MC>=11400
super(0, 0);
//#else
//$$ super(0);
@@ -20,13 +20,13 @@ public class WrappedTimer extends RenderTickCounter {
@Override
public void beginRenderTick(
//#if MC>=11300
//#if MC>=11400
long sysClock
//#endif
) {
copy(this, wrapped);
wrapped.beginRenderTick(
//#if MC>=11300
//#if MC>=11400
sysClock
//#endif
);

View File

@@ -1,4 +1,4 @@
//#if MC>=11300
//#if MC>=11400
package com.replaymod.core.versions;
import com.google.gson.Gson;

View File

@@ -50,7 +50,7 @@ import java.util.concurrent.CompletableFuture;
//$$ import net.minecraftforge.eventbus.api.IEventBus;
//#endif
//#if MC>=11300
//#if MC>=11400
import net.minecraft.client.util.Window;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
@@ -96,7 +96,7 @@ import net.minecraft.client.render.chunk.ChunkRenderTask;
//#if FABRIC>=1
import net.fabricmc.loader.api.FabricLoader;
//#else
//#if MC>=11300
//#if MC>=11400
//$$ import net.minecraftforge.fml.ModList;
//#else
//$$ import net.minecraftforge.fml.common.Loader;
@@ -129,7 +129,7 @@ public class MCVer {
//#if FABRIC>=1
return FabricLoader.getInstance().isModLoaded(id.toLowerCase());
//#else
//#if MC>=11300
//#if MC>=11400
//$$ return ModList.get().isLoaded(id.toLowerCase());
//#else
//$$ return Loader.isModLoaded(id);
@@ -244,7 +244,7 @@ public class MCVer {
//$$ }
//#else
//$$ public static void addButton(GuiScreenEvent.InitGuiEvent event, GuiButton button) {
//#if MC>=11300
//#if MC>=11400
//$$ event.addButton(button);
//#else
//$$ getButtonList(event).add(button);
@@ -252,7 +252,7 @@ public class MCVer {
//$$ }
//$$
//$$ public static void removeButton(GuiScreenEvent.InitGuiEvent event, GuiButton button) {
//#if MC>=11300
//#if MC>=11400
//$$ event.removeButton(button);
//#else
//$$ getButtonList(event).remove(button);
@@ -387,7 +387,7 @@ public class MCVer {
//#endif
}
//#if MC>=11300
//#if MC>=11400
public static Window getWindow(MinecraftClient mc) {
//#if MC>=11500
//$$ return mc.getWindow();
@@ -397,7 +397,7 @@ public class MCVer {
}
//#endif
//#if MC>=11300
//#if MC>=11400
public static Window newScaledResolution(MinecraftClient mc) {
return getWindow(mc);
}
@@ -418,7 +418,7 @@ public class MCVer {
//$$ ListenableFuture<?>
//#endif
setServerResourcePack(File file) {
//#if MC>=11300
//#if MC>=11400
return getMinecraft().getResourcePackDownloader().loadServerPack(file);
//#else
//$$ ResourcePackRepository repo = getMinecraft().getResourcePackRepository();
@@ -574,19 +574,19 @@ public class MCVer {
}
//#endif
acc.getButtons().add(button);
//#if MC>=11300
//#if MC>=11400
acc.getChildren().add(button);
//#endif
}
//#if MC>=11300
//#if MC>=11400
public static void processKeyBinds() {
((MinecraftMethodAccessor) getMinecraft()).replayModProcessKeyBinds();
}
//#endif
public interface MinecraftMethodAccessor {
//#if MC>=11300
//#if MC>=11400
void replayModProcessKeyBinds();
//#else
//#if MC>=10904
@@ -608,7 +608,7 @@ public class MCVer {
//#endif
public static long milliTime() {
//#if MC>=11300
//#if MC>=11400
return SystemUtil.getMeasuringTimeMs();
//#else
//$$ return Minecraft.getSystemTime();
@@ -619,7 +619,7 @@ public class MCVer {
//#if MC>=11500
//$$ getMinecraft().getTextureManager().bindTexture(texture);
//#else
//#if MC>=11300
//#if MC>=11400
getMinecraft().getTextureManager().bindTexture(texture);
//#else
//$$ getMinecraft().renderEngine.bindTexture(texture);
@@ -647,7 +647,7 @@ public class MCVer {
//#endif
public static void openFile(File file) {
//#if MC>=11300
//#if MC>=11400
SystemUtil.getOperatingSystem().open(file);
//#else
//$$ String path = file.getAbsolutePath();
@@ -677,7 +677,7 @@ public class MCVer {
}
public static void openURL(URI url) {
//#if MC>=11300
//#if MC>=11400
//#if MC>=11400
SystemUtil.getOperatingSystem().open(url);
//#else
@@ -692,7 +692,7 @@ public class MCVer {
//#endif
}
//#if MC>=11300
//#if MC>=11400
private static Boolean hasOptifine;
public static boolean hasOptifine() {
if (hasOptifine == null) {
@@ -729,7 +729,7 @@ public class MCVer {
//#endif
public static abstract class Keyboard {
//#if MC>=11300
//#if MC>=11400
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;
@@ -820,7 +820,7 @@ public class MCVer {
//#if MC>=11400
return InputUtil.isKeyPressed(getMinecraft().window.getHandle(), keyCode);
//#else
//#if MC>=11300
//#if MC>=11400
//$$ return InputMappings.isKeyDown(keyCode);
//#else
//$$ return org.lwjgl.input.Keyboard.isKeyDown(keyCode);
@@ -829,7 +829,7 @@ public class MCVer {
//#endif
}
//#if MC<11300
//#if MC<11400
//$$ public static int getEventKey() {
//$$ return org.lwjgl.input.Keyboard.getEventKey();
//$$ }