Skip to content

Commit

Permalink
💎 💢
Browse files Browse the repository at this point in the history
  • Loading branch information
RawDiamondMC committed Sep 30, 2024
1 parent d9d5d51 commit 69eaa2d
Show file tree
Hide file tree
Showing 160 changed files with 1,117 additions and 352 deletions.
21 changes: 18 additions & 3 deletions base/common/src/main/java/band/kessoku/lib/api/KessokuLib.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
/*
* 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 band.kessoku.lib.impl.base.KessokuUtils;
import org.jetbrains.annotations.UnmodifiableView;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand All @@ -12,6 +24,9 @@
import java.util.Collections;
import java.util.List;

import band.kessoku.lib.impl.base.KessokuUtils;
import org.jetbrains.annotations.UnmodifiableView;

public final class KessokuLib {
private static final List<Class<?>> initializedModules = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package band.kessoku.lib.impl.base;

import java.lang.reflect.Constructor;
import java.util.*;

import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Constructor;
import java.util.*;

public final class KessokuUtils {
private KessokuUtils() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.base.KessokuBase;

import net.fabricmc.api.ModInitializer;

public final class KessokuBaseFabric implements ModInitializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.base.KessokuBase;

import net.neoforged.fml.common.Mod;

@Mod(KessokuBase.MOD_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.List;
import java.util.Map;

public abstract class KesssokuExtension {
public abstract class KessokuExtension {
@Inject
protected abstract Project getProject();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
import java.util.List;

public final class KessokuGradlePlugin implements Plugin<PluginAware> {
public static final List<String> MODULES = List.of(
"base",
"command",
"config",
"data",
"entity-events",
"entrypoint",
"event-base",
"keybinding",
"lifecycle-events",
"platform",
"registry"
);
private static final List<String> NEO_GROUPS = List.of(
"net.neoforged",
"cpw.mods",
Expand All @@ -28,7 +41,7 @@ public void apply(@NotNull PluginAware target) {
settings.getGradle().getPluginManager().apply(KessokuGradlePlugin.class);
}
case Project project -> {
project.getExtensions().create("kessoku", KesssokuExtension.class);
project.getExtensions().create("kessoku", KessokuExtension.class);

additionalRepositories(project.getRepositories());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

import band.kessoku.lib.event.api.Event;
import com.mojang.brigadier.CommandDispatcher;
import org.jetbrains.annotations.ApiStatus;

import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.NonExtendable
public interface CommandRegistryEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package kessoku.testmod.command;

import band.kessoku.lib.api.events.command.CommandRegistryEvent;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuModInitializer;
import band.kessoku.lib.api.events.command.CommandRegistryEvent;

import net.minecraft.server.command.CommandManager;
import net.minecraft.text.Text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.command.KessokuCommand;

import net.fabricmc.api.ModInitializer;

public final class KessokuCommandFabric implements ModInitializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package band.kessoku.lib.impl.command.fabric;

import band.kessoku.lib.api.events.command.CommandRegistryEvent;

import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;

public final class KessokuCommandImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import band.kessoku.lib.api.events.command.CommandRegistryEvent;
import band.kessoku.lib.event.api.util.neo.NeoEventUtils;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.event.RegisterCommandsEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.command.KessokuCommand;

import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
*/
package band.kessoku.lib.api.config;

import band.kessoku.lib.impl.base.KessokuUtils;
import band.kessoku.lib.api.config.annotations.Comment;
import band.kessoku.lib.api.config.annotations.Comments;
import band.kessoku.lib.api.config.annotations.Name;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.logging.log4j.core.util.ReflectionUtil;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
Expand All @@ -36,6 +26,16 @@
import java.util.function.BiConsumer;
import java.util.function.Consumer;

import band.kessoku.lib.api.config.annotations.Comment;
import band.kessoku.lib.api.config.annotations.Comments;
import band.kessoku.lib.api.config.annotations.Name;
import band.kessoku.lib.impl.base.KessokuUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.logging.log4j.core.util.ReflectionUtil;

