Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Oct 5, 2024
1 parent 9e480a2 commit ec680c0
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
/*
* 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.event.command;

import band.kessoku.lib.api.util.command.ClientCommandSourceExtension;
import band.kessoku.lib.event.api.Event;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.command.CommandRegistryAccess;
import org.jetbrains.annotations.ApiStatus;

import net.minecraft.command.CommandRegistryAccess;

@ApiStatus.NonExtendable
public interface ClientCommandRegistryEvent {
Event<ClientCommandRegistryEvent> EVENT = Event.of(clientCommandRegistryEvents -> (dispatcher, registryAccess) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* 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.util.command;

import com.mojang.brigadier.arguments.ArgumentType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* 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.util.command;

import net.minecraft.client.MinecraftClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
/*
* 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.util.command;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.command.KessokuCommand;
import band.kessoku.lib.mixin.command.HelpCommandAccessor;
Expand All @@ -15,14 +34,11 @@
import com.mojang.brigadier.exceptions.CommandExceptionType;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.tree.CommandNode;
import org.jetbrains.annotations.Nullable;

import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.text.Texts;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public final class ClientCommandUtils {
private static @Nullable CommandDispatcher<ClientCommandSourceExtension> activeDispatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
/*
* 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.mixin.command;

import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.server.command.HelpCommand;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import net.minecraft.server.command.HelpCommand;

@Mixin(HelpCommand.class)
public interface HelpCommandAccessor {
@Accessor("FAILED_EXCEPTION")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

import band.kessoku.lib.api.event.command.ClientCommandRegistryEvent;
import band.kessoku.lib.api.event.command.CommandRegistryEvent;

import band.kessoku.lib.api.util.command.ClientCommandSourceExtension;
import com.mojang.brigadier.CommandDispatcher;

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

public final class KessokuCommandImpl {
@SuppressWarnings("unchecked")
public static void registerClientEvents() {
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
ClientCommandRegistryEvent.EVENT.invoker().register((CommandDispatcher<ClientCommandSourceExtension>)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
/*
* 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.mixin.command.fabric;

import band.kessoku.lib.api.util.command.ClientCommandSourceExtension;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import org.spongepowered.asm.mixin.Mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.text.Text;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;

import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;

@Mixin(FabricClientCommandSource.class)
public interface FabricClientCommandSourceMixin extends ClientCommandSourceExtension {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
import band.kessoku.lib.api.base.neoforge.NeoEventUtils;
import band.kessoku.lib.api.event.command.ClientCommandRegistryEvent;
import band.kessoku.lib.api.event.command.CommandRegistryEvent;

import band.kessoku.lib.api.util.command.ClientCommandSourceExtension;
import com.mojang.brigadier.CommandDispatcher;

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

public final class KessokuCommandImpl {
@SuppressWarnings("unchecked")
public static void registerClientEvents(IEventBus forgeEventBus) {
NeoEventUtils.registerEvent(forgeEventBus, RegisterClientCommandsEvent.class, event -> {
ClientCommandRegistryEvent.EVENT.invoker().register((CommandDispatcher<ClientCommandSourceExtension>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public KessokuCommandNeoforge() {
var forgeEventBus = NeoForge.EVENT_BUS;
KessokuLib.loadModule(KessokuCommand.class);
KessokuCommandImpl.registerCommonEvents(forgeEventBus);
KessokuCommandImpl.registerClientEvents(forgeEventBus);
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
/*
* 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.mixin.command.neoforge;

import band.kessoku.lib.api.util.command.ClientCommandSourceExtension;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommandSource;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(ClientCommandSource.class)
abstract class ClientCommandSourceMixin implements ClientCommandSourceExtension {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import java.util.function.Consumer;

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.platform.Metadata;
import band.kessoku.lib.api.platform.Loader;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuPreLaunchEntrypoint;
import band.kessoku.lib.api.platform.Loader;
import band.kessoku.lib.api.platform.Metadata;
import band.kessoku.lib.impl.entrypoint.JavaLanguageAdapter;
import band.kessoku.lib.impl.entrypoint.exceptions.LanguageAdapterException;
import club.someoneice.json.JSON;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import band.kessoku.lib.impl.entrypoint.exceptions.KessokuParseException;
import club.someoneice.json.Pair;
import club.someoneice.json.api.exception.NodeCastException;
import club.someoneice.json.node.ArrayNode;
import club.someoneice.json.node.JsonNode;
import club.someoneice.json.node.MapNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import band.kessoku.lib.api.KessokuLib;
import band.kessoku.lib.api.entrypoint.KessokuEntrypoint;

import band.kessoku.lib.api.entrypoint.entrypoints.KessokuClientModInitializer;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuDedicatedServerModInitializer;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuModInitializer;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.api.ModInitializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package band.kessoku.lib.impl.entrypoint.neoforge;

import band.kessoku.lib.api.entrypoint.KessokuEntrypoint;

import band.kessoku.lib.api.entrypoint.entrypoints.KessokuClientModInitializer;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuDedicatedServerModInitializer;
import band.kessoku.lib.api.entrypoint.entrypoints.KessokuModInitializer;

import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.common.Mod;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.Optional;
import java.util.stream.Collectors;

import band.kessoku.lib.api.platform.Metadata;
import band.kessoku.lib.api.platform.DependencyInfo;
import band.kessoku.lib.api.platform.Metadata;

import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.List;
import java.util.Optional;

import band.kessoku.lib.api.platform.Metadata;
import band.kessoku.lib.api.platform.DependencyInfo;
import band.kessoku.lib.api.platform.Metadata;

import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModList;
Expand Down

0 comments on commit ec680c0

Please sign in to comment.