Complete all currently actionable 1.13.2 FIXMEs

This commit is contained in:
Jonas Herzig
2019-03-10 22:41:14 +01:00
parent e9ca1bb47e
commit 0f3a6253e0
23 changed files with 313 additions and 289 deletions

View File

@@ -1,13 +1,13 @@
/* FIXME
package com.replaymod.core;
import org.apache.logging.log4j.LogManager;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.Mixins;
//#if MC<11300
//$$ import org.apache.logging.log4j.LogManager;
//$$ import org.spongepowered.asm.launch.MixinBootstrap;
//$$ import org.spongepowered.asm.mixin.Mixins;
//$$
//#if MC>=10800
import net.minecraftforge.fml.relauncher.CoreModManager;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
//$$ import net.minecraftforge.fml.relauncher.CoreModManager;
//$$ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
//#else
//$$ import com.replaymod.core.asm.GLErrorTransformer;
//$$ import com.replaymod.core.asm.GLStateTrackerTransformer;
@@ -17,56 +17,56 @@ import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
//$$ import java.util.ArrayList;
//$$ import java.util.List;
//#endif
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.CodeSource;
import java.util.Map;
@IFMLLoadingPlugin.TransformerExclusions("com.replaymod.core.asm.")
public class LoadingPlugin implements IFMLLoadingPlugin {
public LoadingPlugin() {
MixinBootstrap.init();
Mixins.addConfiguration("mixins.recording.replaymod.json");
Mixins.addConfiguration("mixins.render.replaymod.json");
Mixins.addConfiguration("mixins.replay.replaymod.json");
Mixins.addConfiguration("mixins.compat.mapwriter.replaymod.json");
Mixins.addConfiguration("mixins.compat.shaders.replaymod.json");
Mixins.addConfiguration("mixins.extras.playeroverview.replaymod.json");
CodeSource codeSource = getClass().getProtectionDomain().getCodeSource();
if (codeSource != null) {
URL location = codeSource.getLocation();
try {
File file = new File(location.toURI());
if (file.isFile()) {
// This forces forge to reexamine the jar file for FML mods
// Should eventually be handled by Mixin itself, maybe?
//$$
//$$ import java.io.File;
//$$ import java.net.URISyntaxException;
//$$ import java.net.URL;
//$$ import java.security.CodeSource;
//$$ import java.util.Map;
//$$
//$$ @IFMLLoadingPlugin.TransformerExclusions("com.replaymod.core.asm.")
//$$ public class LoadingPlugin implements IFMLLoadingPlugin {
//$$
//$$ public LoadingPlugin() {
//$$ MixinBootstrap.init();
//$$ Mixins.addConfiguration("mixins.recording.replaymod.json");
//$$ Mixins.addConfiguration("mixins.render.replaymod.json");
//$$ Mixins.addConfiguration("mixins.replay.replaymod.json");
//$$ Mixins.addConfiguration("mixins.compat.mapwriter.replaymod.json");
//$$ Mixins.addConfiguration("mixins.compat.shaders.replaymod.json");
//$$ Mixins.addConfiguration("mixins.extras.playeroverview.replaymod.json");
//$$
//$$ CodeSource codeSource = getClass().getProtectionDomain().getCodeSource();
//$$ if (codeSource != null) {
//$$ URL location = codeSource.getLocation();
//$$ try {
//$$ File file = new File(location.toURI());
//$$ if (file.isFile()) {
//$$ // This forces forge to reexamine the jar file for FML mods
//$$ // Should eventually be handled by Mixin itself, maybe?
//#if MC>=10809
CoreModManager.getIgnoredMods().remove(file.getName());
//$$ CoreModManager.getIgnoredMods().remove(file.getName());
//#else
//$$ CoreModManager.getLoadedCoremods().remove(file.getName());
//#if MC<=10710
//$$ CoreModManager.getReparseableCoremods().add(file.getName());
//#endif
//#endif
}
} catch (URISyntaxException e) {
e.printStackTrace();
}
} else {
LogManager.getLogger().warn("No CodeSource, if this is not a development environment we might run into problems!");
LogManager.getLogger().warn(getClass().getProtectionDomain());
}
}
@Override
public String[] getASMTransformerClass() {
//$$ }
//$$ } catch (URISyntaxException e) {
//$$ e.printStackTrace();
//$$ }
//$$ } else {
//$$ LogManager.getLogger().warn("No CodeSource, if this is not a development environment we might run into problems!");
//$$ LogManager.getLogger().warn(getClass().getProtectionDomain());
//$$ }
//$$ }
//$$
//$$ @Override
//$$ public String[] getASMTransformerClass() {
//#if MC>=10800
return new String[]{
};
//$$ return new String[]{
//$$ };
//#else
//$$ List<String> transformers = new ArrayList<>();
//$$ if ("true".equals(System.getProperty("replaymod.glerrors", "false"))) {
@@ -75,26 +75,26 @@ public class LoadingPlugin implements IFMLLoadingPlugin {
//$$ transformers.add(GLStateTrackerTransformer.class.getName());
//$$ return transformers.stream().toArray(String[]::new);
//#endif
}
@Override
public String getModContainerClass() {
return null;
}
@Override
public String getSetupClass() {
return null;
}
@Override
public void injectData(Map<String, Object> data) {
}
@Override
public String getAccessTransformerClass() {
return null;
}
}
*/
//$$ }
//$$
//$$ @Override
//$$ public String getModContainerClass() {
//$$ return null;
//$$ }
//$$
//$$ @Override
//$$ public String getSetupClass() {
//$$ return null;
//$$ }
//$$
//$$ @Override
//$$ public void injectData(Map<String, Object> data) {
//$$ }
//$$
//$$ @Override
//$$ public String getAccessTransformerClass() {
//$$ return null;
//$$ }
//$$
//$$ }
//#endif

