-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Messy 1.20.4, needs to be cleaned and tested
- Loading branch information
Showing
60 changed files
with
2,028 additions
and
81 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
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# gradle | ||
|
||
.gradle/ | ||
build/ | ||
out/ | ||
classes/ | ||
|
||
# eclipse | ||
|
||
*.launch | ||
|
||
# idea | ||
|
||
.idea/ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# vscode | ||
|
||
.settings/ | ||
.vscode/ | ||
bin/ | ||
.classpath | ||
.project | ||
|
||
# macos | ||
|
||
*.DS_Store | ||
|
||
# fabric | ||
|
||
run/ |
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,85 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.3-SNAPSHOT' | ||
id 'maven-publish' | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
|
||
archivesBaseName = gradle.ext.fabricname | ||
version = gradle.ext.modversion | ||
group = gradle.ext.fabricgroup | ||
|
||
repositories { | ||
// Add repositories to retrieve artifacts from in here. | ||
// You should only use this when depending on other mods because | ||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html | ||
// for more information about repositories. | ||
} | ||
|
||
loom { | ||
runs { | ||
client { | ||
runDir = "../run" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
// To change the versions see the gradle.properties file | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
|
||
// Fabric API. This is technically optional, but you probably want it anyway. | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
// Uncomment the following line to enable the deprecated Fabric API modules. | ||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. | ||
|
||
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17. | ||
it.options.release = 17 | ||
} | ||
|
||
java { | ||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this line, sources will not be generated. | ||
withSourcesJar() | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
// Notice: This block does NOT have the same function as the block in the top level. | ||
// The repositories here will be used for publishing your artifact, not for | ||
// retrieving dependencies. | ||
} | ||
} |
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,11 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
# Fabric Properties | ||
# check these on https://fabricmc.net/develop | ||
minecraft_version=1.20.4 | ||
yarn_mappings=1.20.4+build.3 | ||
loader_version=0.15.3 | ||
|
||
# Dependencies | ||
fabric_version=0.91.3+1.20.4 |
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,10 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
fabric1.20.4/src/main/java/brentmaas/buildguide/fabric/BuildGuideFabric.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,19 @@ | ||
package brentmaas.buildguide.fabric; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import brentmaas.buildguide.common.BuildGuide; | ||
import brentmaas.buildguide.fabric.screen.ScreenHandler; | ||
import brentmaas.buildguide.fabric.screen.widget.WidgetHandler; | ||
import brentmaas.buildguide.fabric.shape.ShapeHandler; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
|
||
public class BuildGuideFabric implements ClientModInitializer { | ||
private static final Logger logger = LogManager.getLogger(); | ||
|
||
public void onInitializeClient() { | ||
BuildGuide.register(new InputHandler(), new ScreenHandler(), new WidgetHandler(), new StateManager(), new ShapeHandler(), new RenderHandler(), new LogHandler(logger), FabricLoader.getInstance().getConfigDir().toString() + "/"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
fabric1.20.4/src/main/java/brentmaas/buildguide/fabric/InputHandler.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,34 @@ | ||
package brentmaas.buildguide.fabric; | ||
|
||
import brentmaas.buildguide.common.AbstractInputHandler; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.option.KeyBinding; | ||
import net.minecraft.client.util.InputUtil; | ||
|
||
public class InputHandler extends AbstractInputHandler { | ||
public IKeyBind registerKeyBind(String name, int keyCode) { | ||
return new KeyBindImpl(name, keyCode); | ||
} | ||
|
||
public void registerOnKeyInput() { | ||
ClientTickEvents.END_CLIENT_TICK.register(this::onKeyInputProxy); | ||
} | ||
|
||
public void onKeyInputProxy(MinecraftClient client) { | ||
onKeyInput(); | ||
} | ||
|
||
public class KeyBindImpl implements IKeyBind { | ||
private KeyBinding bind; | ||
|
||
public KeyBindImpl(String name, int keyCode) { | ||
bind = KeyBindingHelper.registerKeyBinding(new KeyBinding(name, InputUtil.Type.KEYSYM, keyCode, category)); | ||
} | ||
|
||
public boolean isDown() { | ||
return bind.wasPressed(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
fabric1.20.4/src/main/java/brentmaas/buildguide/fabric/LogHandler.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,35 @@ | ||
package brentmaas.buildguide.fabric; | ||
|
||
import org.apache.logging.log4j.Level; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.logging.log4j.spi.StandardLevel; | ||
|
||
import brentmaas.buildguide.common.ILogHandler; | ||
|
||
public class LogHandler implements ILogHandler { | ||
private Logger logger; | ||
|
||
public LogHandler(Logger logger) { | ||
this.logger = logger; | ||
} | ||
|
||
public void fatal(String message) { | ||
logger.fatal(message); | ||
} | ||
|
||
public void error(String message) { | ||
logger.error(message); | ||
} | ||
|
||
public void errorOrHigher(String message) { | ||
logger.log(logger.getLevel().intLevel() >= StandardLevel.ERROR.intLevel() ? Level.ERROR : logger.getLevel(), message); | ||
} | ||
|
||
public void debugOrHigher(String message) { | ||
logger.log(logger.getLevel().intLevel() >= StandardLevel.DEBUG.intLevel() ? Level.DEBUG : logger.getLevel(), message); | ||
} | ||
|
||
public void debugThrowable(String message, Throwable throwable) { | ||
logger.debug(message, throwable); | ||
} | ||
} |
Oops, something went wrong.