class file for net.minecraft.client.gui.screen.Screen not found
AnonymeUSB opened this issue · 1 comments
Hi, I'm new to fabric development (honestly, I'm rubbish at it), particularly with owo-lib. I'm currently encountering a problem, here are my steps:
-
I've created a ui package, with a class of the same name.
-
I copied and pasted the base code: https://docs.wispforest.io/owo/ui/getting-started/#fn:1
I get 2 errors:
-
class file for net.minecraft.client.gui.screen.Screen not found
-
class file for net.minecraft.client.gui.Element not found
Note that net.minecraft.client.gui contains only one class (see screenshot).
My code (ui.java) :
package fr.partyhost.liminalx.ui;
import io.wispforest.owo.ui.base.BaseOwoScreen;
import io.wispforest.owo.ui.container.Containers;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.OwoUIAdapter;
import org.jetbrains.annotations.NotNull;
public class ui {
public class MyFirstScreen extends BaseOwoScreen<FlowLayout> {
@Override
protected @NotNull OwoUIAdapter<FlowLayout> createAdapter() {
return OwoUIAdapter.create(this, Containers::verticalFlow);
}
@Override
protected void build(FlowLayout rootComponent) {
// TODO
}
}
}
PS : If I solve the bug, how to open the gui when a key pressed ?? ( I realy say I am rubbish )
Your problem is most likely caused by the fact that your project is set up to use split source sets - that is, you have one set of source files for client-only code and one for common code. Your screen class is in the common source set, which does not have access to client-only classes (this is on purpose, to stop you from crashing servers).
Moving your screen class to the client source set should make the required classes appear. To open the screen you have many options - you could, for example, make a keybind
Cheers