Skip to content

Commit

Permalink
Update buildscript
Browse files Browse the repository at this point in the history
  • Loading branch information
pastimee committed May 16, 2023
1 parent a3d47a4 commit f159dc0
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 99 deletions.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 changes: 11 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
loom {
accessWidenerPath = file("src/main/resources/caspian.accesswidener")
}

repositories {
maven {
url "https://jitpack.io"
}
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

loom {
accessWidenerPath = file("src/main/resources/caspian.accesswidener")
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.
// fabric_version}"
}

processResources {
Expand All @@ -32,6 +35,7 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

Expand All @@ -41,7 +45,7 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}-${project.archivesBaseName}"}
}
}

Expand All @@ -51,7 +55,6 @@ publishing {
from components.java
}
}

// https://docs.gradle.org/current/userguide/publishing_maven.html
repositories {

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx2G
minecraft_version = 1.19.4
yarn_version = 1.19.4+build.1
loader_version = 0.14.17
mod_version = 1.0
mod_version = 1.0-a1
maven_group = com.caspian
archives_base_name = caspian
fabric_version = 0.75.3+1.19.4
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
8 changes: 7 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand All @@ -231,4 +237,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
16 changes: 9 additions & 7 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,15 +75,17 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
}
}
}

include "launch"
3 changes: 0 additions & 3 deletions src/main/java/com/caspian/Caspian.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ public class Caspian
{
// Client logger.
public static Logger LOGGER;

// Client Event handler (aka Event bus) which handles event dispatching
// and listening for client events.
public static EventHandler EVENT_HANDLER;

// Client configuration handler. This master saves/loads the client
// configuration files which have been saved locally.
public static ClientConfiguration CONFIG;

// Client shutdown hooks which will run once when the MinecraftClient
// game instance is shutdown.
public static ShutdownHook SHUTDOWN;
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/com/caspian/CaspianMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,26 @@
*/
public class CaspianMod implements ModInitializer
{
// mod identifier
// Mod identifier
public static final String MOD_ID = "caspian";

// mod name
// Mod name
public static final String MOD_NAME = "Caspian";

// mod version
// Mod version
// UPDATE BEFORE RELEASE
public static final String MOD_VER = "1.0-a1";

// mod mc version
// Mod mc version
public static final String MOD_MC_VER = "1.19.4";

/**
* Called when the fabric mod initializes
* This code runs as soon as Minecraft is in a mod-load-ready state.
* However, some things (like resources) may still be uninitialized.
* Proceed with mild caution.
*/
@Override
public void onInitialize()
{
Caspian.preInit();
Caspian.init();
Caspian.postInit();
// Caspian.preInit();
// Caspian.init();
// Caspian.postInit();
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/caspian/api/command/arg/Argument.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public abstract class Argument<T>
// The literal string input of the user which will be updated every key
// press. If the input is null, the argument is left blank.
private String literal;

// The value of the argument. This value is only calculated when the
// command is run.
private T value;
Expand All @@ -44,11 +43,21 @@ public void autoComplete()
}
}

/**
*
*
* @return
*/
public String getLiteral()
{
return literal;
}

/**
*
*
* @return
*/
public T getValue()
{
return value;
Expand Down
29 changes: 22 additions & 7 deletions src/main/java/com/caspian/api/config/setting/NumberConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class NumberConfig<T extends Number> extends Config<T>
// Value min and max bounds. If the current value exceeds these bounds,
// then {@link #setValue(Number)} will clamp the value to the bounds.
private final T min, max;

// Number display format. Used to determine the format of the number in
// the ClickGui when displaying the value.
private final NumberDisplay format;
Expand Down Expand Up @@ -85,11 +84,21 @@ public int getRoundingScale()
return strValue.substring(strValue.indexOf(".") + 1).length();
}

/**
*
*
* @return
*/
public NumberDisplay getFormat()
{
return format;
}

/**
*
*
* @param val The param value
*/
@Override
public void setValue(T val)
{
Expand All @@ -98,41 +107,47 @@ public void setValue(T val)
{
super.setValue(min);
}

else if (val.doubleValue() > max.doubleValue())
{
super.setValue(min);
}

// inbounds
else
{
super.setValue(val);
}
}

/**
*
*
* @return
*/
@Override
public JsonObject toJson()
{
return new JsonPrimitive(getValue()).getAsJsonObject();
}

/**
*
*
* @param jsonObj The data as a json object
*/
@Override
public void fromJson(JsonObject jsonObj)
{
// get config as number
if (getValue() instanceof Integer)
{
Integer val = jsonObj.getAsInt();
Integer val = (Integer) jsonObj.getAsInt();
setValue((T) val);
}

else if (getValue() instanceof Float)
{
Float val = jsonObj.getAsFloat();
Float val = (Float) jsonObj.getAsFloat();
setValue((T) val);
}

else if (getValue() instanceof Double)
{
Double val = (Double) jsonObj.getAsDouble();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/caspian/api/file/ConfigFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ public Path getFilepath()
}

/**
*
* Saves the configuration to a <tt>.json</tt> file in the local
* <tt>Caspian</tt> directory
*/
public abstract void save();

/**
*
* Loads the configuration from the associated <tt>.json</tt> file
*/
public abstract void load();
}
2 changes: 1 addition & 1 deletion src/main/java/com/caspian/api/render/shader/Shader.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Shader(String vertex, String fragment)
{
try
{
String resourcePath = "/assets/shader/";
String resourcePath = "/assets/caspian/shader/";
InputStream vertStream =
getClass().getResourceAsStream(resourcePath + vertex);
InputStream fragStream =
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/caspian/api/waypoint/Waypoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ public class Waypoint extends ConfigContainer
{
//
private final String ip;

//
private final Config<Double> xConfig = new NumberConfig<>("X", "X " +
"position of waypoint.", 0.0D, 0.0D, Double.MAX_VALUE);
private final Config<Double> yConfig = new NumberConfig<>("Y", "Y " +
"position of waypoint.", 0.0D, 0.0D, Double.MAX_VALUE);
private final Config<Double> zConfig = new NumberConfig<>("Z", "Z " +
"position of waypoint.", 0.0D, 0.0D, Double.MAX_VALUE);

//
private final Timer timer;

Expand Down
Loading

0 comments on commit f159dc0

Please sign in to comment.