Skip to content

Commit d6d29b0

Browse files
committed
1 parent 871bcc9 commit d6d29b0

Some content is hidden

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

45 files changed

+709
-1573
lines changed

CHANGELOG.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@
1616
## [1.1.5-pre1] - 2024-12-16
1717

1818
### Changed
19-
- Fixed some bug.
19+
- Fixed some bug.
20+
21+
## [1.1.6-pre1] - 2024-12-18
22+
23+
### Changed
24+
- Idk :)
25+
26+
## [1.1.7-pre1] - 2024-12-18
27+
28+
### Changed
29+
- Removed some code.

PLAN.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Plan
2+
3+
## Remove Scala Code
4+
- The Scala code is extensive and will require some time to remove.
5+
6+
## Replace Lambdalib2 with Better Libraries
7+
- To facilitate porting to higher versions.

build.gradle

+6-68
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,9 @@ apply from: 'gradle/scripts/publishing.gradle'
1515
apply from: 'gradle/scripts/extra.gradle'
1616
apply from: 'gradle/scripts/dependencies.gradle'
1717

18-
// Early Assertions
19-
assertProperty 'mod_version'
20-
assertProperty 'root_package'
21-
assertProperty 'mod_id'
22-
assertProperty 'mod_name'
23-
24-
assertSubProperties 'use_tags', 'tag_class_name'
25-
assertSubProperties 'use_access_transformer', 'access_transformer_locations'
26-
assertSubProperties 'use_mixins', 'mixin_booter_version', 'mixin_refmap'
27-
assertSubProperties 'use_asset_mover', 'asset_mover_version'
28-
29-
setDefaultProperty 'use_modern_java_syntax', false, false
30-
setDefaultProperty 'generate_sources_jar', true, false
31-
setDefaultProperty 'generate_javadocs_jar', true, false
32-
setDefaultProperty 'mapping_channel', true, 'stable'
33-
setDefaultProperty 'mapping_version', true, '39'
34-
setDefaultProperty 'use_dependency_at_files', true, true
35-
setDefaultProperty 'minecraft_username', true, 'Developer'
36-
setDefaultProperty 'extra_jvm_args', false, ''
37-
setDefaultProperty 'extra_tweak_classes', false, ''
38-
setDefaultProperty 'change_minecraft_sources', false, false
39-
4018
version = propertyString('mod_version')
4119
group = propertyString('root_package')
4220

43-
base {
44-
archivesName.set(propertyString('mod_id'))
45-
}
46-
4721
tasks.decompressDecompiledSources.enabled !propertyBool('change_minecraft_sources')
4822

