Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Commit 6ba7800

Browse files
committed
First Innit
- Everything changed
1 parent 79fb8ac commit 6ba7800

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3438
-140
lines changed

build.gradle

Lines changed: 56 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,90 +2,58 @@ buildscript {
22
repositories {
33
jcenter()
44
mavenCentral()
5-
6-
maven {
7-
name = "forge"
8-
url = "http://files.minecraftforge.net/maven"
9-
}
10-
11-
maven {
12-
name = "spongepowered-repo"
13-
url = 'http://repo.spongepowered.org/maven'
14-
}
15-
5+
maven { url = 'http://files.minecraftforge.net/maven' }
6+
maven { url = 'http://repo.spongepowered.org/maven' }
167
}
178

189
dependencies {
19-
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4"
10+
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
2011
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
21-
classpath "org.spongepowered:mixingradle:0.6-SNAPSHOT"
12+
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
2213
}
2314
}
2415

25-
apply plugin: 'java'
26-
apply plugin: 'com.github.johnrengelman.shadow'
27-
apply plugin: 'net.minecraftforge.gradle.forge'
28-
apply plugin: 'org.spongepowered.mixin'
29-
3016
repositories {
17+
jcenter()
3118
mavenCentral()
32-
33-
maven {
34-
name = 'spongepowered-repo'
35-
url = 'http://repo.spongepowered.org/maven/'
36-
}
19+
maven { url = 'http://repo.spongepowered.org/maven/' }
20+
maven { url = 'https://jitpack.io' }
3721
}
3822

39-
dependencies {
40-
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
41-
exclude module: "asm-commons"
42-
exclude module: "asm-tree"
43-
exclude module: "launchwrapper"
44-
exclude module: "guava"
45-
exclude module: "log4j-core"
46-
exclude module: "gson"
47-
exclude module: "commons-io"
48-
}
49-
}
23+
apply plugin: 'java'
24+
apply plugin: 'com.github.johnrengelman.shadow'
5025

51-
version = "1"
52-
group = "de.timmi6790.clansMod"
53-
archivesBaseName = "ClansMod"
26+
apply plugin: 'net.minecraftforge.gradle.forge'
27+
apply plugin: 'org.spongepowered.mixin'
28+
29+
version = '1.0.0'
30+
group = 'de.timmi6790.mcmod'
31+
archivesBaseName = 'McMod'
5432

5533
sourceCompatibility = JavaVersion.VERSION_1_8
5634
targetCompatibility = JavaVersion.VERSION_1_8
5735
compileJava.options.encoding = 'UTF-8'
5836

