Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.13.2] Optional client/server mod : Handshake issues


Franckyi
 Share

Recommended Posts

Hello,

 

I'm creating a mod that is optional on the server and on the client. Basically, a player using my mod can join a vanilla server, and a vanilla player can join a server where my mod is installed. The only thing my mod registers are network channels, and they are made to accept any version on the server and the client.

 

But I want to find a way to detect if a player has installed my mod (from the server) and if the server has installed my mod (from the client).
Someone told me to use a handshake packet.


On the client I would simply create a boolean variable that equals true if the client correctly recieves the handshake from the server.
On the server I would create a Set<UUID> to tell which player has the mod installed. If the server correctly recieves the handshake from the client, it adds the player to the set. When the player disconnects, he's removed from the set.

 

I've looked at how Forge manages the handshake.
I created my own SimpleChannel for the handshake and I registered the S2C and the C2S message using the MessageBuilder. For the S2C one I used buildLoginPacketList.
In the S2C message handler, I reply with the C2S message. In both handlers, I mark the packet as handled.
When I start my SP world, I see the handshake in the log. But after my handshake is done, the screen is stuck on the "Loading world" screen, and it disconnects me because it "Took too long to log in".

 

I think I forgot something but I don't know what. I have to somehow tell that the handshake is done, but I can't find how. Does someone know what could I have forgot ?

 

Packet registration : https://github.com/Franckyi/IBE-Editor/blob/c54278cbdd6164ee85feaa1305a8cc38722e9a75/src/main/java/com/github/franckyi/ibeeditor/network/IBENetworkHandler.java#L63
Packet handling : https://github.com/Franckyi/IBE-Editor/blob/c54278cbdd6164ee85feaa1305a8cc38722e9a75/src/main/java/com/github/franckyi/ibeeditor/network/IBEHandshakeMessages.java#L41

Handshake log : https://hastebin.com/fopirelaxu.cs

Edited by Franckyi
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • public ManaHealthOverlay() { this.minecraft = Minecraft.getInstance(); OverlayRegistry.registerOverlayBelow(ForgeIngameGui.FOOD_LEVEL_ELEMENT , "Mana", this); } Does this solve the problem with OverlayRegistry? I thought I had implemented Mana based on the player's stats. But nothing shows up. Is it still not enough?   The second half is equivalent to playerhealth, only the values have been changed. public class ManaOverlay extends GuiComponent implements IIngameOverlay { protected int screenWidth; protected int screenHeight; protected int tickCount; protected int lastMana; protected int displayMana; protected long lastManaTime; protected long manaBlinkTime; private final Minecraft minecraft; protected final Random random = new Random(); private static final ResourceLocation GUI_MANA_LOCATION = new ResourceLocation("textures/gui/bars.png"); final Map<UUID, LerpingBossEvent> events = Maps.newLinkedHashMap(); private static final ManaOverlay INSTANCE = new ManaOverlay(); public static void init() { MinecraftForge.EVENT_BUS.register(INSTANCE); } public ManaOverlay() { this.minecraft = Minecraft.getInstance(); OverlayRegistry.registerOverlayBelow(ForgeIngameGui.FOOD_LEVEL_ELEMENT , "Mana", this); } private Player getCameraPlayer() { return !(this.minecraft.getCameraEntity() instanceof Player) ? null : (Player)this.minecraft.getCameraEntity(); } ....
    • I'm new to modding and I want to do this. What class would I put that in?
    • That is a different crash report. Please post the debug.log file from the logs folder.
    • [22Jan.2022 18:41:22.485] [Server thread/ERROR] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: Exception caught during firing event: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.SignBlockEntity.save(net.minecraft.nbt.CompoundTag)'     Index: 4     Listeners:         0: HIGH         1: ASM: class dev.architectury.event.forge.EventHandlerImplCommon event(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         2: NORMAL         3: ASM: cyclopscore onServerStarting(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         4: ASM: chanceCubes.CCubesCore@5b77fda6 serverStart(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         5: ASM: mods.waterstrainer.event.EventServerStarting@2dc1913f onServerStarting(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         6: ASM: com.song.castle_in_the_sky.CastleInTheSky@1f8c253d onServerStarting(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         7: ASM: se.mickelus.tetra.TetraMod@203a3089 serverStarting(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         8: net.minecraftforge.eventbus.EventBus$$Lambda$4325/0x0000000800c57770@71737087         9: ASM: de.teamlapen.vampirism.VampirismMod@1213b1b onServerStart(Lnet/minecraftforge/event/server/ServerStartingEvent;)V         10: net.minecraftforge.eventbus.EventBus$$Lambda$4325/0x0000000800c57770@1a894d2d         11: net.minecraftforge.eventbus.EventBus$$Lambda$4325/0x0000000800c57770@3deb329 java.lang.NoSuchMethodError: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.SignBlockEntity.save(net.minecraft.nbt.CompoundTag)'     at TRANSFORMER/chancecubes@1.18.1-5.0.2.444/chanceCubes.rewards.DefaultRewards.loadDefaultRewards(DefaultRewards.java:124)     at TRANSFORMER/chancecubes@1.18.1-5.0.2.444/chanceCubes.CCubesCore.serverStart(CCubesCore.java:123)     at net.minecraftforge.eventbus.ASMEventHandler_101_CCubesCore_serverStart_ServerStartingEvent.invoke(.dynamic)     at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)     at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)     at MC-BOOTSTRAP/eventbus@5.0.3/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)     at TRANSFORMER/forge@39.0.56/net.minecraftforge.server.ServerLifecycleHooks.handleServerStarting(ServerLifecycleHooks.java:102)     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.base/java.lang.reflect.Method.invoke(Method.java:568)     at TRANSFORMER/net.optifine/net.optifine.reflect.Reflector.callBoolean(Reflector.java:702)     at TRANSFORMER/minecraft@1.18.1/net.minecraft.client.server.IntegratedServer.m_7038_(IntegratedServer.java:90)     at TRANSFORMER/minecraft@1.18.1/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:644)     at TRANSFORMER/minecraft@1.18.1/net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258)     at java.base/java.lang.Thread.run(Thread.java:833) [22Jan.2022 18:41:22.509] [Server thread/DEBUG] [mixin/]: Mixing MixinChunkSerializer from architectury.mixins.json into net.minecraft.world.level.chunk.storage.ChunkSerializer [22Jan.2022 18:41:28.076] [Server thread/DEBUG] [net.minecraftforge.fml.loading.FileUtils/CORE]: Found existing serverconfig directory : C:\Users\UTW\AppData\Roaming\.minecraft\saves\New World\serverconfig [22Jan.2022 18:41:28.076] [Server thread/DEBUG] [net.minecraftforge.fml.config.ConfigTracker/CONFIG]: Unloading configs type SERVER Sry if its not the right one, im pretty new at Forge
    • I have a modded server that worked before I changed the config for SereneSeasons (made the seasons longer and turned off offline season progression). Now it just gives said error message, even after reverting the changes.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.