diff --git a/gradle.properties b/gradle.properties index 1d65a3c..a25ea57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,7 +18,7 @@ authors=Falkreon, acikek contributors=Trudle, Tomate0613, afamiliarquiet, FoundationGames, TheEpicBlock, hama license=MIT # Mod Version -baseVersion=1.8.2-rc.3 +baseVersion=1.8.2-rc.4 # Branch Metadata branch=1.21 tagBranch=1.21 diff --git a/src/main/java/cn/zbx1425/scatteredshards/neoforge/ScatteredShardsNeoForge.java b/src/main/java/cn/zbx1425/scatteredshards/neoforge/ScatteredShardsNeoForge.java index 6c64614..5ed56e7 100644 --- a/src/main/java/cn/zbx1425/scatteredshards/neoforge/ScatteredShardsNeoForge.java +++ b/src/main/java/cn/zbx1425/scatteredshards/neoforge/ScatteredShardsNeoForge.java @@ -53,7 +53,7 @@ public static void onServerStarting(ServerStartingEvent event) { if (!SERVER_CONFIG.redisUrl.value.isEmpty()) { peerChannel = new RedisSynchronizer(SERVER_CONFIG.redisUrl.value); } else { - peerChannel = null; + peerChannel = Synchronizer.NOOP; } SyncPersistDispatcher.CURRENT = new SyncPersistDispatcher( event.getServer(), diff --git a/src/main/java/net/fabricmc/fabric/api/networking/v1/PayloadTypeRegistry.java b/src/main/java/net/fabricmc/fabric/api/networking/v1/PayloadTypeRegistry.java index a038b15..7b09b35 100644 --- a/src/main/java/net/fabricmc/fabric/api/networking/v1/PayloadTypeRegistry.java +++ b/src/main/java/net/fabricmc/fabric/api/networking/v1/PayloadTypeRegistry.java @@ -3,15 +3,18 @@ import dev.architectury.impl.NetworkAggregator; import dev.architectury.networking.NetworkManager; -import dev.architectury.platform.Platform; -import dev.architectury.utils.Env; import net.minecraft.network.PacketByteBuf; import net.minecraft.network.RegistryByteBuf; import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.packet.CustomPayload; +import net.neoforged.fml.loading.FMLEnvironment; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public interface PayloadTypeRegistry { + static Logger LOGGER = LoggerFactory.getLogger("PayloadTypeRegistry"); + CustomPayload.Type register(CustomPayload.Id id, PacketCodec codec); static PayloadTypeRegistry playS2C() { @@ -28,8 +31,9 @@ class PayloadTypeS2CRegistryImpl implements PayloadTypeRegistry @Override public CustomPayload.Type register(CustomPayload.Id id, PacketCodec codec) { - if (Platform.getEnvironment() == Env.SERVER) { + if (FMLEnvironment.dist.isDedicatedServer()) { NetworkManager.registerS2CPayloadType(id, codec); + LOGGER.info("Registered S2C payload type: {}", id); } else { NetworkAggregator.S2C_CODECS.put(id.id(), (PacketCodec)codec); } diff --git a/src/main/java/net/modfest/scatteredshards/networking/ScatteredShardsNetworking.java b/src/main/java/net/modfest/scatteredshards/networking/ScatteredShardsNetworking.java index 8f0606a..21e3567 100644 --- a/src/main/java/net/modfest/scatteredshards/networking/ScatteredShardsNetworking.java +++ b/src/main/java/net/modfest/scatteredshards/networking/ScatteredShardsNetworking.java @@ -7,6 +7,7 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; +import net.modfest.scatteredshards.ScatteredShards; import net.modfest.scatteredshards.api.ScatteredShardsAPI; import net.modfest.scatteredshards.api.impl.ShardLibraryPersistentState; @@ -43,5 +44,6 @@ public static void onPlayerJoinServer(MinecraftServer server, ServerPlayerEntity ServerPlayNetworking.send(player, new S2CSyncCollection(ScatteredShardsAPI.getServerCollection(player))); ScatteredShardsAPI.calculateShardProgress(); ServerPlayNetworking.send(player, new S2CSyncGlobalCollection(ScatteredShardsAPI.getServerGlobalCollection())); + ScatteredShards.LOGGER.info("S2C sync packets sent to {}", player.getPlayerListName().getString()); } }