Fixed mod load order

This commit is contained in:
Natty 2022-04-06 21:46:47 +02:00
parent 0f903820fa
commit 27b1cba881
No known key found for this signature in database
GPG Key ID: 40AB22FA416C7019
5 changed files with 34 additions and 7 deletions

View File

@ -1,3 +1,6 @@
## 22.0.0.0-alpha.5
* `[PlutoRuntime]` Fixed module load ordering
## 22.0.0.0-alpha.4 ## 22.0.0.0-alpha.4
* `[PlutoRuntime]` Implemented optional `ResourceFileSystem` features * `[PlutoRuntime]` Implemented optional `ResourceFileSystem` features

View File

@ -22,7 +22,7 @@ object Versions {
const val isPrerelease = true const val isPrerelease = true
const val prereleaseName = "alpha" const val prereleaseName = "alpha"
const val prerealeaseUpdate = 4 const val prerealeaseUpdate = 5
val versionFull = val versionFull =
if (isPrerelease) if (isPrerelease)

View File

@ -104,9 +104,6 @@ public final class ModLoader extends PlutoLocalComponent
var mod = Mod.from(modID, modInterface.dependencies(), modInterface.version(), modClass); var mod = Mod.from(modID, modInterface.dependencies(), modInterface.version(), modClass);
this.modNameLookup.put(modID, mod);
this.modLookup.put(modClass, mod);
this.loadList.add(mod);
var dependencies = mod.getDependencies(); var dependencies = mod.getDependencies();
@ -119,10 +116,14 @@ public final class ModLoader extends PlutoLocalComponent
this.registerMod(dependency); this.registerMod(dependency);
} }
this.modNameLookup.put(modID, mod);
this.modLookup.put(modClass, mod);
this.loadList.add(mod);
} }
/** /**
* Returns all loaded mods in no particular order. * Returns all loaded mods in their load order order.
* *
* @return A collection of all loaded mods * @return A collection of all loaded mods
* *
@ -205,7 +206,7 @@ public final class ModLoader extends PlutoLocalComponent
} }
} }
this.loadedModStack.push(mod); this.loadedModStack.addLast(mod);
} }
} }
catch (Exception e) catch (Exception e)
@ -244,7 +245,7 @@ public final class ModLoader extends PlutoLocalComponent
{ {
i++; i++;
var mod = this.loadedModStack.pop(); var mod = this.loadedModStack.removeLast();
Logger.logf(SmartSeverity.MODULE, "[%d / %d] Deinitializing '%s'...%n", i, modCount, mod.getID()); Logger.logf(SmartSeverity.MODULE, "[%d / %d] Deinitializing '%s'...%n", i, modCount, mod.getID());

View File

@ -0,0 +1,7 @@
{
"displayName": "Pluto Shader",
"description": "PlutoEngine's shader manager.",
"author": "Tefek",
"resourceRoots": {
}
}

View File

@ -4,11 +4,13 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL33; import org.lwjgl.opengl.GL33;
import org.plutoengine.PlutoApplication; import org.plutoengine.PlutoApplication;
import org.plutoengine.PlutoLocal;
import org.plutoengine.display.Display; import org.plutoengine.display.Display;
import org.plutoengine.display.Framerate; import org.plutoengine.display.Framerate;
import org.plutoengine.gui.font.FontHelper; import org.plutoengine.gui.font.FontHelper;
import org.plutoengine.gui.font.FontRenderer; import org.plutoengine.gui.font.FontRenderer;
import org.plutoengine.math.ProjectionMatrix; import org.plutoengine.math.ProjectionMatrix;
import org.plutoengine.mod.ModLoader;
import org.plutoengine.shader.uniform.auto.AutomaticUniforms; import org.plutoengine.shader.uniform.auto.AutomaticUniforms;
public class Main extends PlutoApplication public class Main extends PlutoApplication
@ -41,6 +43,20 @@ public class Main extends PlutoApplication
var fpsStr = String.format("%d FPS", Framerate.getInterpolatedFPS()); var fpsStr = String.format("%d FPS", Framerate.getInterpolatedFPS());
FontRenderer.drawString(3, 3, fpsStr, 0, 0, 0, 1, 0.75f, true); FontRenderer.drawString(3, 3, fpsStr, 0, 0, 0, 1, 0.75f, true);
FontRenderer.drawString(2, 2, fpsStr, 0.13f, 0.75f, 0.62f, 1, 0.75f, false); FontRenderer.drawString(2, 2, fpsStr, 0.13f, 0.75f, 0.62f, 1, 0.75f, false);
var mods = PlutoLocal.components().getComponent(ModLoader.class).getAllMods();
int modNr = 0;
for (var mod : mods)
{
var modManifest = mod.getManifest();
var modStr = String.format("%s &c[0xff999999]&i1%s", modManifest.displayName(), mod.getVersion());
FontRenderer.drawString(8, 50 + modNr * 18, modStr, 0, 0, 0, 0, 0.7f, "default", true);
FontRenderer.drawString(7, 49 + modNr * 18, modStr, 1, 1, 1, 1, 0.7f, "default", false);
modNr++;
}
} }
public static Display getDisplay() public static Display getDisplay()