-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
513d410
commit fd78dae
Showing
9 changed files
with
366 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
Thumbs.db | ||
|
||
## gradle | ||
/.gradle | ||
.gradle/ | ||
build/ | ||
|
||
## ForgeGradle | ||
|
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 '0.10-SNAPSHOT' | ||
} | ||
|
||
version = "${neat_version}-${build_number}-FABRIC" | ||
|
||
loom { | ||
accessWidenerPath = file("src/main/resources/neat.accesswidener") | ||
|
||
runs { | ||
configureEach { | ||
runDir "../run" | ||
ideConfigGenerated(true) | ||
} | ||
} | ||
|
||
} | ||
|
||
repositories { | ||
maven { | ||
name = "Modmuss" | ||
url = "https://maven.modmuss50.me/" | ||
} | ||
maven { | ||
name = "Ladysnake Libs" | ||
url = 'https://ladysnake.jfrog.io/artifactory/mods' | ||
} | ||
maven { | ||
name = "ParchmentMC" | ||
url = "https://maven.parchmentmc.net/" | ||
} | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${mc_version}" | ||
mappings loom.layered() { | ||
officialMojangMappings() | ||
parchment("org.parchmentmc.data:parchment-1.18.1:2021.12.19@zip") | ||
} | ||
|
||
modImplementation "net.fabricmc:fabric-loader:0.13.3" | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.50.0+1.18.2" | ||
|
||
compileOnly "com.google.code.findbugs:jsr305:3.0.2" | ||
compileOnly project(":Xplat") | ||
|
||
modImplementation "me.zeroeightsix:fiber:0.23.0-2" | ||
include "me.zeroeightsix:fiber:0.23.0-2" | ||
} | ||
|
||
compileJava { | ||
source(project(":Xplat").sourceSets.main.allSource) | ||
options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-serial" << "-Werror" | ||
|
||
} | ||
|
||
sourcesJar { | ||
from project(":Xplat").sourceSets.main.allJava | ||
} | ||
|
||
processResources { | ||
from project(":Xplat").sourceSets.main.resources | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
groupId project.group | ||
artifactId project.archivesBaseName | ||
version project.version | ||
from components.java | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
url "file://" + System.getenv("local_maven") | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Fabric/src/main/java/vazkii/neat/NeatFabricInitializer.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,10 @@ | ||
package vazkii.neat; | ||
|
||
import net.fabricmc.api.ClientModInitializer; | ||
|
||
public class NeatFabricInitializer implements ClientModInitializer { | ||
@Override | ||
public void onInitializeClient() { | ||
NeatFiberConfig.setup(); | ||
} | ||
} |
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,225 @@ | ||
package vazkii.neat; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.io.*; | ||
import java.nio.file.*; | ||
import java.util.List; | ||
|
||
import static io.github.fablabsmc.fablabs.api.fiber.v1.schema.type.derived.ConfigTypes.*; | ||
import static io.github.fablabsmc.fablabs.api.fiber.v1.schema.type.derived.ConfigTypes.STRING; | ||
|
||
import io.github.fablabsmc.fablabs.api.fiber.v1.builder.ConfigTreeBuilder; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.exception.ValueDeserializationException; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.schema.type.derived.ConfigTypes; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.FiberSerialization; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.JanksonValueSerializer; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.tree.ConfigTree; | ||
import io.github.fablabsmc.fablabs.api.fiber.v1.tree.PropertyMirror; | ||
|
||
public final class NeatFiberConfig { | ||
private static final Logger LOGGER = LogManager.getLogger(NeatFiberConfig.class); | ||
|
||
private static void writeDefaultConfig(ConfigTree config, Path path, JanksonValueSerializer serializer) { | ||
try (OutputStream s = new BufferedOutputStream(Files.newOutputStream(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW))) { | ||
FiberSerialization.serialize(config, s, serializer); | ||
} catch (FileAlreadyExistsException ignored) {} catch (IOException e) { | ||
LOGGER.error("Error writing default config", e); | ||
} | ||
} | ||
|
||
private static void setupConfig(ConfigTree config, Path p, JanksonValueSerializer serializer) { | ||
writeDefaultConfig(config, p, serializer); | ||
|
||
try (InputStream s = new BufferedInputStream(Files.newInputStream(p, StandardOpenOption.READ, StandardOpenOption.CREATE))) { | ||
FiberSerialization.deserialize(config, s, serializer); | ||
} catch (IOException | ValueDeserializationException e) { | ||
LOGGER.error("Error loading config from {}", p, e); | ||
} | ||
} | ||
|
||
public static void setup() { | ||
try { | ||
Files.createDirectory(Paths.get("config")); | ||
} catch (FileAlreadyExistsException ignored) {} catch (IOException e) { | ||
LOGGER.warn("Failed to make config dir", e); | ||
} | ||
|
||
JanksonValueSerializer serializer = new JanksonValueSerializer(false); | ||
ConfigTree client = CLIENT.configure(ConfigTree.builder()); | ||
setupConfig(client, Paths.get("config", NeatConfig.MOD_ID + "-client.json5"), serializer); | ||
NeatConfig.instance = CLIENT; | ||
} | ||
|
||
private static class Client implements NeatConfig.ConfigAccess { | ||
private final PropertyMirror<Integer> maxDistance = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Boolean> renderInF1 = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Double> heightAbove = PropertyMirror.create(DOUBLE); | ||
private final PropertyMirror<Boolean> drawBackground = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Integer> backgroundPadding = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Integer> backgroundHeight = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Integer> barHeight = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Integer> plateSize = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Integer> plateSizeBoss = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Boolean> showAttributes = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showArmor = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> groupArmor = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> colorByType = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Integer> hpTextHeight = PropertyMirror.create(INTEGER); | ||
private final PropertyMirror<Boolean> showMaxHP = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showCurrentHP = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showPercentage = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showOnPlayers = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showOnBosses = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showOnlyFocused = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> showFullHealth = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<Boolean> enableDebugInfo = PropertyMirror.create(BOOLEAN); | ||
private final PropertyMirror<List<String>> blacklist = PropertyMirror.create(ConfigTypes.makeList(STRING)); | ||
|
||
public ConfigTree configure(ConfigTreeBuilder builder) { | ||
builder.beginValue("maxDistance", INTEGER, 24).finishValue(maxDistance::mirror) | ||
.beginValue("renderInF1", BOOLEAN, false).finishValue(renderInF1::mirror) | ||
.beginValue("heightAbove", DOUBLE, 0.6).finishValue(heightAbove::mirror) | ||
.beginValue("drawBackground", BOOLEAN, true).finishValue(drawBackground::mirror) | ||
.beginValue("backgroundPadding", INTEGER, 2).finishValue(backgroundPadding::mirror) | ||
.beginValue("backgroundHeight", INTEGER, 6).finishValue(backgroundHeight::mirror) | ||
.beginValue("barHeight", INTEGER, 4).finishValue(barHeight::mirror) | ||
.beginValue("plateSize", INTEGER, 25).finishValue(plateSize::mirror) | ||
.beginValue("plateSizeBoss", INTEGER, 50).finishValue(plateSizeBoss::mirror) | ||
.beginValue("showAttributes", BOOLEAN, true).finishValue(showAttributes::mirror) | ||
.beginValue("showArmor", BOOLEAN, true).finishValue(showArmor::mirror) | ||
.beginValue("groupArmor", BOOLEAN, true).finishValue(groupArmor::mirror) | ||
.beginValue("colorByType", BOOLEAN, false).finishValue(colorByType::mirror) | ||
.beginValue("hpTextHeight", INTEGER, 14).finishValue(hpTextHeight::mirror) | ||
.beginValue("showMaxHP", BOOLEAN, true).finishValue(showMaxHP::mirror) | ||
.beginValue("showCurrentHP", BOOLEAN, true).finishValue(showCurrentHP::mirror) | ||
.beginValue("showPercentage", BOOLEAN, true).finishValue(showPercentage::mirror) | ||
.beginValue("showOnPlayers", BOOLEAN, true).finishValue(showOnPlayers::mirror) | ||
.beginValue("showOnBosses", BOOLEAN, true).finishValue(showOnBosses::mirror) | ||
.beginValue("showOnlyFocused", BOOLEAN, false).finishValue(showOnlyFocused::mirror) | ||
.beginValue("showFullHealth", BOOLEAN, true).finishValue(showFullHealth::mirror) | ||
.beginValue("enableDebugInfo", BOOLEAN, true).finishValue(enableDebugInfo::mirror) | ||
.beginValue("blacklist", ConfigTypes.makeList(STRING), NeatConfig.DEFAULT_DISABLED).finishValue(blacklist::mirror); | ||
|
||
return builder.build(); | ||
} | ||
|
||
@Override | ||
public int maxDistance() { | ||
return maxDistance.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean renderInF1() { | ||
return renderInF1.getValue(); | ||
} | ||
|
||
@Override | ||
public double heightAbove() { | ||
return heightAbove.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean drawBackground() { | ||
return drawBackground.getValue(); | ||
} | ||
|
||
@Override | ||
public int backgroundPadding() { | ||
return backgroundPadding.getValue(); | ||
} | ||
|
||
@Override | ||
public int backgroundHeight() { | ||
return backgroundHeight.getValue(); | ||
} | ||
|
||
@Override | ||
public int barHeight() { | ||
return barHeight.getValue(); | ||
} | ||
|
||
@Override | ||
public int plateSize() { | ||
return plateSize.getValue(); | ||
} | ||
|
||
@Override | ||
public int plateSizeBoss() { | ||
return plateSizeBoss.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showAttributes() { | ||
return showAttributes.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showArmor() { | ||
return showArmor.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean groupArmor() { | ||
return groupArmor.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean colorByType() { | ||
return colorByType.getValue(); | ||
} | ||
|
||
@Override | ||
public int hpTextHeight() { | ||
return hpTextHeight.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showMaxHP() { | ||
return showMaxHP.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showCurrentHP() { | ||
return showCurrentHP.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showPercentage() { | ||
return showPercentage.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showOnPlayers() { | ||
return showOnPlayers.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showOnBosses() { | ||
return showOnBosses.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showOnlyFocused() { | ||
return showOnlyFocused.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean showFullHealth() { | ||
return showFullHealth.getValue(); | ||
} | ||
|
||
@Override | ||
public boolean enableDebugInfo() { | ||
return enableDebugInfo.getValue(); | ||
} | ||
|
||
@Override | ||
public List<String> blacklist() { | ||
return blacklist.getValue(); | ||
} | ||
} | ||
|
||
private static final Client CLIENT = new Client(); | ||
} |
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,36 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "neat", | ||
"version": "${version}", | ||
|
||
"name": "Neat", | ||
"description": "Botania is a tech mod themed around natural magic", | ||
"authors": [ | ||
"Vazkii", | ||
"williewillus", | ||
"Alwinfy" | ||
], | ||
"contact": { | ||
"sources": "https://github.com/VazkiiMods/Neat", | ||
"issues": "https://github.com/VazkiiMods/Neat/issues" | ||
}, | ||
|
||
"license": "MIT AND CC-BY-NC-SA-3.0", | ||
|
||
"environment": "client", | ||
"entrypoints": { | ||
"client": [ | ||
"vazkii.neat.NeatFabricInitializer" | ||
] | ||
}, | ||
"mixins": [ | ||
"neat.mixins.json" | ||
], | ||
"accessWidener": "neat.accesswidener", | ||
|
||
"depends": { | ||
"fabricloader": ">=0.12", | ||
"fabric": ">=0.50", | ||
"minecraft": ">=1.18.2" | ||
} | ||
} |
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,3 @@ | ||
accessWidener v1 named | ||
accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType | ||
accessible class net/minecraft/client/renderer/RenderType$CompositeState |
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
Oops, something went wrong.