4923
configurations {
@@ -60,9 +34,6 @@ minecraft {
6034

6135
username.set(propertyString('minecraft_username'))
6236

63-
// Add any additional tweaker classes here
64-
extraTweakClasses.addAll(propertyStringList('extra_tweak_classes'))
65-
6637
// Add various JVM arguments here for runtime
6738
def args = ['-ea:' + group]
6839
if (propertyBool('use_mixins')) {
@@ -103,10 +74,6 @@ dependencies {
10374
transitive = false
10475
}
10576
}
106-
if (propertyBool('enable_junit_testing')) {
107-
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
108-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
109-
}
11077
}
11178

11279
// Adds Access Transformer files to tasks
@@ -127,8 +94,7 @@ processResources {
12794
filterList.addAll(propertyStringList('mixin_configs').collect(config -> "mixins.${config}.json" as String))
12895

12996
filesMatching(filterList) { fcd ->
130-
fcd.expand(
131-
'mod_id': propertyString('mod_id'),
97+
fcd.expand('mod_id': propertyString('mod_id'),
13298
'mod_name': propertyString('mod_name'),
13399
'mod_version': propertyString('mod_version'),
134100
'mod_description': propertyString('mod_description'),
@@ -138,8 +104,7 @@ processResources {
138104
'mod_update_json': propertyString('mod_update_json'),
139105
'mod_logo_path': propertyString('mod_logo_path'),
140106
'mixin_refmap': propertyString('mixin_refmap'),
141-
'mixin_package': propertyString('mixin_package')
142-
)
107+
'mixin_package': propertyString('mixin_package'))
143108
}
144109

145110
if (propertyBool('use_access_transformer')) {
@@ -152,28 +117,8 @@ jar {
152117
archiveVersion = mod_version + "-Java" + JavaVersion.current().toString()
153118

154119
manifest {
155-
attributes(
156-
'FMLCorePluginContainsFMLMod': true,
157-
'FMLCorePlugin': 'cn.lambdalib2.CorePlugin'
158-
)
159-
}
160-
// Add all embedded dependencies into the jar
161-
from(provider { configurations.embed.collect { it.isDirectory() ? it : zipTree(it) } })
162-
}
163-
164-
compileTestJava {
165-
sourceCompatibility = targetCompatibility = 8
166-
}
167-
168-
test {
169-
useJUnitPlatform()
170-
javaLauncher.set(javaToolchains.launcherFor {
171-
languageVersion = JavaLanguageVersion.of(8)
172-
})
173-
if (propertyBool('show_testing_output')) {
174-
testLogging {
175-
showStandardStreams = true
176-
}
120+
attributes('FMLCorePluginContainsFMLMod': true,
121+
'FMLCorePlugin': 'cn.lambdalib2.CorePlugin')
177122
}
178123
}
179124

@@ -194,12 +139,6 @@ tasks.register('generateMixinJson') {
194139
}
195140
}
196141

197-
if (propertyBool('use_modern_java_syntax')) {
198-
tasks.withType(Javadoc).configureEach {
199-
sourceCompatibility = 21
200-
}
201-
}
202-
203142
tasks.named('injectTags', InjectTagsTask).configure {
204143
onlyIf {
205144
return propertyBool('use_tags') && !it.getTags().get().isEmpty()
@@ -221,6 +160,7 @@ tasks.register('prioritizeCoremods') {
221160
}
222161
}
223162
}
163+
224164
tasks.withType(ScalaCompile) {
225165
options.encoding = 'UTF-8'
226166
}
@@ -254,9 +194,7 @@ idea {
254194
compiler.javac {
255195
afterEvaluate {
256196
javacAdditionalOptions = "-encoding utf8"
257-
moduleJavacAdditionalOptions = [
258-
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
259-
]
197+
moduleJavacAdditionalOptions = [(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')]
260198
}
261199
}
262200
}

gradle.properties

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,19 @@ use_modern_java_syntax=true
66
# Compilation Options
77
generate_sources_jar=true
88
generate_javadocs_jar=false
9-
# Testing
10-
enable_junit_testing=true
11-
show_testing_output=false
129
# Mod Information
1310
# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/
1411
root_package=cn.academy
1512
mod_group=cn.academy
1613
mod_id=academy
1714
mod_name=AcademyCraft
18-
mod_version=1.1.4-pre2
15+
mod_version=1.1.7-pre1
1916
# Mod Metadata (Optional)
20-
mod_description=
21-
mod_url=
22-
mod_update_json=
17+
mod_description=A mod about superability. Become an ESPer and alter your reality in Minecraft!
2318
# Delimit authors with commas
24-
mod_authors=
25-
mod_credits=
26-
mod_logo_path=
19+
mod_authors=Lambda Innovation
20+
mod_credits=All the players of the mod, like you.
21+
mod_logo_path=logo.png
2722
# Mapping Properties
2823
mapping_channel=stable
2924
mapping_version=39

src/main/java/cn/academy/AcademyCraft.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package cn.academy;
22

3-
import cn.academy.analytic.AnalyticDataListener;
43
import cn.lambdalib2.crafting.RecipeRegistry;
54
import cn.lambdalib2.registry.RegistryMod;
65
import cn.lambdalib2.registry.StateEventCallback;
@@ -30,14 +29,12 @@ public class AcademyCraft {
3029
@Instance("academy-craft")
3130
public static AcademyCraft INSTANCE;
3231
public static final String VERSION = Tags.VERSION;
33-
public static final boolean DEBUG_MODE = VERSION.startsWith("@");
32+
public static final boolean DEBUG_MODE = false;
3433
public static final Logger log = LogManager.getLogger(Tags.MOD_NAME);
3534

3635
public static Configuration config;
3736
public static RecipeRegistry recipes;
3837

39-
public static AnalyticDataListener analyticDataListener;
40-
4138
public static CreativeTabs cct = new CreativeTabs("AcademyCraft") {
4239
@Override
4340
public ItemStack createIcon() {
@@ -55,10 +52,6 @@ private static void preInit(FMLPreInitializationEvent event) {
5552

5653
config = new Configuration(event.getSuggestedConfigurationFile());
5754
config.load();
58-
59-
if (config.getBoolean("analysis", "generic", true, "switch for analytic system")) {
60-
AnalyticDataListener analyticDataListener = AnalyticDataListener.instance;
61-
}
6255
}
6356

6457
@EventHandler

src/main/java/cn/academy/ability/context/Context.java

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
package cn.academy.ability.context;
22

3+
import cn.academy.AcademyCraft;
34
import cn.academy.ability.AbilityContext;
45
import cn.academy.ability.Skill;
5-
import cn.academy.AcademyCraft;
66
import cn.lambdalib2.s11n.network.NetworkMessage;
77
import cn.lambdalib2.s11n.network.NetworkMessage.IMessageDelegate;
88
import cn.lambdalib2.util.Debug;
9-
import net.minecraftforge.fml.common.FMLCommonHandler;
10-
import net.minecraftforge.fml.relauncher.Side;
11-
import net.minecraftforge.fml.relauncher.SideOnly;
129
import net.minecraft.client.Minecraft;
1310
import net.minecraft.entity.player.EntityPlayer;
1411
import net.minecraft.world.World;
12+
import net.minecraftforge.fml.relauncher.Side;
13+
import net.minecraftforge.fml.relauncher.SideOnly;
1514

1615
import java.util.ArrayList;
1716
import java.util.List;
1817
import java.util.function.Function;
1918

2019
/**
2120
* {@link Context} represents an environment that is bound to a specific player. When a context is activated
22-
* via {@link ContextManager#activate(Context)}, a connection of same context is established in server and clients
23-
* near the context, making one able to channel messages inside same context through many different sides.
21+
* via {@link ContextManager#activate(Context)}, a connection of same context is established in server and clients
22+
* near the context, making one able to channel messages inside same context through many different sides.
2423
* <p>
25-
* The logic is built upon LambdaLib's NetworkMessage, so the serialization logic is almost the same, except for
26-
* Context handles player connections and remote-side creation for you.
24+
* The logic is built upon LambdaLib's NetworkMessage, so the serialization logic is almost the same, except for
25+
* Context handles player connections and remote-side creation for you.
2726
* </p>
2827
*
28+
* @author WeAthFolD
2929
* @see cn.lambdalib2.s11n.network.NetworkMessage
3030
* @see ContextManager
31-
* @author WeAthFolD
3231
*/
33-
public class Context<TSkill extends Skill> implements IMessageDelegate {
3432

33+
public class Context<TSkill extends Skill> implements IMessageDelegate {
3534
// Turn this on if you want to debug context message detail
3635
public static final boolean DEBUG_MSG = false;
3736

3837
public static final String
39-
MSG_TERMINATED = "i_term",
40-
MSG_MADEALIVE = "i_alive",
41-
MSG_TICK = "i_tick";
38+
MSG_TERMINATED = "i_term",
39+
MSG_MADEALIVE = "i_alive",
40+
MSG_TICK = "i_tick";
4241

4342
// Key messages for single key context.
4443
public static final String MSG_KEYDOWN = "keydown";
4544
public static final String MSG_KEYTICK = "keytick";
4645
public static final String MSG_KEYUP = "keyup";
4746
public static final String MSG_KEYABORT = "keyabort";
4847

49-
public enum Status { CONSTRUCTED, ALIVE, TERMINATED }
48+
public enum Status {CONSTRUCTED, ALIVE, TERMINATED}
5049

5150
private final ContextManager mgr = ContextManager.instance;
5251

@@ -130,39 +129,37 @@ public double getRange() {
130129
return 50.0;
131130
}
132131

133-
public void sendToServer(String channel, Object ...args) {
132+
public void sendToServer(String channel, Object... args) {
134133
messageDebug("ToServer: " + channel);
135134
mgr.mToServer(this, channel, args);
136135
}
137136

138-
public void sendToClient(String channel, Object ...args) {
137+
public void sendToClient(String channel, Object... args) {
139138
messageDebug("ToClient: " + channel);
140139
mgr.mToClient(this, channel, args);
141140
}
142141

143-
public void sendToLocal(String channel, Object ...args) {
142+
public void sendToLocal(String channel, Object... args) {
144143
messageDebug("ToLocal: " + channel);
145144
mgr.mToLocal(this, channel, args);
146145
}
147146

148-
public void sendToExceptLocal(String channel, Object ...args) {
147+
public void sendToExceptLocal(String channel, Object... args) {
149148
messageDebug("ToExceptLocal: " + channel);
150149
mgr.mToExceptLocal(this, channel, args);
151150
}
152151

153-
public void sendToSelf(String channel, Object ...args) {
152+
public void sendToSelf(String channel, Object... args) {
154153
messageDebug("ToSelf: " + channel);
155154
mgr.mToSelf(this, channel, args);
156155
}
157156

158157
private void messageDebug(String s) {
159158
if (AcademyCraft.DEBUG_MODE && DEBUG_MSG) {
160-
Debug.log("[Context]" + (isRemote() ? "[C] " : "[S] " ) +getClass().getSimpleName() + ": " + s);
159+
Debug.log("[Context]" + (isRemote() ? "[C] " : "[S] ") + getClass().getSimpleName() + ": " + s);
161160
}
162161
}
163162

164-
//
165-
166163
// Sugar
167164

168165
@SideOnly(Side.CLIENT)

src/main/java/cn/academy/ability/context/ContextManager.java

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import cn.academy.AcademyCraft;
44
import cn.academy.ability.context.Context.Status;
5-
import cn.academy.analytic.events.AnalyticSkillEvent;
65
import cn.academy.event.ability.CategoryChangeEvent;
76
import cn.academy.event.ability.OverloadEvent;
87
import cn.lambdalib2.s11n.network.NetworkMessage;
@@ -426,7 +425,6 @@ private void hBeginLink(Object typein, EntityPlayerMP player, int clientID) {
426425
NetworkMessage.sendTo(player, LocalManager.instance, M_ESTABLISH_LINK, clientID, nextServerID);
427426
NetworkMessage.sendToPlayers(data.targets, ClientManager.instance, M_MAKEALIVE,
428427
writeContextType(ctx.getClass()), player, nextServerID);
429-
MinecraftForge.EVENT_BUS.post(new AnalyticSkillEvent(data.ctx.player,data.ctx.skill));
430428
nextServerID += 1;
431429

432430
log("[SVR] BeginLink");

0 commit comments

Comments
 (0)