fix client file configuration respectedly
This commit is contained in:
@@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
This branch is Fabric-only and intentionally separates authority:
|
This branch is Fabric-only and intentionally separates authority:
|
||||||
|
|
||||||
* `config/item-despawn-timer-server.json` — server gameplay: default despawn time and per-item overrides. `-1` means infinite when enabled.
|
* `config/item-despawn-timer-server.json` — **dedicated server only**; server gameplay: default despawn time and per-item overrides. `-1` means infinite when enabled.
|
||||||
* `config/item-despawn-timer-client.json` — client presentation only: timer/name visibility, heights, threshold and colors.
|
* `config/item-despawn-timer-client.json` — **client only**; presentation settings: timer/name visibility, heights, threshold and colors.
|
||||||
|
|
||||||
|
Since v0.3.7, a physical client no longer creates `item-despawn-timer-server.json`. The main Fabric initializer also runs on clients, so `ServerConfig` explicitly checks the physical environment before reading/writing its persistent file. Integrated singleplayer uses the built-in server defaults in memory; dedicated servers continue to use the persistent server JSON.
|
||||||
|
|
||||||
Minecraft 26.2 uses the unobfuscated Mojang/official names and Java 25. This port therefore does not reuse the old Yarn-named common/client GUI classes from 0.2.2. Client rendering lives only in `src/client`, while server/gameplay code lives in `src/main`.
|
Minecraft 26.2 uses the unobfuscated Mojang/official names and Java 25. This port therefore does not reuse the old Yarn-named common/client GUI classes from 0.2.2. Client rendering lives only in `src/client`, while server/gameplay code lives in `src/main`.
|
||||||
|
|
||||||
Run `compiler.bat` on Windows or `./compiler.sh` on Linux/macOS. The script checks whether the existing JAR contains the same `mod_version+mc<minecraft_version>` as `gradle.properties`; matching builds offer Push/Recompile/Quit. After a successful build it offers Git push and retries failed pushes in groups of three.
|
Run `compiler.bat` on Windows or `./compiler.sh` on Linux/macOS. The script checks whether the existing JAR contains the same `mod_version+mc<minecraft_version>` as `gradle.properties`; matching builds offer Push/Recompile/Quit. After a successful build it offers Git push and retries failed pushes in groups of three.
|
||||||
|
|
||||||
## Commands (v0.3.4)
|
## Commands (v0.3.7)
|
||||||
|
|
||||||
`/idt reload`
|
`/idt reload`
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,6 +3,6 @@ org.gradle.configuration-cache=false
|
|||||||
minecraft_version=26.2
|
minecraft_version=26.2
|
||||||
loader_version=0.19.3
|
loader_version=0.19.3
|
||||||
fabric_version=0.160.0+26.2
|
fabric_version=0.160.0+26.2
|
||||||
mod_version=0.3.6
|
mod_version=0.3.7
|
||||||
maven_group=whirlfrenzy.itemdespawntimer
|
maven_group=whirlfrenzy.itemdespawntimer
|
||||||
archives_base_name=item-despawn-timer
|
archives_base_name=item-despawn-timer
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package whirlfrenzy.itemdespawntimer.config;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
@@ -18,6 +19,15 @@ public final class ServerConfig {
|
|||||||
}
|
}
|
||||||
private ServerConfig() {}
|
private ServerConfig() {}
|
||||||
public static void load() {
|
public static void load() {
|
||||||
|
// The common/main initializer also runs in a physical Minecraft client.
|
||||||
|
// Never create or read the server config there: a client installation owns
|
||||||
|
// presentation settings only. Integrated singleplayer uses server defaults
|
||||||
|
// in memory; a dedicated server owns the persistent server config file.
|
||||||
|
if (FabricLoader.getInstance().getEnvironmentType() != EnvType.SERVER) {
|
||||||
|
data = new Data();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Path p = FabricLoader.getInstance().getConfigDir().resolve("item-despawn-timer-server.json");
|
Path p = FabricLoader.getInstance().getConfigDir().resolve("item-despawn-timer-server.json");
|
||||||
try {
|
try {
|
||||||
if (Files.exists(p)) { try (Reader r=Files.newBufferedReader(p)) { Data d=GSON.fromJson(r,Data.class); if(d!=null)data=d; } }
|
if (Files.exists(p)) { try (Reader r=Files.newBufferedReader(p)) { Data d=GSON.fromJson(r,Data.class); if(d!=null)data=d; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user