Skip to content

Commit

Permalink
Nudge stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Dec 27, 2024
1 parent b3c0a16 commit 43f5580
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<B extends PacketByteBuf> {

static Logger LOGGER = LoggerFactory.getLogger("PayloadTypeRegistry");

<T extends CustomPayload> CustomPayload.Type<? super B, T> register(CustomPayload.Id<T> id, PacketCodec<? super B, T> codec);

static PayloadTypeRegistry<RegistryByteBuf> playS2C() {
Expand All @@ -28,8 +31,9 @@ class PayloadTypeS2CRegistryImpl implements PayloadTypeRegistry<RegistryByteBuf>

@Override
public <T extends CustomPayload> CustomPayload.Type<? super RegistryByteBuf, T> register(CustomPayload.Id<T> id, PacketCodec<? super RegistryByteBuf, T> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}
}

0 comments on commit 43f5580

Please sign in to comment.