#Which versions of libraries are needed so that there are no problems with imports

14 messages · Page 1 of 1 (latest)

dense glen
#

Hello, how can I solve this problem what I want to achieve: I want a client version of the mod that will view the contents of the chat and, with a certain message, send a put request to a certain ip specified in the mod configuration via ClothConfig and ModMenu

Ubuntu 24
VSCode

╰─ ./gradlew build  


> Configure project :
Fabric Loom: 1.7.3
Previous process has disowned the lock due to abrupt termination.
Found existing cache lock file (ACQUIRED_PREVIOUS_OWNER_DISOWNED), rebuilding loom cache. This may have been caused by a failed or canceled build.
:remapping 53 mods from modImplementation (java-api)
:remapping 53 mods from modImplementation (java-runtime)

> Task :compileJava FAILED
/mnt/Programming/Projects/UAProject/MoonMod/src/main/java/com/example/ExampleMod.java:6: error: package net.fabricmc.fabric.api.client.networking.v1 does not exist
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
                                                   ^
/mnt/Programming/Projects/UAProject/MoonMod/src/main/java/com/example/ExampleMod.java:8: error: cannot find symbol
import net.minecraft.network.message.ChatMessageType;
                                    ^
  symbol:   class ChatMessageType
  location: package net.minecraft.network.message
/mnt/Programming/Projects/UAProject/MoonMod/src/main/java/com/example/ExampleMod.java:30: error: cannot find symbol
    private void onChatMessage(Text message, ChatMessageType type, UUID sender) {
                                             ^
  symbol:   class ChatMessageType
  location: class ExampleMod
/mnt/Programming/Projects/UAProject/MoonMod/src/main/java/com/example/ModMenuIntegration.java:6: error: package net.minecraft.client.gui.screen does not exist
import net.minecraft.client.gui.screen.Screen;
                                      ^
4 errors

FAILURE: Build failed with an exception.

I've never written using Gradle before and I haven't written mods so please don't beat me with sticks

fallen ibex
#

!!splitsources

ember ingotBOT
#
Split Sources

Split Sources provide a compile-time guarantee against calling client only Minecraft code or client only API on the server.

Client-only code can be placed in client, and code that is common to client and server can be placed in main. Client-only code can refer code in main, but not the other way.

Read more: Split Client and Common code - Fabric Loom

dense glen
# fallen ibex !!splitsources

I understand correctly that this is a solution in case I have a problem with a combination of server and client parts of the code?

fallen ibex
#

it's not a solution. it's how the project is structured

#

you need to adapt your code

dense glen
#

I just need only the client part of the mod without the server part

fallen ibex
#

then move your code to the client source set

dense glen
#

I wish I could understand how to do it all correctly...

fallen ibex
#

or don't use split sources and explicitly mark your mod as client only

dense glen
#

How can I do this?

#

Sorry for possibly stupid questions, but I barely understood Gradle and mods

dense glen
fallen ibex
#

simply doing that isn't sufficient. you need to remove split sources config from gradle