37+
dependencies {
38+
// Enabled me only for build
39+
// annotationProcessor 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
40+
compile 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
5941

60-
minecraft {
61-
version = "1.8.9-11.15.1.2318-1.8.9"
62-
runDir = "run"
63-
mappings = "stable_22"
64-
makeObfSourceJar = true
65-
}
66-
67-
repositories {
68-
mavenCentral()
69-
}
70-
71-
configurations {
72-
embed
73-
compile.extendsFrom(embed)
74-
}
42+
compile 'com.github.ben-manes.caffeine:caffeine:2.8.5'
7543

76-
mixin {
77-
add sourceSets.main, "mixins.clansMod.refmap.json"
44+
compileOnly 'org.projectlombok:lombok:1.18.12'
45+
annotationProcessor 'org.projectlombok:lombok:1.18.12'
7846
}
7947

80-
reobf {
81-
shadowJar {
82-
mappingType = "SEARGE"
83-
}
48+
minecraft {
49+
version = '1.8.9-11.15.1.2318-1.8.9'
50+
runDir = 'run'
51+
mappings = 'stable_22'
8452
}
8553

8654
processResources {
87-
inputs.property "version", project.version
88-
inputs.property "mcversion", project.minecraft.version
55+
inputs.property 'version', project.version
56+
inputs.property 'mcversion', project.minecraft.version
8957

9058
from(sourceSets.main.resources.srcDirs) {
9159
include 'mcmod.info'
@@ -95,40 +63,53 @@ processResources {
9563
from(sourceSets.main.resources.srcDirs) {
9664
exclude 'mcmod.info'
9765
}
66+
67+
rename '(.+_at.cfg)', 'META-INF/$1'
68+
}
69+
70+
mixin {
71+
defaultObfuscationEnv searge
72+
add sourceSets.main, "mixins.qamod.refmap.json"
73+
}
74+
75+
reobf {
76+
shadowJar {
77+
mappingType = 'SEARGE'
78+
}
79+
}
80+
81+
configurations {
82+
embed
83+
compile.extendsFrom(embed)
9884
}
9985

10086
jar {
10187
configurations.embed.each { dep ->
10288
from(project.zipTree(dep)) {
103-
exclude 'META-INF', 'META-INF/**'
89+
exclude "META-INF", "META-INF/**"
10490
}
10591

10692
from(project.zipTree(dep)) {
107-
include 'META-INF/services', 'META-INF/services/'
93+
include "META-INF/services", "META-INF/services/"
10894
}
10995
}
11096

11197
manifest.attributes(
112-
"FMLCorePluginContainsFMLMod": "true",
113-
"ForceLoadAsMod": "true",
114-
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
115-
"MixinConfigs": "mixins.clansMod.json",
116-
"FMLCorePlugin": "de.timmi6790.clansMod.mixins.MixinLoader"
98+
'MixinConfigs': 'mixins.qamod.json',
99+
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
100+
'FMLCorePluginContainsFMLMod': "true",
101+
'ForceLoadAsMod': 'true',
102+
'FMLCorePlugin': 'de.timmi6790.mcmod.mixins.MixinLoader',
103+
'FMLAT': 'qaMod_at.cfg',
117104
)
118105
}
119106

120107
shadowJar {
121-
classifier ""
122-
exclude "LICENSE.txt", "dummyThing"
123-
}
124-
125-
task sourcesJar(type: Jar, dependsOn: classes) {
126-
classifier "sources"
127-
from sourceSets.main.allSource
108+
classifier ''
109+
exclude 'LICENSE.txt', 'dummyThing'
128110
}
129111

130112
artifacts {
131113
archives jar
132114
archives shadowJar
133-
archives sourcesJar
134115
}

src/main/java/de/timmi6790/clansMod/ClansMod.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/java/de/timmi6790/clansMod/Reference.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/java/de/timmi6790/clansMod/mixins/client/MixinC19PacketResourcePackStatus.java

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package de.timmi6790.mcmod;
2+
3+
import de.timmi6790.mcmod.command.CommandManager;
4+
import de.timmi6790.mcmod.datatypes.TaskScheduler;
5+
import de.timmi6790.mcmod.listeners.events.EventListener;
6+
import de.timmi6790.mcmod.listeners.events.MineplexEventListener;
7+
import de.timmi6790.mcmod.modules.AbstractModule;
8+
import de.timmi6790.mcmod.modules.community.CommunityModule;
9+
import de.timmi6790.mcmod.tabsupport.TabSupportManager;
10+
import lombok.Getter;
11+
import net.minecraftforge.common.MinecraftForge;
12+
import net.minecraftforge.common.config.Configuration;
13+
import net.minecraftforge.fml.common.Mod;
14+
import net.minecraftforge.fml.common.Mod.EventHandler;
15+
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
16+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
17+
18+
import java.io.File;
19+
import java.util.HashMap;
20+
import java.util.Map;
21+
import java.util.Optional;
22+
23+
@Mod(
24+
modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION,
25+
acceptedMinecraftVersions = Reference.MC_VERSION,
26+
guiFactory = Reference.GUI_FACTORY_CLASS, clientSideOnly = true
27+
)
28+
public class McMod {
29+
private static final Map<String, AbstractModule> modules = new HashMap<>();
30+
@Getter
31+
private static final ModCache modCache = new ModCache();
32+
@Getter
33+
private static final TaskScheduler taskScheduler = new TaskScheduler();
34+
@Getter
35+
private static final TabSupportManager tabSupportManager = new TabSupportManager();
36+
@Getter
37+
private static final CommandManager commandManager = new CommandManager();
38+
@Getter
39+
private static Configuration configuration;
40+
private static String configDirectory;
41+
42+
private static void addModules(final AbstractModule... modules) {
43+
for (final AbstractModule module : modules) {
44+
McMod.modules.put(module.getName().toLowerCase(), module);
45+
}
46+
}
47+
48+
public static Optional<AbstractModule> getModule(final String name) {
49+
return Optional.ofNullable(modules.get(name.toLowerCase()));
50+
}
51+
52+
public static AbstractModule getModuleOrThrow(final String name) {
53+
return getModule(name).orElseThrow(RuntimeException::new);
54+
}
55+
56+
public static void registerEvents(final Object... events) {
57+
for (final Object event : events) {
58+
MinecraftForge.EVENT_BUS.register(event);
59+
}
60+
}
61+
62+
public static void unRegisterEvents(final Object... events) {
63+
for (final Object event : events) {
64+
MinecraftForge.EVENT_BUS.unregister(event);
65+
}
66+
}
67+
68+
@EventHandler
69+
public void preInit(final FMLPreInitializationEvent event) {
70+
McMod.addModules(
71+
new CommunityModule()
72+
);
73+
74+
configDirectory = event.getModConfigurationDirectory().toString();
75+
if (configuration == null) {
76+
final File path = new File(configDirectory + "/" + Reference.MODID + ".cfg");
77+
configuration = new Configuration(path);
78+
}
79+
80+
for (final AbstractModule module : modules.values()) {
81+
System.out.printf("PreInnit module %s%n", module.getName());
82+
module.preInit(event);
83+
}
84+
}
85+
86+
@EventHandler
87+
public void init(final FMLInitializationEvent event) {
88+
for (final AbstractModule module : modules.values()) {
89+
System.out.printf("Innit module %s%n", module.getName());
90+
module.init(event);
91+
}
92+
93+
registerEvents(
94+
this,
95+
tabSupportManager,
96+
taskScheduler,
97+
commandManager,
98+
new MineplexEventListener(),
99+
new EventListener()
100+
);
101+
}
102+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package de.timmi6790.mcmod;
2+
3+
import de.timmi6790.mcmod.values.MineplexGames;
4+
import lombok.Data;
5+
6+
7+
@Data
8+
public class ModCache {
9+
private String currentServer;
10+
private MineplexGames currentGame;
11+
private boolean onMineplex;
12+
private boolean onMps;
13+
14+
public String getCurrentServerGroup() {
15+
final int splitPosition = this.currentServer.indexOf('-');
16+
17+
if (splitPosition == -1) {
18+
return this.currentServer;
19+
}
20+
return this.currentServer.substring(0, splitPosition);
21+
}
22+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.timmi6790.mcmod;
2+
3+
import lombok.AccessLevel;
4+
import lombok.NoArgsConstructor;
5+
6+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
7+
public class Reference {
8+
public static final String MODID = "RMM";
9+
public static final String NAME = "RandomMineplexMod";
10+
public static final String MC_VERSION = "1.8.9";
11+
public static final String VERSION = "1.0.0";
12+
public static final String GUI_FACTORY_CLASS = "de.timmi6790.de.timmi6790.mcmod.gui.GuiFactory";
13+
}

0 commit comments

Comments
 (0)