View File

@@ -5,7 +5,6 @@ import com.google.common.util.concurrent.ListenableFutureTask;
import com.replaymod.core.gui.GuiReplaySettings;
import com.replaymod.core.gui.RestoreReplayGui;
import com.replaymod.core.handler.MainMenuHandler;
import com.replaymod.core.utils.OpenGLUtils;
import com.replaymod.core.versions.MCVer;
import com.replaymod.editor.ReplayModEditor;
import com.replaymod.extras.ReplayModExtras;
@@ -156,14 +155,6 @@ public class ReplayMod implements Module {
public ReplayMod() {
I18n.setI18n(net.minecraft.client.resources.I18n::format);
// Initialize the static OpenGL info field from the minecraft main thread
// Unfortunately lwjgl uses static methods so we have to make use of magic init calls as well
//#if MC>=11300
DeferredWorkQueue.runLater(OpenGLUtils::init);
//#else
//$$ OpenGLUtils.init();
//#endif
//#if MC>=11300
DeferredWorkQueue.runLater(() -> MCVer.getMinecraft().resourcePackRepository.addPackFinder(new LangResourcePack.Finder()));
//#endif

View File

@@ -1,5 +1,6 @@
package com.replaymod.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
@@ -18,8 +19,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
//#endif
import java.io.IOException;
import static com.replaymod.core.versions.MCVer.*;
/**
@@ -45,10 +44,9 @@ public class MainMenuHandler {
// and then move back down by 10 to compensate for the space to the exit button that was already there
int offset = -2 * 24 + 10;
y(button, y(button) + offset);
}
/* FIXME
//#if MC>=11300
if (button == gui.realmsButton) {
if (button.id == 14) {
realmsOffset = offset;
}
//#endif
@@ -58,11 +56,9 @@ public class MainMenuHandler {
gui.realmsNotification = new RealmsNotificationProxy((GuiScreenRealmsProxy) gui.realmsNotification, realmsOffset);
}
//#endif
*/
}
}
/* FIXME
//#if MC>=11300
private static class RealmsNotificationProxy extends GuiScreen {
private final GuiScreenRealmsProxy proxy;
@@ -74,30 +70,25 @@ public class MainMenuHandler {
}
@Override
public void setGuiSize(int w, int h) {
proxy.setGuiSize(w, h);
public void setWorldAndResolution(Minecraft mc, int width, int height) {
proxy.setWorldAndResolution(mc, width, height);
}
@Override
public void initGui() {
proxy.initGui();
public void tick() {
proxy.tick();
}
@Override
public void updateScreen() {
proxy.updateScreen();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
GL11.glTranslated(0, offset, 0);
proxy.drawScreen(mouseX, mouseY - offset, partialTicks);
proxy.render(mouseX, mouseY - offset, partialTicks);
GL11.glTranslated(0, -offset, 0);
}
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
proxy.mouseClicked(mouseX, mouseY - offset, mouseButton);
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
return proxy.mouseClicked(mouseX, mouseY - offset, mouseButton);
}
@Override
@@ -106,5 +97,4 @@ public class MainMenuHandler {
}
}
//#endif
*/
}

View File

