aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--settings.gradle17
-rw-r--r--spark-forge189/bin/main/mcmod.info (renamed from spark-forge1710/src/main/resources/mcmod.info)3
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/Forge189CommandSender.classbin0 -> 3976 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/Forge189PlatformInfo.classbin0 -> 1075 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/Forge189SparkMod.classbin0 -> 3137 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickHook.classbin0 -> 1744 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickReporter.classbin0 -> 2318 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.classbin0 -> 3317 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.classbin0 -> 4904 bytes
-rw-r--r--spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189SparkPlugin.classbin0 -> 7416 bytes
-rw-r--r--spark-forge189/build.gradle91
-rw-r--r--spark-forge189/gradle.properties2
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189CommandSender.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710CommandSender.java)8
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlatformInfo.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlatformInfo.java)6
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlayerPingProvider.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlayerPingProvider.java)4
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189SparkMod.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710SparkMod.java)37
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickHook.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickHook.java)10
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickReporter.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickReporter.java)10
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/Forge189WorldInfoProvider.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710WorldInfoProvider.java)15
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java)25
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java)32
-rw-r--r--spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189SparkPlugin.java (renamed from spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java)35
-rw-r--r--spark-forge189/src/main/resources/mcmod.info8
23 files changed, 212 insertions, 91 deletions
diff --git a/settings.gradle b/settings.gradle
index fe12f64..ed8f373 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -5,12 +5,27 @@ pluginManagement {
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
+ maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
+ maven { url = "https://maven.architectury.dev/" }
+ maven { url = "https://maven.fabricmc.net" }
+ maven { url = "https://maven.minecraftforge.net/" }
+ maven { url = "https://repo.spongepowered.org/maven/" }
+ maven { url = "https://repo.sk1er.club/repository/maven-releases/" }
}
+
+// resolutionStrategy {
+// eachPlugin {
+// if (requested.id.id == "gg.essential.loom") {
+// useModule("gg.essential:architectury-loom:"+requested.version)
+// }
+// }
+// }
}
rootProject.name = 'spark'
include (
'spark-api',
'spark-common',
- 'spark-forge1710'
+ 'spark-forge1710',
+ 'spark-forge189'
)
diff --git a/spark-forge1710/src/main/resources/mcmod.info b/spark-forge189/bin/main/mcmod.info
index 1c2c241..50e5509 100644
--- a/spark-forge1710/src/main/resources/mcmod.info
+++ b/spark-forge189/bin/main/mcmod.info
@@ -3,5 +3,6 @@
"name": "spark",
"description": "${pluginDescription}",
"version": "${pluginVersion}",
- "authors": ["Luck"]
+ "authors": ["Luck"],
+ "mcversion": "1.8.9"
}]
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/Forge189CommandSender.class b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189CommandSender.class
new file mode 100644
index 0000000..7d43775
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189CommandSender.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/Forge189PlatformInfo.class b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189PlatformInfo.class
new file mode 100644
index 0000000..123c3cb
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189PlatformInfo.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/Forge189SparkMod.class b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189SparkMod.class
new file mode 100644
index 0000000..45bbd69
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189SparkMod.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickHook.class b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickHook.class
new file mode 100644
index 0000000..60f9e75
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickHook.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickReporter.class b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickReporter.class
new file mode 100644
index 0000000..73e467d
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/Forge189TickReporter.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.class b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.class
new file mode 100644
index 0000000..16965e1
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.class b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.class
new file mode 100644
index 0000000..03d22ed
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.class
Binary files differ
diff --git a/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189SparkPlugin.class b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189SparkPlugin.class
new file mode 100644
index 0000000..450a3fd
--- /dev/null
+++ b/spark-forge189/bin/main/me/lucko/spark/forge/plugin/Forge189SparkPlugin.class
Binary files differ
diff --git a/spark-forge189/build.gradle b/spark-forge189/build.gradle
new file mode 100644
index 0000000..f3cb184
--- /dev/null
+++ b/spark-forge189/build.gradle
@@ -0,0 +1,91 @@
+import dev.architectury.pack200.java.Pack200Adapter
+
+plugins {
+ id 'idea'
+ id 'java'
+ id 'gg.essential.loom' version '0.10.0.+'
+ id 'dev.architectury.architectury-pack200' version '0.1.3'
+ id 'com.github.johnrengelman.shadow' version '7.1.2'
+}
+
+sourceCompatibility = JavaVersion.VERSION_1_8
+targetCompatibility = JavaVersion.VERSION_1_8
+compileJava.options.encoding = 'UTF-8'
+
+sourceSets {
+ main {
+ output.resourcesDir = java.classesDirectory
+ }
+}
+
+loom {
+
+ forge {
+ pack200Provider = new Pack200Adapter()
+ }
+}
+
+configurations {
+ embed
+ implementation.extendsFrom(embed)
+}
+
+repositories {
+ mavenCentral()
+ maven { url = "https://repo.sk1er.club/repository/maven-public/" }
+ maven { url = "https://jitpack.io/" }
+ maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
+}
+
+dependencies {
+ minecraft 'com.mojang:minecraft:1.8.9'
+ mappings 'de.oceanlabs.mcp:mcp_stable:22-1.8.9'
+ forge 'net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9'
+
+ embed project(':spark-common')
+}
+
+jar {
+ archiveClassifier.set("deobf")
+}
+
+shadowJar {
+ archiveFileName.set("spark-forge189.jar")
+ configurations = [project.configurations.embed]
+
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+}
+
+remapJar {
+ archiveClassifier.set("USETHISONE")
+ from shadowJar
+ input.set(shadowJar.archiveFile)
+}
+
+artifacts {
+ archives shadowJar
+ shadow shadowJar
+}
+
+build.dependsOn(shadowJar)
+
+processResources {
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ // this will ensure that this task is redone when the versions change.
+ inputs.property "version", project.version
+
+ // replace stuff in mcmod.info, nothing else
+ from(sourceSets.main.resources.srcDirs) {
+ include 'mcmod.info'
+
+ // replace version and mcversion
+ expand 'version': project.version
+ }
+
+ // copy everything else, thats not the mcmod.info
+ from(sourceSets.main.resources.srcDirs) {
+ exclude 'mcmod.info'
+ }
+
+ from(file("LICENSE"))
+} \ No newline at end of file
diff --git a/spark-forge189/gradle.properties b/spark-forge189/gradle.properties
new file mode 100644
index 0000000..38d70d1
--- /dev/null
+++ b/spark-forge189/gradle.properties
@@ -0,0 +1,2 @@
+loom.platform=forge
+org.gradle.jvmargs=-Xmx2g \ No newline at end of file
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710CommandSender.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189CommandSender.java
index 71344a3..6c8bd5a 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710CommandSender.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189CommandSender.java
@@ -21,7 +21,7 @@
package me.lucko.spark.forge;
import me.lucko.spark.common.command.sender.AbstractCommandSender;
-import me.lucko.spark.forge.plugin.Forge1710SparkPlugin;
+import me.lucko.spark.forge.plugin.Forge189SparkPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
@@ -35,10 +35,10 @@ import net.minecraftforge.common.ForgeHooks;
import java.util.UUID;
-public class Forge1710CommandSender extends AbstractCommandSender<ICommandSender> {
- private final Forge1710SparkPlugin plugin;
+public class Forge189CommandSender extends AbstractCommandSender<ICommandSender> {
+ private final Forge189SparkPlugin plugin;
- public Forge1710CommandSender(ICommandSender source, Forge1710SparkPlugin plugin) {
+ public Forge189CommandSender(ICommandSender source, Forge189SparkPlugin plugin) {
super(source);
this.plugin = plugin;
}
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlatformInfo.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlatformInfo.java
index d9c8351..6058f51 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlatformInfo.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlatformInfo.java
@@ -23,10 +23,10 @@ package me.lucko.spark.forge;
import me.lucko.spark.common.platform.PlatformInfo;
import net.minecraftforge.common.ForgeVersion;
-public class Forge1710PlatformInfo implements PlatformInfo {
+public class Forge189PlatformInfo implements PlatformInfo {
private final Type type;
- public Forge1710PlatformInfo(Type type) {
+ public Forge189PlatformInfo(Type type) {
this.type = type;
}
@@ -47,6 +47,6 @@ public class Forge1710PlatformInfo implements PlatformInfo {
@Override
public String getMinecraftVersion() {
- return "1.7.10";
+ return "1.8.9";
}
}
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlayerPingProvider.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlayerPingProvider.java
index 11ee45a..149ca1a 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710PlayerPingProvider.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189PlayerPingProvider.java
@@ -30,10 +30,10 @@ import net.minecraft.server.MinecraftServer;
import java.util.List;
import java.util.Map;
-public class Forge1710PlayerPingProvider implements PlayerPingProvider {
+public class Forge189PlayerPingProvider implements PlayerPingProvider {
private final MinecraftServer server;
- public Forge1710PlayerPingProvider(MinecraftServer server) {
+ public Forge189PlayerPingProvider(MinecraftServer server) {
this.server = server;
}
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710SparkMod.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189SparkMod.java
index 5cdd62e..5fce36a 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710SparkMod.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189SparkMod.java
@@ -20,16 +20,15 @@
package me.lucko.spark.forge;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.Mod;
-import cpw.mods.fml.common.Mod.EventHandler;
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
-import cpw.mods.fml.common.event.FMLServerStoppingEvent;
-import cpw.mods.fml.relauncher.Side;
-import me.lucko.spark.forge.plugin.Forge1710ClientSparkPlugin;
-import me.lucko.spark.forge.plugin.Forge1710ServerSparkPlugin;
+import me.lucko.spark.forge.plugin.Forge189ClientSparkPlugin;
+import me.lucko.spark.forge.plugin.Forge189ServerSparkPlugin;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
+import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
+import net.minecraftforge.fml.relauncher.Side;
import java.nio.file.Path;
@@ -39,33 +38,33 @@ import java.nio.file.Path;
version = "@version@",
acceptableRemoteVersions = "*"
)
-public class Forge1710SparkMod {
+public class Forge189SparkMod {
private Path configDirectory;
- private Forge1710ServerSparkPlugin activeServerPlugin;
+ private Forge189ServerSparkPlugin activeServerPlugin;
public String getVersion() {
- return Forge1710SparkMod.class.getAnnotation(Mod.class).version();
+ return Forge189SparkMod.class.getAnnotation(Mod.class).version();
}
- @EventHandler
+ @Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
this.configDirectory = e.getModConfigurationDirectory().toPath();
}
- @EventHandler
+ @Mod.EventHandler
public void clientInit(FMLInitializationEvent e) {
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
- Forge1710ClientSparkPlugin.register(this);
+ Forge189ClientSparkPlugin.register(this);
}
}
- @EventHandler
+ @Mod.EventHandler
public void serverInit(FMLServerStartingEvent e) {
- this.activeServerPlugin = Forge1710ServerSparkPlugin.register(this, e);
+ this.activeServerPlugin = Forge189ServerSparkPlugin.register(this, e);
}
- @EventHandler
+ @Mod.EventHandler
public void serverStop(FMLServerStoppingEvent e) {
if (this.activeServerPlugin != null) {
this.activeServerPlugin.disable();
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickHook.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickHook.java
index 44cb11a..f375d56 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickHook.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickHook.java
@@ -20,16 +20,16 @@
package me.lucko.spark.forge;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
import me.lucko.spark.common.tick.AbstractTickHook;
import me.lucko.spark.common.tick.TickHook;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
-public class Forge1710TickHook extends AbstractTickHook implements TickHook {
+public class Forge189TickHook extends AbstractTickHook implements TickHook {
private final TickEvent.Type type;
- public Forge1710TickHook(TickEvent.Type type) {
+ public Forge189TickHook(TickEvent.Type type) {
this.type = type;
}
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickReporter.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickReporter.java
index d46c4d6..b489e8b 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710TickReporter.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189TickReporter.java
@@ -20,16 +20,16 @@
package me.lucko.spark.forge;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
import me.lucko.spark.common.tick.SimpleTickReporter;
import me.lucko.spark.common.tick.TickReporter;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
-public class Forge1710TickReporter extends SimpleTickReporter implements TickReporter {
+public class Forge189TickReporter extends SimpleTickReporter implements TickReporter {
private final TickEvent.Type type;
- public Forge1710TickReporter(TickEvent.Type type) {
+ public Forge189TickReporter(TickEvent.Type type) {
this.type = type;
}
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710WorldInfoProvider.java b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189WorldInfoProvider.java
index 232f88b..d98fe41 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/Forge1710WorldInfoProvider.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/Forge189WorldInfoProvider.java
@@ -20,9 +20,6 @@
package me.lucko.spark.forge;
-import cpw.mods.fml.relauncher.ReflectionHelper;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import me.lucko.spark.common.platform.world.AbstractChunkInfo;
import me.lucko.spark.common.platform.world.CountMap;
import me.lucko.spark.common.platform.world.WorldInfoProvider;
@@ -33,16 +30,20 @@ import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraftforge.fml.relauncher.ReflectionHelper;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-public abstract class Forge1710WorldInfoProvider implements WorldInfoProvider {
- public static final class Server extends Forge1710WorldInfoProvider {
+public abstract class Forge189WorldInfoProvider implements WorldInfoProvider {
+ public static final class Server extends Forge189WorldInfoProvider {
private final MinecraftServer server;
public Server(MinecraftServer server) {
@@ -80,7 +81,7 @@ public abstract class Forge1710WorldInfoProvider implements WorldInfoProvider {
}
@SideOnly(Side.CLIENT)
- public static final class Client extends Forge1710WorldInfoProvider {
+ public static final class Client extends Forge189WorldInfoProvider {
private final Minecraft client;
public Client(Minecraft client) {
@@ -128,7 +129,7 @@ public abstract class Forge1710WorldInfoProvider implements WorldInfoProvider {
super(chunk.xPosition, chunk.zPosition);
this.entityCounts = new CountMap.Simple<>(new HashMap<>());
- for(List<Entity> entityList : chunk.entityLists) {
+ for(ClassInheritanceMultiMap<Entity> entityList : chunk.getEntityLists()) {
entityList.forEach(entity -> {
this.entityCounts.increment(entity.getClass());
});
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.java
index 446a0c9..b2cef1d 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ClientSparkPlugin.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ClientSparkPlugin.java
@@ -20,7 +20,6 @@
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;
@@ -31,13 +30,15 @@ import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.util.stream.Stream;
-public class Forge1710ClientSparkPlugin extends Forge1710SparkPlugin {
+public class Forge189ClientSparkPlugin extends Forge189SparkPlugin {
- public static void register(Forge1710SparkMod mod) {
- Forge1710ClientSparkPlugin plugin = new Forge1710ClientSparkPlugin(mod, Minecraft.getMinecraft());
+ public static void register(Forge189SparkMod mod) {
+ Forge189ClientSparkPlugin plugin = new Forge189ClientSparkPlugin(mod, Minecraft.getMinecraft());
plugin.enable();
// register listeners
@@ -50,10 +51,10 @@ public class Forge1710ClientSparkPlugin extends Forge1710SparkPlugin {
private final Minecraft minecraft;
private final ThreadDumper gameThreadDumper;
- public Forge1710ClientSparkPlugin(Forge1710SparkMod mod, Minecraft minecraft) {
+ public Forge189ClientSparkPlugin(Forge189SparkMod mod, Minecraft minecraft) {
super(mod);
this.minecraft = minecraft;
- this.gameThreadDumper = new ThreadDumper.Specific(minecraft.mcThread);
+ this.gameThreadDumper = new ThreadDumper.Specific((Thread) ReflectionHelper.getPrivateValue(Minecraft.class, minecraft, "mcThread", "field_152352_aC", "aO"));
}
@Override
@@ -67,23 +68,23 @@ public class Forge1710ClientSparkPlugin extends Forge1710SparkPlugin {
}
@Override
- public Stream<Forge1710CommandSender> getCommandSenders() {
- return Stream.of(new Forge1710CommandSender(this.minecraft.thePlayer, this));
+ public Stream<Forge189CommandSender> getCommandSenders() {
+ return Stream.of(new Forge189CommandSender(this.minecraft.thePlayer, this));
}
@Override
public TickHook createTickHook() {
- return new Forge1710TickHook(TickEvent.Type.CLIENT);
+ return new Forge189TickHook(TickEvent.Type.CLIENT);
}
@Override
public TickReporter createTickReporter() {
- return new Forge1710TickReporter(TickEvent.Type.CLIENT);
+ return new Forge189TickReporter(TickEvent.Type.CLIENT);
}
@Override
public WorldInfoProvider createWorldInfoProvider() {
- return new Forge1710WorldInfoProvider.Client(Minecraft.getMinecraft());
+ return new Forge189WorldInfoProvider.Client(Minecraft.getMinecraft());
}
@Override
@@ -93,7 +94,7 @@ public class Forge1710ClientSparkPlugin extends Forge1710SparkPlugin {
@Override
public PlatformInfo getPlatformInfo() {
- return new Forge1710PlatformInfo(PlatformInfo.Type.CLIENT);
+ return new Forge189PlatformInfo(PlatformInfo.Type.CLIENT);
}
@Override
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.java
index 03f55d7..a8ab211 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710ServerSparkPlugin.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189ServerSparkPlugin.java
@@ -21,10 +21,6 @@
package me.lucko.spark.forge.plugin;
import com.google.common.collect.Queues;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
-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;
@@ -32,21 +28,23 @@ import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
import me.lucko.spark.forge.*;
import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
-import java.util.List;
import java.util.Queue;
import java.util.stream.Stream;
-public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin {
+public class Forge189ServerSparkPlugin extends Forge189SparkPlugin {
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());
+ public static Forge189ServerSparkPlugin register(Forge189SparkMod mod, FMLServerStartingEvent event) {
+ Forge189ServerSparkPlugin plugin = new Forge189ServerSparkPlugin(mod, event.getServer());
plugin.enable();
FMLCommonHandler.instance().bus().register(plugin);
@@ -77,7 +75,7 @@ public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin {
private final MinecraftServer server;
- public Forge1710ServerSparkPlugin(Forge1710SparkMod mod, MinecraftServer server) {
+ public Forge189ServerSparkPlugin(Forge189SparkMod mod, MinecraftServer server) {
super(mod);
this.server = server;
this.gameThreadDumper = new ThreadDumper.GameThread();
@@ -108,26 +106,26 @@ public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin {
}
@Override
- public Stream<Forge1710CommandSender> getCommandSenders() {
+ public Stream<Forge189CommandSender> getCommandSenders() {
return Stream.concat(
- ((List<EntityPlayer>)this.server.getConfigurationManager().playerEntityList).stream(),
+ this.server.getConfigurationManager().playerEntityList.stream(),
Stream.of(this.server)
- ).map(sender -> new Forge1710CommandSender(sender, this));
+ ).map(sender -> new Forge189CommandSender(sender, this));
}
@Override
public TickHook createTickHook() {
- return new Forge1710TickHook(TickEvent.Type.SERVER);
+ return new Forge189TickHook(TickEvent.Type.SERVER);
}
@Override
public TickReporter createTickReporter() {
- return new Forge1710TickReporter(TickEvent.Type.SERVER);
+ return new Forge189TickReporter(TickEvent.Type.SERVER);
}
@Override
public WorldInfoProvider createWorldInfoProvider() {
- return new Forge1710WorldInfoProvider.Server(FMLCommonHandler.instance().getMinecraftServerInstance());
+ return new Forge189WorldInfoProvider.Server(FMLCommonHandler.instance().getMinecraftServerInstance());
}
@Override
@@ -139,7 +137,7 @@ public class Forge1710ServerSparkPlugin extends Forge1710SparkPlugin {
@Override
public PlatformInfo getPlatformInfo() {
- return new Forge1710PlatformInfo(PlatformInfo.Type.SERVER);
+ return new Forge189PlatformInfo(PlatformInfo.Type.SERVER);
}
@Override
diff --git a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189SparkPlugin.java
index 26e1752..6ada30c 100644
--- a/spark-forge1710/src/main/java/me/lucko/spark/forge/plugin/Forge1710SparkPlugin.java
+++ b/spark-forge189/src/main/java/me/lucko/spark/forge/plugin/Forge189SparkPlugin.java
@@ -20,16 +20,19 @@
package me.lucko.spark.forge.plugin;
-import cpw.mods.fml.common.FMLCommonHandler;
+import com.google.common.collect.Lists;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
-import me.lucko.spark.forge.Forge1710CommandSender;
-import me.lucko.spark.forge.Forge1710SparkMod;
+import me.lucko.spark.forge.Forge189CommandSender;
+import me.lucko.spark.forge.Forge189SparkMod;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraftforge.fml.common.FMLCommonHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
import java.nio.file.Path;
import java.util.Collections;
@@ -38,14 +41,14 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.logging.Level;
-public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand {
+public abstract class Forge189SparkPlugin implements SparkPlugin, ICommand {
- private final Forge1710SparkMod mod;
+ private final Forge189SparkMod mod;
private final Logger logger;
protected final ScheduledExecutorService scheduler;
protected final SparkPlatform platform;
- protected Forge1710SparkPlugin(Forge1710SparkMod mod) {
+ protected Forge189SparkPlugin(Forge189SparkMod mod) {
this.mod = mod;
this.logger = LogManager.getLogger("spark");
this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> {
@@ -100,7 +103,7 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand {
@Override
public String getCommandName() {
- return getCommandName();
+ return "sparkc";
}
@Override
@@ -108,24 +111,26 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand {
return "/" + getCommandName();
}
+ private final List<String> aliases = Lists.newArrayList("sparkc", "sparkclient");
+
@Override
public List<String> getCommandAliases() {
- return Collections.singletonList(getCommandName());
+ return aliases;
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
- this.platform.executeCommand(new Forge1710CommandSender(sender, this), args);
+ this.platform.executeCommand(new Forge189CommandSender(sender, this), args);
}
@Override
- public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) {
- return this.platform.tabCompleteCommand(new Forge1710CommandSender(sender, this), args);
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ return this.platform.tabCompleteCommand(new Forge189CommandSender(sender, this), args);
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
- return this.platform.hasPermissionForAnyCommand(new Forge1710CommandSender(sender, this));
+ return this.platform.hasPermissionForAnyCommand(new Forge189CommandSender(sender, this));
}
@Override
@@ -134,10 +139,10 @@ public abstract class Forge1710SparkPlugin implements SparkPlugin, ICommand {
}
@Override
- public int compareTo(Object o) {
- return getCommandName().compareTo(((ICommand)o).getCommandName());
+ public int compareTo(@NotNull ICommand o) {
+ return getCommandName().compareTo(o.getCommandName());
}
-
+
protected boolean isOp(EntityPlayer player) {
return FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile());
}
diff --git a/spark-forge189/src/main/resources/mcmod.info b/spark-forge189/src/main/resources/mcmod.info
new file mode 100644
index 0000000..50e5509
--- /dev/null
+++ b/spark-forge189/src/main/resources/mcmod.info
@@ -0,0 +1,8 @@
+[{
+ "modid": "spark",
+ "name": "spark",
+ "description": "${pluginDescription}",
+ "version": "${pluginVersion}",
+ "authors": ["Luck"],
+ "mcversion": "1.8.9"
+}]