Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
RawDiamondMC committed Aug 4, 2024
1 parent 6dba1b0 commit 6d0fa7a
Show file tree
Hide file tree
Showing 28 changed files with 72 additions and 38 deletions.
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias libs.plugins.loom apply false
alias libs.plugins.architectury
alias libs.plugins.shadow apply false
alias libs.plugins.spotless apply false
}

architectury {
Expand All @@ -11,8 +12,11 @@ architectury {
subprojects {
apply plugin: 'dev.architectury.loom'
apply plugin: 'architectury-plugin'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'maven-publish'

assemble.dependsOn spotlessApply

repositories {
maven { url "https://maven.neoforged.net/releases/" }
}
Expand All @@ -33,6 +37,15 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_21
}

spotless {
java {
importOrder('java|javax', '', 'net.minecraft', 'net.fabricmc|net.neoforged')
removeUnusedImports()
indentWithSpaces()
trimTrailingWhitespace()
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import band.kessoku.lib.event.api.Event;
import com.mojang.brigadier.CommandDispatcher;

import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.command;

import band.kessoku.lib.command.impl.KessokuCommandImpl;

import net.fabricmc.api.ModInitializer;

public class KessokuCommandEntrypoint implements ModInitializer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.command.impl;

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

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

public class KessokuCommandImpl {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.command;

import band.kessoku.lib.command.impl.KessokuCommandImpl;

import net.neoforged.bus.api.IEventBus;
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 @@ -2,6 +2,7 @@

import band.kessoku.lib.command.api.events.CommandRegistryEvent;
import band.kessoku.lib.event.util.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
@@ -1,14 +1,14 @@
package band.kessoku.lib.event;

import band.kessoku.lib.event.api.Event;
import band.kessoku.lib.event.api.EventPhase;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import band.kessoku.lib.event.api.Event;
import band.kessoku.lib.event.api.EventPhase;

public class EventImpl<T> implements Event<T> {

private Map<EventPhase, List<T>> listeners = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package band.kessoku.lib.event.api;

import band.kessoku.lib.event.EventImpl;

import java.util.List;
import java.util.function.Function;

import band.kessoku.lib.event.EventImpl;

public interface Event<T> {

T invoker();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package band.kessoku.lib.event.util;

import java.util.function.Consumer;

import net.neoforged.bus.api.Event;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.IEventBus;

import java.util.function.Consumer;

public class NeoEventUtils {
public static <T extends Event> void registerEvent(IEventBus eventBus, Class<T> eventClass, Consumer<T> consumer) {
eventBus.addListener(EventPriority.HIGHEST, eventClass, consumer);
Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ yarn = "1.21+build.9"
yarn-mappings-patch-neoforge = "1.21+build.4"

# Loaders
neo = "21.0.148"
neo = "21.0.151"
fabric-loader = "0.16.0"

# Mods
Expand All @@ -24,4 +24,5 @@ fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.r
[plugins]
loom = { id = "dev.architectury.loom", version = "1.7-SNAPSHOT" }
architectury = { id = "architectury-plugin", version = "3.4-SNAPSHOT" }
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle.api;

import band.kessoku.lib.event.api.Event;

import net.minecraft.registry.DynamicRegistryManager;

public final class LifecycleEvents {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle.api.server;

import band.kessoku.lib.event.api.Event;

import net.minecraft.resource.LifecycledResourceManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle.api.server;

import band.kessoku.lib.event.api.Event;

import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle.api.server;

import band.kessoku.lib.event.api.Event;

import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle;

import band.kessoku.lib.events.lifecycle.impl.KessokuLifecycleEventsImpl;

import net.fabricmc.api.ModInitializer;

public class KessokuLifecycleEventsEntrypoint implements ModInitializer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle.impl;

import band.kessoku.lib.events.lifecycle.api.LifecycleEvents;

import net.fabricmc.fabric.api.event.lifecycle.v1.CommonLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.events.lifecycle;

import band.kessoku.lib.events.lifecycle.impl.KessokuLifecycleEventsImpl;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import band.kessoku.lib.events.lifecycle.api.server.ServerLifecycleEvents;
import band.kessoku.lib.events.lifecycle.api.server.ServerTickEvents;
import band.kessoku.lib.events.lifecycle.api.server.ServerWorldEvents;

import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;

import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.event.OnDatapackSyncEvent;
import net.neoforged.neoforge.event.TagsUpdatedEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package band.kessoku.lib.platform.api;

import band.kessoku.lib.platform.impl.KessokuPlatformServices;

import java.nio.file.Path;
import java.util.Collection;

import band.kessoku.lib.platform.impl.KessokuPlatformServices;

public interface ModLoader {
static ModLoader getInstance() {
return KessokuPlatformServices.getModLoader();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package band.kessoku.lib.platform.impl;

import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import band.kessoku.lib.platform.api.ModData;
import band.kessoku.lib.platform.api.ModDependencyInfo;

import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.fabricmc.loader.api.metadata.Person;

import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class ModDataImpl implements ModData {
private final ModContainer modContainer;
private final ModMetadata modMetadata;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.platform.impl;

import band.kessoku.lib.platform.api.ModDependencyInfo;

import net.fabricmc.loader.api.metadata.ModDependency;

public class ModDependencyInfoImpl implements ModDependencyInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package band.kessoku.lib.platform.impl;

import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import band.kessoku.lib.platform.api.Env;
import band.kessoku.lib.platform.api.ModData;
import band.kessoku.lib.platform.api.ModLoader;
import com.google.auto.service.AutoService;

import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;

import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@AutoService(ModLoader.class)
public class ModLoaderImpl implements ModLoader {
private final Map<String, ModData> modDataMap = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package band.kessoku.lib.platform.impl;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;

import band.kessoku.lib.platform.api.ModData;
import band.kessoku.lib.platform.api.ModDependencyInfo;

import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModList;
import net.neoforged.fml.loading.moddiscovery.ModFileInfo;
import net.neoforged.neoforgespi.language.IModFileInfo;
import net.neoforged.neoforgespi.language.IModInfo;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Collectors;

public class ModDataImpl implements ModData {
private final ModContainer modContainer;
private final IModInfo modInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.platform.impl;

import band.kessoku.lib.platform.api.ModDependencyInfo;

import net.neoforged.neoforgespi.language.IModInfo;

public class ModDependencyInfoImpl implements ModDependencyInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package band.kessoku.lib.platform.impl;

import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import band.kessoku.lib.platform.api.Env;
import band.kessoku.lib.platform.api.ModData;
import band.kessoku.lib.platform.api.ModLoader;
import com.google.auto.service.AutoService;
import net.minecraft.MinecraftVersion;

import net.neoforged.fml.ModList;
import net.neoforged.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforgespi.language.IModInfo;

import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@AutoService(ModLoader.class)
public class ModLoaderImpl implements ModLoader {
private final Map<String, ModData> modDataMap = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package band.kessoku.lib.registry.api;

import band.kessoku.lib.registry.impl.KessokuRegistryServices;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import band.kessoku.lib.registry.api.Registry;
import com.google.auto.service.AutoService;

import net.minecraft.util.Identifier;

@AutoService(Registry.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package band.kessoku.lib.registry.impl;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

import band.kessoku.lib.registry.KessokuRegistry;
import band.kessoku.lib.registry.api.Registry;
import com.google.auto.service.AutoService;

import net.minecraft.util.Identifier;

import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.registries.RegisterEvent;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

@AutoService(Registry.class)
@EventBusSubscriber(modid = KessokuRegistry.MOD_ID)
@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 6d0fa7a

Please sign in to comment.