Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ whitelist.json
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ developmentEnvironmentUserName =

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =

# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion =

# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
Expand All @@ -70,7 +70,7 @@ gradleTokenGroupName =
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = ModContainer.java
replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
Expand All @@ -91,18 +91,18 @@ usesMixins = true
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
usesMixinDebug = true

# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = MixinPlugin
mixinPlugin =

# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = mixins

# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
coreModClass = LoadingPlugin

# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/glowredman/defaultserverlist/LoadingPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package glowredman.defaultserverlist;

import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;

import cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.Name;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
import cpw.mods.fml.relauncher.Side;

@MCVersion("1.7.10")
@Name("DefaultServerList")
@TransformerExclusions("glowredman.defaultserverlist.LoadingPlugin")
public class LoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader {

@Override
public String getMixinConfig() {
return "mixins.defaultserverlist.early.json";
}

@Override
public List<String> getMixins(Set<String> loadedCoreMods) {
if (FMLLaunchHandler.side() == Side.CLIENT) {
return Collections.singletonList("ServerListMixin");
}
return Collections.emptyList();
}

@Override
public String[] getASMTransformerClass() {
return null;
}

@Override
public String getModContainerClass() {
return null;
}

@Override
public String getSetupClass() {
return null;
}

@Override
public void injectData(Map<String, Object> data) {
if (FMLLaunchHandler.side() == Side.CLIENT) {
Config.preInit(new File((File) data.get("mcLocation"), "config"));
}
}

@Override
public String getAccessTransformerClass() {
return null;
}
}
41 changes: 0 additions & 41 deletions src/main/java/glowredman/defaultserverlist/MixinPlugin.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/main/java/glowredman/defaultserverlist/ModContainer.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package glowredman.defaultserverlist.mixins;
package glowredman.defaultserverlist.mixins.early;

import java.util.LinkedHashMap;
import java.util.List;
Expand All @@ -20,21 +20,19 @@
@Mixin(ServerList.class)
public class ServerListMixin {

@SuppressWarnings("rawtypes")
@Shadow
@Final
private List servers;
private List<ServerData> servers;

/**
* Removes all servers from servers.dat that are already in the default list
*
* @author glowredman
*/
@SuppressWarnings("unchecked")
@Inject(at = @At("TAIL"), method = "loadServerList()V")
private void removeDuplicateServers(CallbackInfo ci) {
servers.removeIf(o -> {
String s1 = ((ServerData) o).serverIP.replace("http://", "").replace("https://", "").replace(":25565", "");
String s1 = o.serverIP.replace("http://", "").replace("https://", "").replace(":25565", "");
for (ServerData s2 : Config.SERVERS) {
if (s1.equals(s2.serverIP.replace("http://", "").replace("https://", "").replace(":25565", ""))) {
return true;
Expand Down Expand Up @@ -73,7 +71,7 @@ private void saveDefaultServerList(CallbackInfo ci) {
@Overwrite
public ServerData getServerData(int index) {
if (index < servers.size()) {
return (ServerData) servers.get(index);
return servers.get(index);
}
return Config.SERVERS.get(index - servers.size());
}
Expand Down Expand Up @@ -134,7 +132,6 @@ public void saveServerList() {}
* @reason DefaultServerList
* @author glowredman
*/
@SuppressWarnings("unchecked")
@Overwrite
public void func_147413_a(int index, ServerData data) {
if (index < servers.size()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"version": "${modVersion}",
"mcversion": "${minecraftVersion}",
"url": "https://github.com/glowredman/DefaultServerList",
"updateUrl": "https://data-hole.ddns.net:8081/mods/defaultserverlist/updates.json",
"updateUrl": "https://files.data-hole.de/mods/defaultserverlist/updates.json",
"authorList": ["glowredman"],
"credits": "",
"logoFile": "",
"screenshots": [],
"dependencies": ["spongemixins"]
"dependencies": []
}
]
8 changes: 8 additions & 0 deletions src/main/resources/mixins.defaultserverlist.early.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"required": true,
"minVersion": "0.7.11",
"package": "glowredman.defaultserverlist.mixins.early",
"refmap": "mixins.defaultserverlist.refmap.json",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.defaultserverlist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"required": true,
"minVersion": "0.7.11",
"refmap": "mixins.defaultserverlist.refmap.json",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}