Skip to content

Commit

Permalink
Fixed mod load order
Browse files Browse the repository at this point in the history
  • Loading branch information
AMNatty committed Apr 6, 2022
1 parent 0f90382 commit 27b1cba
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
3 changes: 3 additions & 0 deletions UPDATE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 22.0.0.0-alpha.5
* `[PlutoRuntime]` Fixed module load ordering

## 22.0.0.0-alpha.4
* `[PlutoRuntime]` Implemented optional `ResourceFileSystem` features

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/org/plutoengine/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object Versions {

const val isPrerelease = true
const val prereleaseName = "alpha"
const val prerealeaseUpdate = 4
const val prerealeaseUpdate = 5

val versionFull =
if (isPrerelease)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ public void registerMod(Class<?> 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();

Expand All @@ -119,10 +116,14 @@ public void registerMod(Class<?> modClass)

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
*
Expand Down Expand Up @@ -205,7 +206,7 @@ public void load()
}
}

this.loadedModStack.push(mod);
this.loadedModStack.addLast(mod);
}
}
catch (Exception e)
Expand Down Expand Up @@ -244,7 +245,7 @@ public void unload()
{
i++;

var mod = this.loadedModStack.pop();
var mod = this.loadedModStack.removeLast();

Logger.logf(SmartSeverity.MODULE, "[%d / %d] Deinitializing '%s'...%n", i, modCount, mod.getID());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"displayName": "Pluto Shader",
"description": "PlutoEngine's shader manager.",
"author": "Tefek",
"resourceRoots": {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import org.lwjgl.opengl.GL33;

import org.plutoengine.PlutoApplication;
import org.plutoengine.PlutoLocal;
import org.plutoengine.display.Display;
import org.plutoengine.display.Framerate;
import org.plutoengine.gui.font.FontHelper;
import org.plutoengine.gui.font.FontRenderer;
import org.plutoengine.math.ProjectionMatrix;
import org.plutoengine.mod.ModLoader;
import org.plutoengine.shader.uniform.auto.AutomaticUniforms;

public class Main extends PlutoApplication
Expand Down Expand Up @@ -41,6 +43,20 @@ public void loop()
var fpsStr = String.format("%d FPS", Framerate.getInterpolatedFPS());
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);

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()
Expand Down

0 comments on commit 27b1cba

Please sign in to comment.