Skip to content

Commit

Permalink
Fix Payload Registration Not Working Correct Under Circumstances.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev0Louis committed Jul 10, 2024
1 parent a8c5785 commit c8087b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ supported_version=>=1.20.5
yarn_mappings=1.21+build.2
loader_version=0.15.11
# Mod Properties
mod_version=6.0.0
mod_version=6.0.1
maven_group=dev.louis
archives_base_name=Nebula
# Dependencies
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/dev/louis/nebula/Nebula.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.louis.nebula.command.NebulaCommand;
import dev.louis.nebula.manager.NebulaManager;
import dev.louis.nebula.networking.c2s.SpellCastPayload;
import dev.louis.nebula.networking.s2c.SyncManaPayload;
import dev.louis.nebula.networking.s2c.UpdateSpellCastabilityPayload;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
Expand All @@ -26,7 +28,10 @@ public void onInitialize() {
}

public void registerPacketReceivers() {
PayloadTypeRegistry.playS2C().register(UpdateSpellCastabilityPayload.ID, UpdateSpellCastabilityPayload.CODEC);
PayloadTypeRegistry.playS2C().register(SyncManaPayload.ID, SyncManaPayload.CODEC);
PayloadTypeRegistry.playC2S().register(SpellCastPayload.ID, SpellCastPayload.CODEC);

ServerPlayNetworking.registerGlobalReceiver(SpellCastPayload.ID, SpellCastPayload::receive);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/dev/louis/nebula/NebulaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import dev.louis.nebula.networking.s2c.UpdateSpellCastabilityPayload;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;

public class NebulaClient implements ClientModInitializer {

Expand All @@ -16,10 +15,9 @@ public void onInitializeClient() {
}

public void registerPacketReceivers() {
PayloadTypeRegistry.playS2C().register(UpdateSpellCastabilityPayload.ID, UpdateSpellCastabilityPayload.CODEC);

ClientPlayNetworking.registerGlobalReceiver(UpdateSpellCastabilityPayload.ID, NebulaSpellManager::receiveSync);

PayloadTypeRegistry.playS2C().register(SyncManaPayload.ID, SyncManaPayload.CODEC);
ClientPlayNetworking.registerGlobalReceiver(SyncManaPayload.ID, NebulaManaManager::receiveSync);
}
}

0 comments on commit c8087b2

Please sign in to comment.