Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d28ba934eb | |||
| 77628be954 | |||
| 7f478b9ad6 | |||
| 76ed28afeb | |||
| bd74bce522 | |||
| e421b1a5a0 | |||
| f9c0411e59 | |||
| f4f4337b39 | |||
| 9a6daaf25a |
47
build.gradle
47
build.gradle
@@ -10,11 +10,24 @@ base {
|
||||
archivesName = project.archives_base_name
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://maven.terraformersmc.com/"
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.kasetoatz.com/"
|
||||
}
|
||||
}
|
||||
|
||||
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}"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modImplementation "com.kasetoatz:dacl:${project.dacl_version}"
|
||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -26,12 +39,17 @@ processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version,
|
||||
"minecraft_version": project.minecraft_version,
|
||||
"loader_version": project.loader_version
|
||||
"loader_version": project.loader_version,
|
||||
"dacl_version": project.dacl_version
|
||||
}
|
||||
}
|
||||
|
||||
def targetJavaVersion = 21
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
// If Javadoc is generated, this must be specified in that task too.
|
||||
it.options.encoding = "UTF-8"
|
||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||
it.options.release.set(targetJavaVersion)
|
||||
@@ -43,5 +61,32 @@ java {
|
||||
if (JavaVersion.current() < javaVersion) {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||
}
|
||||
// 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 {
|
||||
create("mavenJava", MavenPublication) {
|
||||
artifactId = project.archives_base_name
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.21.11
|
||||
yarn_mappings=1.21.11+build.2
|
||||
loader_version=0.18.2
|
||||
loom_version=1.14-SNAPSHOT
|
||||
minecraft_version=1.21.10
|
||||
yarn_mappings=1.21.10+build.2
|
||||
loader_version=0.17.3
|
||||
loom_version=1.13-SNAPSHOT
|
||||
# Mod Properties
|
||||
mod_version=1.3
|
||||
maven_group=com.kasetoatz
|
||||
archives_base_name=fastghast
|
||||
# Dependencies
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_version=0.139.5+1.21.11
|
||||
fabric_version=0.136.0+1.21.10
|
||||
modmenu_version=16.0.0-rc.1
|
||||
dacl_version=1.2
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
package com.kasetoatz.fastghast;
|
||||
|
||||
import com.kasetoatz.dacl.DumbassConfig;
|
||||
import com.kasetoatz.dacl.options.FloatOption;
|
||||
import com.kasetoatz.dacl.options.validators.RangeValidator;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.minecraft.entity.Leashable;
|
||||
import net.minecraft.entity.passive.HappyGhastEntity;
|
||||
import net.minecraft.network.packet.s2c.play.PositionFlag;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static com.kasetoatz.fastghast.config.Config.load;
|
||||
|
||||
public class FastGhast implements ModInitializer
|
||||
public class Fastghast implements ModInitializer
|
||||
{
|
||||
public static final FloatOption UNMOUNTED_SPEED = new FloatOption(Text.translatable("fastghast.speed.unmounted"), "unmounted-speed", 0.05F, new RangeValidator<>(0.F, null));
|
||||
public static final FloatOption MOUNTED_SPEED = new FloatOption(Text.translatable("fastghast.speed.mounted"), "mounted-speed", 0.15F, new RangeValidator<>(0.F, null));
|
||||
public static final DumbassConfig CONFIG = DumbassConfig.builder(Text.translatable("fastghast.config.title"), "fastghast.json")
|
||||
.withOption(UNMOUNTED_SPEED)
|
||||
.withOption(MOUNTED_SPEED)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public void onInitialize()
|
||||
{
|
||||
load();
|
||||
ServerTickEvents.END_SERVER_TICK.register((server) -> server.getWorlds().forEach(world -> world.iterateEntities().forEach(entity -> {
|
||||
if (entity instanceof Leashable leashed && leashed.isLeashed() && leashed.getLeashHolder() instanceof HappyGhastEntity ghast && leashed.getDistanceToCenter(ghast) > 8)
|
||||
{
|
||||
|
||||
@@ -1,62 +1,15 @@
|
||||
package com.kasetoatz.fastghast.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import static com.kasetoatz.fastghast.Fastghast.CONFIG;
|
||||
|
||||
public class Config
|
||||
public class Config implements ModMenuApi
|
||||
{
|
||||
public static double UNMOUNTED_SPEED = 0.05;
|
||||
public static double MOUNTED_SPEED = 0.15;
|
||||
|
||||
private static final Path FILE = FabricLoader.getInstance().getConfigDir().resolve("fastghast.json");
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static void load() {
|
||||
if (!Files.exists(FILE))
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory()
|
||||
{
|
||||
save();
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
String json = Files.readString(FILE);
|
||||
JsonObject data = GSON.fromJson(json, JsonObject.class);
|
||||
if (data.has("unmounted-speed"))
|
||||
{
|
||||
UNMOUNTED_SPEED = data.get("unmounted-speed").getAsDouble();
|
||||
}
|
||||
if (data.has("mounted-speed"))
|
||||
{
|
||||
MOUNTED_SPEED = data.get("mounted-speed").getAsDouble();
|
||||
}
|
||||
save();
|
||||
}
|
||||
catch (IOException exc)
|
||||
{
|
||||
throw new CrashException(CrashReport.create(exc, "Loading config file."));
|
||||
}
|
||||
}
|
||||
|
||||
private static void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
JsonObject data = new JsonObject();
|
||||
data.addProperty("unmounted-speed", UNMOUNTED_SPEED);
|
||||
data.addProperty("mounted-speed", MOUNTED_SPEED);
|
||||
Files.writeString(FILE, GSON.toJson(data));
|
||||
}
|
||||
catch (IOException exc)
|
||||
{
|
||||
throw new CrashException(CrashReport.create(exc, "Saving config file."));
|
||||
}
|
||||
return CONFIG::getUI;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import static com.kasetoatz.fastghast.config.Config.MOUNTED_SPEED;
|
||||
import static com.kasetoatz.fastghast.config.Config.UNMOUNTED_SPEED;
|
||||
import static com.kasetoatz.fastghast.Fastghast.MOUNTED_SPEED;
|
||||
import static com.kasetoatz.fastghast.Fastghast.UNMOUNTED_SPEED;
|
||||
|
||||
@Mixin(HappyGhastEntity.class)
|
||||
public abstract class HappyGhastMixin
|
||||
@@ -22,6 +22,6 @@ public abstract class HappyGhastMixin
|
||||
@Redirect(method="travel", at=@At(value="INVOKE", target="Lnet/minecraft/entity/passive/HappyGhastEntity;getAttributeValue(Lnet/minecraft/registry/entry/RegistryEntry;)D"))
|
||||
public double speed(HappyGhastEntity instance, RegistryEntry<EntityAttribute> registryEntry)
|
||||
{
|
||||
return getControllingPassenger() instanceof PlayerEntity ? MOUNTED_SPEED : UNMOUNTED_SPEED;
|
||||
return getControllingPassenger() instanceof PlayerEntity ? MOUNTED_SPEED.getValue() : UNMOUNTED_SPEED.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
5
src/main/resources/assets/fastghast/lang/en_us.json
Normal file
5
src/main/resources/assets/fastghast/lang/en_us.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"fastghast.speed.unmounted": "Unmounted speed",
|
||||
"fastghast.speed.mounted": "Mounted speed",
|
||||
"fastghast.config.title": "FastGhast Config"
|
||||
}
|
||||
@@ -3,14 +3,23 @@
|
||||
"id": "fastghast",
|
||||
"version": "${version}",
|
||||
"name": "FastGhast",
|
||||
"description": "",
|
||||
"authors": [],
|
||||
"contact": {},
|
||||
"description": "Mod that modifies the speed of the Happy Ghast",
|
||||
"authors": ["KaseToatz"],
|
||||
"contact": {
|
||||
"email": "kasetoatz@kasetoatz.com",
|
||||
"homepage": "https://modrinth.com/mod/fastghast",
|
||||
"issues": "https://git.kasetoatz.com/KaseToatz/FastGhast/issues",
|
||||
"sources": "https://git.kasetoatz.com/KaseToatz/FastGhast"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.kasetoatz.fastghast.FastGhast"
|
||||
"com.kasetoatz.fastghast.Fastghast"
|
||||
],
|
||||
"modmenu": [
|
||||
"com.kasetoatz.fastghast.config.Config"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
@@ -19,6 +28,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=${loader_version}",
|
||||
"fabric": "*",
|
||||
"minecraft": "${minecraft_version}"
|
||||
"minecraft": "${minecraft_version}",
|
||||
"dacl": ">=${dacl_version}"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/main/resources/icon.png
Normal file
BIN
src/main/resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
Reference in New Issue
Block a user