diff options
Diffstat (limited to 'spark-forge1710/src')
4 files changed, 19 insertions, 8 deletions
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java index d0ae1ed..446a0c9 100644 --- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java +++ b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java @@ -23,6 +23,7 @@ package me.lucko.spark.forge.plugin; import cpw.mods.fml.common.gameevent.TickEvent; import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.platform.world.WorldInfoProvider; +import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.tick.TickHook; import me.lucko.spark.common.tick.TickReporter; import me.lucko.spark.forge.*; @@ -47,10 +48,17 @@ public class Forge1710ClientSparkPlugin extends Forge1710SparkPlugin { } private final Minecraft minecraft; + private final ThreadDumper gameThreadDumper; public Forge1710ClientSparkPlugin(Forge1710SparkMod mod, Minecraft minecraft) { super(mod); this.minecraft = minecraft; + this.gameThreadDumper = new ThreadDumper.Specific(minecraft.mcThread); + } + + @Override + public ThreadDumper getDefaultThreadDumper() { + return this.gameThreadDumper; } @Override diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java index 8dff67e..3fde91e 100644 --- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java +++ b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java @@ -27,6 +27,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.platform.world.WorldInfoProvider; +import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.tick.TickHook; import me.lucko.spark.common.tick.TickReporter; import me.lucko.spark.forge.*; @@ -43,6 +44,8 @@ import java.util.stream.Stream; public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin { private final Queue<Runnable> scheduledServerTasks = Queues.newArrayDeque(); + private final ThreadDumper.GameThread gameThreadDumper; + public static Forge1710ServerSparkPlugin register(Forge1710SparkMod mod, FMLServerStartingEvent event) { Forge1710ServerSparkPlugin plugin = new Forge1710ServerSparkPlugin(mod, event.getServer()); plugin.enable(); @@ -72,6 +75,13 @@ public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin { public Forge1710ServerSparkPlugin(Forge1710SparkMod mod, MinecraftServer server) { super(mod); this.server = server; + this.gameThreadDumper = new ThreadDumper.GameThread(); + this.scheduledServerTasks.add(() -> this.gameThreadDumper.setThread(Thread.currentThread())); + } + + @Override + public ThreadDumper getDefaultThreadDumper() { + return this.gameThreadDumper.get(); } @Override diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java index b67659f..26e1752 100644 --- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java +++ b/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java @@ -23,7 +23,6 @@ package me.lucko.spark.forge.plugin; import cpw.mods.fml.common.FMLCommonHandler; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; -import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.forge.Forge1710CommandSender; import me.lucko.spark.forge.Forge1710SparkMod; import net.minecraft.command.ICommand; @@ -45,7 +44,6 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand { private final Logger logger; protected final ScheduledExecutorService scheduler; protected final SparkPlatform platform; - protected final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread(); protected Forge1710SparkPlugin(Forge1710SparkMod mod) { this.mod = mod; @@ -98,11 +96,6 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand { } } - @Override - public ThreadDumper getDefaultThreadDumper() { - return this.threadDumper.get(); - } - // implement ICommand @Override @@ -122,7 +115,6 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand { @Override public void processCommand(ICommandSender sender, String[] args) { - this.threadDumper.ensureSetup(); this.platform.executeCommand(new Forge1710CommandSender(sender, this), args); } diff --git a/spark-forge1710/src/main/resources/META-INF/spark_at.cfg b/spark-forge1710/src/main/resources/META-INF/spark_at.cfg new file mode 100644 index 0000000..ff29bd3 --- /dev/null +++ b/spark-forge1710/src/main/resources/META-INF/spark_at.cfg @@ -0,0 +1 @@ +public net.minecraft.client.Minecraft field_152352_aC # mcThread
\ No newline at end of file |