-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open a SmyLib screen on Fabric 1.20.1
Nothing renders and inputs aren't processed, but that's already something.
- Loading branch information
Showing
18 changed files
with
638 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
fabric/src/main/java/net/smyler/terramap/mixins/ShowTestScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.smyler.terramap.mixins; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.gui.screens.TitleScreen; | ||
import net.smyler.smylib.gui.screen.TestScreen; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import static net.smyler.smylib.SmyLib.getGameClient; | ||
|
||
@Mixin(Minecraft.class) | ||
public class ShowTestScreenMixin { | ||
|
||
@Inject(method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD"), cancellable = true) | ||
private void onSetScreen(Screen screen, CallbackInfo ci) { | ||
if (screen instanceof TitleScreen) { | ||
getGameClient().displayScreen(new TestScreen(null)); | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
rootProject.name = 'Terramap' | ||
|
||
include 'core' | ||
//include "forge" | ||
include 'fabric' | ||
include 'smylib' | ||
include 'smylib:core' | ||
findProject(':smylib:core')?.name = 'core' | ||
//findProject(':smylib:core')?.name = 'core' | ||
//include 'smylib:forge' | ||
//findProject(':smylib:forge')?.name = 'forge' | ||
include 'smylib:fabric' | ||
//findProject(':smylib:fabric')?.name = 'fabric' | ||
include 'smylib:testing' | ||
findProject(':smylib:testing')?.name = 'testing' | ||
include 'fabric' | ||
//findProject(':smylib:testing')?.name = 'testing' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# IDE | ||
.idea | ||
eclipse | ||
.classpath | ||
.location | ||
.project | ||
0.tree | ||
.settings | ||
|
||
# Run files | ||
run/* | ||
|
||
# Build files | ||
build/* | ||
out/* | ||
.gradle/* | ||
*.launch | ||
*.xcf | ||
|
||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
*.log.gz | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
# *.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
/bin/ | ||
/.gradle/ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.6-SNAPSHOT' | ||
} | ||
|
||
dependencies { | ||
implementation project(":smylib:core") | ||
testImplementation project(":smylib:testing") | ||
|
||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings loom.officialMojangMappings() | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
} |
49 changes: 49 additions & 0 deletions
49
smylib/fabric/src/main/java/net/smyler/smylib/game/Lwjgl3Mouse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package net.smyler.smylib.game; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.MouseHandler; | ||
|
||
public class Lwjgl3Mouse implements Mouse { | ||
|
||
private final Minecraft vanilla; | ||
|
||
public Lwjgl3Mouse(Minecraft vanilla) { | ||
this.vanilla = vanilla; | ||
} | ||
|
||
@Override | ||
public float x() { | ||
return (float) this.vanilla.mouseHandler.xpos(); | ||
} | ||
|
||
@Override | ||
public float y() { | ||
return (float) this.vanilla.mouseHandler.ypos(); | ||
} | ||
|
||
@Override | ||
public int getButtonCount() { | ||
return 3; //FIXME Hard-coded mouse button count | ||
} | ||
|
||
@Override | ||
public boolean hasWheel() { | ||
return false; //FIXME hard-coded mouse wheel | ||
} | ||
|
||
@Override | ||
public boolean isButtonPressed(int button) throws IllegalArgumentException { | ||
return false; //FIXME hard-coded mouse is button pressed | ||
} | ||
|
||
@Override | ||
public String getButtonName(int button) throws IllegalArgumentException { | ||
return "Mouse button"; //FIXME hard-coded mouse get button name | ||
} | ||
|
||
@Override | ||
public int getButtonByName(String name) throws IllegalArgumentException { | ||
return 0; //FIXME hard-coded mouse get button by name | ||
} | ||
|
||
} |
Oops, something went wrong.