1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-01 06:03:00 +00:00

Use client-side commands for opening computer folders

Forge doesn't run client-side commands from sendUnsignedCommand, so we
still require a mixin there.

We do need to change the command name, as Fabric doesn't properly merge
the two command trees.
This commit is contained in:
Jonathan Coates
2024-01-30 22:00:36 +00:00
parent f284328656
commit 27c72a4571
11 changed files with 83 additions and 67 deletions

View File

@@ -16,6 +16,8 @@ import dan200.computercraft.shared.peripheral.modem.wired.CableBlock;
import dan200.computercraft.shared.platform.FabricConfigFile;
import dan200.computercraft.shared.platform.FabricMessageType;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.model.loading.v1.PreparableModelLoadingPlugin;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
@@ -81,6 +83,10 @@ public class ComputerCraftClient {
return cable.getCloneItemStack(state, hit, level, pos, player);
});
ClientCommandRegistrationCallback.EVENT.register(
(dispatcher, registryAccess) -> ClientRegistry.registerClientCommands(dispatcher, FabricClientCommandSource::sendError)
);
((FabricConfigFile) ConfigSpec.clientSpec).load(FabricLoader.getInstance().getConfigDir().resolve(ComputerCraftAPI.MOD_ID + "-client.toml"));
}
}

View File

@@ -38,10 +38,6 @@
},
"mixins": [
"computercraft.fabric.mixins.json",
{
"config": "computercraft-client.mixins.json",
"environment": "client"
},
{
"config": "computercraft-client.fabric.mixins.json",
"environment": "client"