Skip to content

Commit

Permalink
fix: invalid dist on DEDICATED_SERVER (#15) in AllExampleElements
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeBather committed Nov 28, 2024
1 parent b404004 commit 900d2cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/kasuga/lib/example_env/AllExampleElements.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.SoundAction;
import net.minecraftforge.common.SoundActions;
import net.minecraftforge.fml.DistExecutor;

public class AllExampleElements {

Expand Down Expand Up @@ -182,9 +183,7 @@ public class AllExampleElements {
.setHandler(new CommandHandler() {
@Override
public void run() {
RenderSystem.recordRenderCall(()->{
Minecraft.getInstance().setScreen(new GuiOperatingPerspectiveScreen());
});
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, ()->OperateScreenCommand::invoke);
}
})
.submit(REGISTRY);
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/kasuga/lib/example_env/OperateScreenCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kasuga.lib.example_env;

import com.mojang.blaze3d.systems.RenderSystem;
import kasuga.lib.core.client.interaction.GuiOperatingPerspectiveScreen;
import net.minecraft.client.Minecraft;

public class OperateScreenCommand {
public static void invoke(){
RenderSystem.recordRenderCall(()->{
Minecraft.getInstance().setScreen(new GuiOperatingPerspectiveScreen());
});
}
}

0 comments on commit 900d2cd

Please sign in to comment.