Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "fabric-loom" version "1.7-SNAPSHOT"
id "maven-publish"
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
id 'maven-publish'
}

version = project.mod_version
Expand All @@ -23,7 +23,7 @@ dependencies {
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 "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
implementation 'com.google.code.gson:gson:2.12.1'

compileOnly 'net.luckperms:api:5.4'
Expand All @@ -32,7 +32,7 @@ dependencies {
compileOnly("curse.maven:huskhomes-849217:5468607")

// Arda regions
modApi(files("build/libs/arda-regions-1.0.0.jar"))
// modApi(files("build/libs/arda-regions-1.0.0.jar"))

modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:${devauth_version}")
}
Expand Down Expand Up @@ -67,34 +67,37 @@ processResources {
}
}

def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
it.options.release = 21
}

java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
inputs.property "archivesName", project.base.archivesName

from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${inputs.properties.archivesName}" }
}
}

publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

repositories {}
// 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.
}
}
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.16.10
loom_version=1.11-SNAPSHOT
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.18.4
loom_version=1.14-SNAPSHOT

# Fabric API
fabric_version=0.92.3+1.20.1
fabric_version=0.116.7+1.21.1

# Mod Properties
mod_version=1.2.5
maven_group = space.ajcool
archives_base_name = ArdaPaths

# Dependencies
yacl_version=3.5.0-for-1.20.1
fabric_api_version=0.116.9+1.21.1
yacl_version=3.5.0-for-1.21.1
devauth_version=1.2.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
1 change: 0 additions & 1 deletion src/main/java/space/ajcool/ardapaths/ArdaPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import space.ajcool.ardapaths.core.data.config.ServerConfigManager;
import space.ajcool.ardapaths.core.data.config.server.ServerConfig;
import space.ajcool.ardapaths.core.networking.PacketRegistry;
import space.ajcool.ardapaths.core.networking.packets.EmptyPacket;
import space.ajcool.ardapaths.mc.blocks.ModBlocks;
import space.ajcool.ardapaths.mc.blocks.entities.ModBlockEntities;
import space.ajcool.ardapaths.mc.blocks.entities.PathMarkerBlockEntity;
Expand Down
30 changes: 11 additions & 19 deletions src/main/java/space/ajcool/ardapaths/core/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,36 @@
import java.util.UUID;

@Environment(EnvType.CLIENT)
public class Client
{
public class Client {
/**
* Gets the Minecraft client instance. We annotate this with
* {@link NotNull} because utility methods should only be
* invoked after the client has been initialized.
*
* @return The Minecraft client instance
*/
public static @NotNull MinecraftClient mc()
{
public static @NotNull MinecraftClient mc() {
return MinecraftClient.getInstance();
}

/**
* @return The client's world, or null if not available
*/
public static @Nullable ClientWorld world()
{
public static @Nullable ClientWorld world() {
return mc().world;
}

/**
* @return The client's player, or null if not available
*/
public static @Nullable ClientPlayerEntity player()
{
public static @Nullable ClientPlayerEntity player() {
return mc().player;
}

/**
* @return The address of the current server, or an empty string if the client is in single player mode
*/
public static String getServerAddress()
{
public static String getServerAddress() {
MinecraftClient client = mc();
if (client.isInSingleplayer()) return "";
ServerInfo server = client.getCurrentServerEntry();
Expand All @@ -58,33 +53,30 @@ public static String getServerAddress()
/**
* @return The player's UUID, or null if not available
*/
public static @Nullable UUID getUuid()
{
public static @Nullable UUID getUuid() {
return mc().getSession().getUuidOrNull();
}

/**
* @return The player's UUID as a string, or an empty string if not available
*/
public static String getUuidString()
{
return mc().getSession().getUuid();
public static String getUuidString() {
UUID uuid = getUuid();
return uuid != null ? uuid.toString() : "";
}

/**
* @return True if the client is in a single player world, otherwise false
*/
public static boolean isInSinglePlayer()
{
public static boolean isInSinglePlayer() {
MinecraftClient client = mc();
return client.isInSingleplayer();
}

/**
* @return True if the client is holding the control key, otherwise false
*/
public static boolean isCtrlDown()
{
public static boolean isCtrlDown() {
ClientWorld level = world();
return level != null && level.isClient() && Screen.hasControlDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.jetbrains.annotations.Nullable;
import space.ajcool.ardapaths.ArdaPaths;
import space.ajcool.ardapaths.core.networking.PacketRegistry;
import space.ajcool.ardapaths.core.networking.packets.EmptyPacket;

public class PermissionHelper {

Expand Down Expand Up @@ -39,7 +38,7 @@ private static boolean clientEditPermissionCheck() {
ArdaPaths.LOGGER.info("Refreshing permissions");

lastPermissionCheckTime = currentTime;
PacketRegistry.PERMISSION_CHECK.send(new EmptyPacket(), response -> {hasEditPermission = response.hasPermission();});
PacketRegistry.PERMISSION_CHECK.send(response -> {hasEditPermission = response.hasPermission();});

// Default to false until we get a response from the server
return hasEditPermission != null ? hasEditPermission : false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package space.ajcool.ardapaths.core.consumers;

import mc.ardacraft.ardaregions.api.ArdaRegionsAPI;
import mc.ardacraft.ardaregions.api.ArdaRegionsApiEntrypoint;
//import mc.ardacraft.ardaregions.api.ArdaRegionsAPI;
//import mc.ardacraft.ardaregions.api.ArdaRegionsApiEntrypoint;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import space.ajcool.ardapaths.ArdaPaths;
Expand All @@ -10,27 +10,27 @@
* Consumer for the Arda Regions API that listens for client discovery popup events
* and updates the ArdaRegionsState accordingly.
*/
public class ArdaRegionsConsumer implements ArdaRegionsApiEntrypoint {

/**
* Called when the Arda Regions API is ready.
* Registers a listener for client discovery popup events to update the displaying state.
*
* @param api the Arda Regions API instance
*/
@Override
public void onApiReady(ArdaRegionsAPI api) {

if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
ArdaPaths.LOGGER.info("{}, skipping Arda Regions consumer registration on server side.", ArdaPaths.MOD_ID);
return;
}
ArdaPaths.LOGGER.info("Arda Regions API is ready, registering consumer.");
api.getClientDiscoveryPopupEvent().register(
(regionId, regionName, description, alpha) -> {

ArdaRegionsState.setDisplaying(alpha > 0.2f);
}
);
}
}
//public class ArdaRegionsConsumer implements ArdaRegionsApiEntrypoint {
//
// /**
// * Called when the Arda Regions API is ready.
// * Registers a listener for client discovery popup events to update the displaying state.
// *
// * @param api the Arda Regions API instance
// */
// @Override
// public void onApiReady(ArdaRegionsAPI api) {
//
// if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
// ArdaPaths.LOGGER.info("{}, skipping Arda Regions consumer registration on server side.", ArdaPaths.MOD_ID);
// return;
// }
// ArdaPaths.LOGGER.info("Arda Regions API is ready, registering consumer.");
// api.getClientDiscoveryPopupEvent().register(
// (regionId, regionName, description, alpha) -> {
//
// ArdaRegionsState.setDisplaying(alpha > 0.2f);
// }
// );
// }
//}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading