-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 💎📕 * fix * Even more changes * move NeoEventUtils * final * interfaces * remove unused code * Some changes * 💎 * more changes * 秦始皇统一度量衡 be like * 扔掉group * 💎 💢 * clean * So faq loom * everything is fine 🔥 --------- Co-authored-by: TexTrue <[email protected]>
- Loading branch information
1 parent
29e5e62
commit 765092f
Showing
260 changed files
with
2,693 additions
and
1,424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
apply from: rootProject.file("gradle/scripts/klib-common.gradle") | ||
|
||
group = "band.kessoku.lib.base" | ||
base.archivesName = rootProject.name + "-base" | ||
|
||
dependencies { | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
base/common/src/main/java/band/kessoku/lib/api/KessokuLib.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2024 KessokuTeaTime | ||
* | ||
* Licensed under the GNU Lesser General Pubic License, Version 3 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gnu.org/licenses/lgpl-3.0.html | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package band.kessoku.lib.api; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
import java.util.*; | ||
|
||
import org.jetbrains.annotations.UnmodifiableView; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public final class KessokuLib { | ||
private static final List<Class<?>> initializedModules = new ArrayList<>(); | ||
|
||
private KessokuLib() { | ||
} | ||
|
||
public static void loadModule(Class<?> moduleCommonClass) { | ||
// Try to get module name | ||
String moduleName; | ||
try { | ||
Field field = moduleCommonClass.getField("NAME"); | ||
if (!Modifier.isStatic(field.getModifiers())) | ||
throw new IllegalArgumentException("NAME in " + moduleCommonClass.getPackageName() + " is not static!"); | ||
field.setAccessible(true); | ||
moduleName = (String) field.get(null); | ||
} catch (NoSuchFieldException e) { | ||
getLogger().warn("no NAME found for {}! Using package name", moduleCommonClass.getPackageName()); | ||
moduleName = moduleCommonClass.getPackageName(); | ||
} catch (IllegalAccessException e) { | ||
// Already set accessible, shouldn't be called | ||
moduleName = moduleCommonClass.getPackageName(); | ||
} | ||
initializedModules.add(moduleCommonClass); | ||
getLogger().info("{} loaded!", moduleName); | ||
} | ||
|
||
public static boolean isModuleLoaded(Class<?> moduleCommonClass) { | ||
return initializedModules.contains(moduleCommonClass); | ||
} | ||
|
||
@UnmodifiableView | ||
public static List<Class<?>> getActiveModules() { | ||
return Collections.unmodifiableList(initializedModules); | ||
} | ||
|
||
public static <T> T loadService(final Class<T> clazz) { | ||
return ServiceLoader.load(clazz).findFirst().orElseThrow(() -> new AssertionError("No impl found for " + clazz.getPackageName())); | ||
} | ||
|
||
public static Logger getLogger() { | ||
return LoggerFactory.getLogger("[Kessoku Lib]"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
base/common/src/main/java/band/kessoku/lib/impl/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@ApiStatus.Internal | ||
package band.kessoku.lib.impl; | ||
|
||
import org.jetbrains.annotations.ApiStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
base/neo/src/main/java/band/kessoku/lib/impl/base/neoforge/KessokuBaseNeoforge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2024 KessokuTeaTime | ||
* | ||
* Licensed under the GNU Lesser General Pubic License, Version 3 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gnu.org/licenses/lgpl-3.0.html | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package band.kessoku.lib.impl.base.neoforge; | ||
|
||
import band.kessoku.lib.api.KessokuLib; | ||
import band.kessoku.lib.api.base.KessokuBase; | ||
|
||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod(KessokuBase.MOD_ID) | ||
public final class KessokuBaseNeoforge { | ||
public KessokuBaseNeoforge() { | ||
KessokuLib.loadModule(KessokuBase.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,4 +99,5 @@ subprojects { | |
|
||
allprojects { | ||
apply plugin: "com.diffplug.spotless" | ||
group = "band.kessoku.lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
buildSrc/src/main/java/band/kessoku/gradle/plugin/PlatformIdentifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package band.kessoku.gradle.plugin; | ||
|
||
import net.fabricmc.loom.util.ModPlatform; | ||
|
||
import java.util.Locale; | ||
|
||
public enum PlatformIdentifier { | ||
FABRIC("Fabric", ModPlatform.FABRIC), | ||
NEO("Neo", ModPlatform.NEOFORGE) | ||
; | ||
|
||
private final String displayName; | ||
private final ModPlatform modPlatform; | ||
|
||
PlatformIdentifier(String displayName, ModPlatform modPlatform) { | ||
this.displayName = displayName; | ||
this.modPlatform = modPlatform; | ||
} | ||
|
||
/** | ||
* Returns the lowercase ID of this mod platform. | ||
*/ | ||
public String id() { | ||
return name().toLowerCase(Locale.ROOT); | ||
} | ||
|
||
public String displayName() { | ||
return displayName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
apply from: rootProject.file("gradle/scripts/klib-common.gradle") | ||
|
||
group = "band.kessoku.lib.command" | ||
base.archivesName = rootProject.name + "-command" | ||
|
||
kessoku { | ||
modules(["base", "event-base"], "common") | ||
|
||
testModules(["base", "event-base"], "common") | ||
} |
Oops, something went wrong.