@SuppressWarnings({"rawtypes", "unused"})
public abstract class AbstractConfig {
private final List<Consumer<AbstractConfig>> preSave = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
*/
package band.kessoku.lib.api.config;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import org.apache.commons.io.FileUtils;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public final class KessokuConfig {
private static final Map<AbstractConfig, Class<ConfigSerializer>> configs = new HashMap<>();
private static final Map<Class<? extends ConfigSerializer>, ConfigSerializer> serializerCache = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package band.kessoku.lib.api.config.serializers;

import java.util.Map;

import band.kessoku.lib.api.config.AbstractConfig;
import band.kessoku.lib.api.config.ConfigSerializer;
import club.someoneice.json.JSON;
import club.someoneice.json.node.JsonNode;
import club.someoneice.json.processor.Json5Builder;

import java.util.Map;

// TODO
public class Json5Serializer implements ConfigSerializer {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package band.kessoku.lib.api.config.serializers;

import java.util.Map;

import band.kessoku.lib.api.config.AbstractConfig;
import band.kessoku.lib.api.config.ConfigSerializer;
import club.someoneice.json.JSON;
Expand All @@ -23,8 +25,6 @@
import club.someoneice.json.node.MapNode;
import club.someoneice.json.processor.JsonBuilder;

import java.util.Map;

public class JsonSerializer implements ConfigSerializer {
@Override
public String serialize(Map<String, AbstractConfig.ValueWithComment> value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
package band.kessoku.lib.api.config.serializers;

import java.util.Map;

import band.kessoku.lib.api.config.AbstractConfig;
import band.kessoku.lib.api.config.ConfigSerializer;
import com.electronwill.nightconfig.core.CommentedConfig;

import java.util.Map;

//todo
public class TomlSerializer implements ConfigSerializer {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.function.Supplier;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.function.Supplier;

public final class BooleanValue extends DefaultConfigValue<Boolean> {
private BooleanValue(Supplier<Boolean> defaultValue) {
super(defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package band.kessoku.lib.api.config.values;

import band.kessoku.lib.api.config.ConfigValue;

import java.util.function.Supplier;

import band.kessoku.lib.api.config.ConfigValue;

sealed abstract class DefaultConfigValue<T> implements ConfigValue<T, T> permits BooleanValue, DoubleValue, FloatValue, IntegerValue, ListValue, LongValue, MapValue, StringValue {
public final Supplier<T> defaultValue;
public T value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.function.Supplier;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.function.Supplier;

public final class DoubleValue extends DefaultConfigValue<Double> {
private DoubleValue(Supplier<Double> defaultValue) {
super(defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.function.Supplier;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.function.Supplier;

public final class FloatValue extends DefaultConfigValue<Float> {
private FloatValue(Supplier<Float> defaultValue) {
super(defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.function.Supplier;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.function.Supplier;

public final class IntegerValue extends DefaultConfigValue<Integer> {
private IntegerValue(Supplier<Integer> defaultValue) {
super(defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.*;
import java.util.function.Supplier;

import com.google.common.collect.ImmutableList;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;

import java.util.*;
import java.util.function.Supplier;

@SuppressWarnings({"rawtypes"})
public final class ListValue<T> extends DefaultConfigValue<List<T>> implements List<T> {
private ListValue(Supplier<List<T>> defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package band.kessoku.lib.api.config.values;

import java.util.function.Supplier;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.function.Supplier;

public final class LongValue extends DefaultConfigValue<Long> {
private LongValue(Supplier<Long> defaultValue) {
super(defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
*/
package band.kessoku.lib.api.config.values;

import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;

import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;

public final class MapValue<K, V> extends DefaultConfigValue<Map<K, V>> implements Map<K, V> {
private MapValue(Supplier<Map<K, V>> defaultValue) {
super(defaultValue);
Expand Down
Loading

0 comments on commit 69eaa2d

Please sign in to comment.