@@ -11,11 +11,12 @@ import net.minecraftforge.registries.RegistryManager;
//#else
//$$ import cpw.mods.fml.common.registry.GameData;
//#endif
//$$ import java.util.stream.Stream;
//#endif
//#if MC>=10800
//#if MC>=11300
// FIXME
import net.minecraftforge.fml.ModList;
//#else
//$$ import net.minecraftforge.fml.common.Loader;
//$$ import net.minecraftforge.fml.common.ModContainer;
@@ -28,13 +29,20 @@ import net.minecraftforge.registries.RegistryManager;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ModCompat {
@SuppressWarnings("unchecked")
public static Collection<ModInfo> getInstalledNetworkMods() {
//#if MC>=11300
return Stream.<ModInfo>empty().collect(Collectors.toList());
Map<String, ModInfo> modInfoMap = ModList.get().getMods().stream()
.map(m -> new ModInfo(m.getModId(), m.getDisplayName(), m.getVersion().toString()))
.collect(Collectors.toMap(ModInfo::getId, Function.identity()));
return RegistryManager.ACTIVE.takeSnapshot(false).keySet().stream()
.map(RegistryManager.ACTIVE::getRegistry)
.map(ForgeRegistry::getKeys).flatMap(Set::stream)
.map(ResourceLocation::getNamespace).filter(s -> !s.equals("minecraft")).distinct()
.map(modInfoMap::get).filter(Objects::nonNull)
.collect(Collectors.toList());
//#else
//$$ Map<String, ModContainer> ignoreCaseMap = Loader.instance().getModList().stream()
//$$ .collect(Collectors.toMap(m -> m.getModId().toLowerCase(), Function.identity()));

View File

@@ -1,32 +0,0 @@
package com.replaymod.core.utils;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import java.nio.IntBuffer;
public class OpenGLUtils {
public static final int VIEWPORT_MAX_WIDTH;
public static final int VIEWPORT_MAX_HEIGHT;
static {
IntBuffer buffer = BufferUtils.createIntBuffer(16);
//#if MC>=11300
// FIXME GL11.glGetIntegerv(GL11.GL_MAX_VIEWPORT_DIMS, buffer);
buffer.put(0xffff);
buffer.put(0xffff);
//#else
//$$ GL11.glGetInteger(GL11.GL_MAX_VIEWPORT_DIMS, buffer);
//#endif
VIEWPORT_MAX_WIDTH = buffer.get();
VIEWPORT_MAX_HEIGHT = buffer.get();
}
/**
* Magic init method which has to be called from the OpenGL thread so the variables in this class
* can be initialized successfully.
* Does not perform any work on its own.
*/
public static void init() {
}
}

View File

@@ -20,6 +20,7 @@ import de.johni0702.minecraft.gui.popup.GuiInfoPopup;
import de.johni0702.minecraft.gui.utils.Colors;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.versions.MCVer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.crash.CrashReport;
import net.minecraft.util.ResourceLocation;
@@ -284,8 +285,8 @@ public class Utils {
l -> new GuiLabel().setText(l).setColor(Colors.BLACK)).toArray(GuiElement[]::new)));
// Replace close button with panel containing close and copy buttons
GuiButton copyToClipboardButton = new GuiButton().setI18nLabel("chat.copy")/* FIXME .onClick(() ->
//GuiScreen.setClipboardString(crashReport))*/.setSize(150, 20);
GuiButton copyToClipboardButton = new GuiButton().setI18nLabel("chat.copy").onClick(() ->
MCVer.setClipboardString(crashReport)).setSize(150, 20);
GuiButton closeButton = getCloseButton();
popup.removeElement(closeButton);
popup.addElements(new VerticalLayout.Data(1),

View File

@@ -433,11 +433,14 @@ public class MCVer {
//$$ }
//#endif
/* FIXME
public static ListenableFuture setServerResourcePack(ResourcePackRepository repo, File file) {
public static ListenableFuture setServerResourcePack(File file) {
//#if MC>=11300
return getMinecraft().getPackFinder().func_195741_a(file);
//#else
//$$ ResourcePackRepository repo = getMinecraft().getResourcePackRepository();
//#if MC>=10809
//#if MC>=11200
return repo.setServerResourcePack(file);
//$$ return repo.setServerResourcePack(file);
//#else
//$$ return repo.setResourcePackInstance(file);
//#endif
@@ -451,8 +454,8 @@ public class MCVer {
//$$ return Futures.immediateFuture(null);
//#endif
//#endif
//#endif
}
*/
public static boolean isKeyDown(KeyBinding keyBinding) {
//#if MC>=10800