mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-31 01:44:22 +07:00
Fixed ScriptMainGenerator class lookup
This commit is contained in:
parent
ddc8f85396
commit
785a081788
@ -410,6 +410,9 @@ project(":tools"){
|
||||
implementation arcModule("natives:natives-desktop")
|
||||
implementation arcModule("natives:natives-freetype-desktop")
|
||||
implementation arcModule("backends:backend-headless")
|
||||
|
||||
implementation("com.google.guava:guava:33.3.1-jre")
|
||||
annotationProcessor 'com.github.Anuken:jabel:0.9.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,9 +143,14 @@ const UnitUnloadEvent = Packages.mindustry.game.EventType.UnitUnloadEvent
|
||||
const UnitSpawnEvent = Packages.mindustry.game.EventType.UnitSpawnEvent
|
||||
const UnitCreateEvent = Packages.mindustry.game.EventType.UnitCreateEvent
|
||||
const UnitDrownEvent = Packages.mindustry.game.EventType.UnitDrownEvent
|
||||
const UnitDamageEvent = Packages.mindustry.game.EventType.UnitDamageEvent
|
||||
const UnitBulletDestroyEvent = Packages.mindustry.game.EventType.UnitBulletDestroyEvent
|
||||
const UnitDestroyEvent = Packages.mindustry.game.EventType.UnitDestroyEvent
|
||||
const BuildingBulletDestroyEvent = Packages.mindustry.game.EventType.BuildingBulletDestroyEvent
|
||||
const GeneratorPressureExplodeEvent = Packages.mindustry.game.EventType.GeneratorPressureExplodeEvent
|
||||
const BlockDestroyEvent = Packages.mindustry.game.EventType.BlockDestroyEvent
|
||||
const BuildSelectEvent = Packages.mindustry.game.EventType.BuildSelectEvent
|
||||
const BuildRotateEvent = Packages.mindustry.game.EventType.BuildRotateEvent
|
||||
const BlockBuildEndEvent = Packages.mindustry.game.EventType.BlockBuildEndEvent
|
||||
const BlockBuildBeginEvent = Packages.mindustry.game.EventType.BlockBuildBeginEvent
|
||||
const ResearchEvent = Packages.mindustry.game.EventType.ResearchEvent
|
||||
@ -157,21 +162,30 @@ const TileChangeEvent = Packages.mindustry.game.EventType.TileChangeEvent
|
||||
const TilePreChangeEvent = Packages.mindustry.game.EventType.TilePreChangeEvent
|
||||
const BuildDamageEvent = Packages.mindustry.game.EventType.BuildDamageEvent
|
||||
const GameOverEvent = Packages.mindustry.game.EventType.GameOverEvent
|
||||
const BuildingCommandEvent = Packages.mindustry.game.EventType.BuildingCommandEvent
|
||||
const UnitControlEvent = Packages.mindustry.game.EventType.UnitControlEvent
|
||||
const PayloadDropEvent = Packages.mindustry.game.EventType.PayloadDropEvent
|
||||
const PickupEvent = Packages.mindustry.game.EventType.PickupEvent
|
||||
const TapEvent = Packages.mindustry.game.EventType.TapEvent
|
||||
const ConfigEvent = Packages.mindustry.game.EventType.ConfigEvent
|
||||
const DepositEvent = Packages.mindustry.game.EventType.DepositEvent
|
||||
const WithdrawEvent = Packages.mindustry.game.EventType.WithdrawEvent
|
||||
const SectorCaptureEvent = Packages.mindustry.game.EventType.SectorCaptureEvent
|
||||
const ClientChatEvent = Packages.mindustry.game.EventType.ClientChatEvent
|
||||
const PlayerChatEvent = Packages.mindustry.game.EventType.PlayerChatEvent
|
||||
const TextInputEvent = Packages.mindustry.game.EventType.TextInputEvent
|
||||
const MenuOptionChooseEvent = Packages.mindustry.game.EventType.MenuOptionChooseEvent
|
||||
const ClientServerConnectEvent = Packages.mindustry.game.EventType.ClientServerConnectEvent
|
||||
const ClientPreConnectEvent = Packages.mindustry.game.EventType.ClientPreConnectEvent
|
||||
const SchematicCreateEvent = Packages.mindustry.game.EventType.SchematicCreateEvent
|
||||
const SectorLaunchLoadoutEvent = Packages.mindustry.game.EventType.SectorLaunchLoadoutEvent
|
||||
const SectorLaunchEvent = Packages.mindustry.game.EventType.SectorLaunchEvent
|
||||
const LaunchItemEvent = Packages.mindustry.game.EventType.LaunchItemEvent
|
||||
const SectorInvasionEvent = Packages.mindustry.game.EventType.SectorInvasionEvent
|
||||
const SectorLoseEvent = Packages.mindustry.game.EventType.SectorLoseEvent
|
||||
const SaveLoadEvent = Packages.mindustry.game.EventType.SaveLoadEvent
|
||||
const WorldLoadEndEvent = Packages.mindustry.game.EventType.WorldLoadEndEvent
|
||||
const WorldLoadBeginEvent = Packages.mindustry.game.EventType.WorldLoadBeginEvent
|
||||
const WorldLoadEvent = Packages.mindustry.game.EventType.WorldLoadEvent
|
||||
const FileTreeInitEvent = Packages.mindustry.game.EventType.FileTreeInitEvent
|
||||
const MusicRegisterEvent = Packages.mindustry.game.EventType.MusicRegisterEvent
|
||||
@ -183,12 +197,12 @@ const TurretAmmoDeliverEvent = Packages.mindustry.game.EventType.TurretAmmoDeliv
|
||||
const LineConfirmEvent = Packages.mindustry.game.EventType.LineConfirmEvent
|
||||
const TurnEvent = Packages.mindustry.game.EventType.TurnEvent
|
||||
const WaveEvent = Packages.mindustry.game.EventType.WaveEvent
|
||||
const HostEvent = Packages.mindustry.game.EventType.HostEvent
|
||||
const ResetEvent = Packages.mindustry.game.EventType.ResetEvent
|
||||
const PlayEvent = Packages.mindustry.game.EventType.PlayEvent
|
||||
const DisposeEvent = Packages.mindustry.game.EventType.DisposeEvent
|
||||
const ServerLoadEvent = Packages.mindustry.game.EventType.ServerLoadEvent
|
||||
const ClientCreateEvent = Packages.mindustry.game.EventType.ClientCreateEvent
|
||||
const SaveLoadEvent = Packages.mindustry.game.EventType.SaveLoadEvent
|
||||
const SaveWriteEvent = Packages.mindustry.game.EventType.SaveWriteEvent
|
||||
const MapPublishEvent = Packages.mindustry.game.EventType.MapPublishEvent
|
||||
const MapMakeEvent = Packages.mindustry.game.EventType.MapMakeEvent
|
||||
|
@ -5,7 +5,7 @@ import arc.struct.*;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ClassMap{
|
||||
public static final ObjectMap<String, Class<?>> classes = new ObjectMap<>();
|
||||
|
||||
|
||||
static{
|
||||
classes.put("AssemblerAI", mindustry.ai.types.AssemblerAI.class);
|
||||
classes.put("BoostAI", mindustry.ai.types.BoostAI.class);
|
||||
@ -104,6 +104,7 @@ public class ClassMap{
|
||||
classes.put("ItemStack", mindustry.type.ItemStack.class);
|
||||
classes.put("Liquid", mindustry.type.Liquid.class);
|
||||
classes.put("LiquidStack", mindustry.type.LiquidStack.class);
|
||||
classes.put("MapLocales", mindustry.type.MapLocales.class);
|
||||
classes.put("PayloadSeq", mindustry.type.PayloadSeq.class);
|
||||
classes.put("PayloadStack", mindustry.type.PayloadStack.class);
|
||||
classes.put("Planet", mindustry.type.Planet.class);
|
||||
@ -140,7 +141,9 @@ public class ClassMap{
|
||||
classes.put("ConstructBlock", mindustry.world.blocks.ConstructBlock.class);
|
||||
classes.put("ConstructBuild", mindustry.world.blocks.ConstructBlock.ConstructBuild.class);
|
||||
classes.put("ControlBlock", mindustry.world.blocks.ControlBlock.class);
|
||||
classes.put("ExplosionShield", mindustry.world.blocks.ExplosionShield.class);
|
||||
classes.put("ItemSelection", mindustry.world.blocks.ItemSelection.class);
|
||||
classes.put("RotBlock", mindustry.world.blocks.RotBlock.class);
|
||||
classes.put("UnitTetherBlock", mindustry.world.blocks.UnitTetherBlock.class);
|
||||
classes.put("Accelerator", mindustry.world.blocks.campaign.Accelerator.class);
|
||||
classes.put("AcceleratorBuild", mindustry.world.blocks.campaign.Accelerator.AcceleratorBuild.class);
|
||||
@ -250,6 +253,8 @@ public class ClassMap{
|
||||
classes.put("OreBlock", mindustry.world.blocks.environment.OreBlock.class);
|
||||
classes.put("OverlayFloor", mindustry.world.blocks.environment.OverlayFloor.class);
|
||||
classes.put("Prop", mindustry.world.blocks.environment.Prop.class);
|
||||
classes.put("RemoveOre", mindustry.world.blocks.environment.RemoveOre.class);
|
||||
classes.put("RemoveWall", mindustry.world.blocks.environment.RemoveWall.class);
|
||||
classes.put("SeaBush", mindustry.world.blocks.environment.SeaBush.class);
|
||||
classes.put("Seaweed", mindustry.world.blocks.environment.Seaweed.class);
|
||||
classes.put("ShallowLiquid", mindustry.world.blocks.environment.ShallowLiquid.class);
|
||||
@ -435,6 +440,7 @@ public class ClassMap{
|
||||
classes.put("ConsumeItemExplosive", mindustry.world.consumers.ConsumeItemExplosive.class);
|
||||
classes.put("ConsumeItemFilter", mindustry.world.consumers.ConsumeItemFilter.class);
|
||||
classes.put("ConsumeItemFlammable", mindustry.world.consumers.ConsumeItemFlammable.class);
|
||||
classes.put("ConsumeItemList", mindustry.world.consumers.ConsumeItemList.class);
|
||||
classes.put("ConsumeItemRadioactive", mindustry.world.consumers.ConsumeItemRadioactive.class);
|
||||
classes.put("ConsumeItems", mindustry.world.consumers.ConsumeItems.class);
|
||||
classes.put("ConsumeLiquid", mindustry.world.consumers.ConsumeLiquid.class);
|
||||
|
@ -10,6 +10,7 @@ import arc.graphics.gl.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import com.google.common.reflect.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.io.*;
|
||||
@ -113,7 +114,15 @@ public class ScriptMainGenerator{
|
||||
}
|
||||
|
||||
public static Seq<Class> getClasses(String packageName) throws Exception{
|
||||
//TODO doesn't work, a java release broke it, look into alternative solutions (or just don't, Javascript modding is a bad idea anyway)
|
||||
return new Seq<>();
|
||||
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
var result = new Seq<Class>();
|
||||
|
||||
for(ClassPath.ClassInfo info : ClassPath.from(loader).getAllClasses()){
|
||||
if(info.getName().startsWith(packageName + ".")){
|
||||
result.add(info.load());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user