-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server mode issues #933
Comments
This appears to be caused by the network channels which are registered even if serverOnly mode is on: KubeJS/src/main/java/dev/latvian/mods/kubejs/net/KubeJSNet.java Lines 36 to 40 in 82a224d
|
So its an easy fix? |
Ok, further progress, I can now log in if I start the server from my ide. Again, idk if those modifications I did should be done as I did, but I did the following: In the Stages interface default void sync() {
if (getPlayer() instanceof ServerPlayer player) {
if(!CommonProperties.get().serverOnly) {
PacketDistributor.sendToPlayer(player, new SyncStagesPayload(getAll()));
}
}
} In the KubeJSPlayerEventHandler @SubscribeEvent(priority = EventPriority.HIGH)
public static void datapackSync(OnDatapackSyncEvent event) {
var payload = event.getPlayerList().getServer().getServerResources().managers().kjs$getServerScriptManager().serverData;
if(!CommonProperties.get().serverOnly) {
event.getRelevantPlayers().forEach(player -> PacketDistributor.sendToPlayer(player, payload));
}
} In the base KubeJS mod class if(!CommonProperties.get().serverOnly) {
KubeJSIngredients.REGISTRY.register(bus);
KubeJSFluidIngredients.REGISTRY.register(bus);
KubeJSCreativeTabs.REGISTRY.register(bus);
KubeJSRuleTests.REGISTRY.register(bus);
KubeJSHolderSets.REGISTRY.register(bus);
} This fixes it if I launch the server from the ide, allowing connections from vanilla clients, but I get a startup crash when launching a normal server with my custom build |
This was required to fix a crash when clicking like anywhere: @HideFromJS
default void kjs$startAttack0() {
if (ItemEvents.FIRST_LEFT_CLICKED.hasListeners()) {
var player = kjs$self().player;
var stack = player.getItemInHand(InteractionHand.MAIN_HAND);
var key = stack.getItem().kjs$getKey();
if (ItemEvents.FIRST_LEFT_CLICKED.hasListeners(key)) {
ItemEvents.FIRST_LEFT_CLICKED.post(ScriptType.CLIENT, key, new ItemClickedKubeEvent(player, InteractionHand.MAIN_HAND, stack));
}
}
if(!CommonProperties.get().serverOnly) {
PacketDistributor.sendToServer(new FirstClickPayload(0));
}
}
@HideFromJS
default void kjs$startUseItem0() {
if (ItemEvents.FIRST_RIGHT_CLICKED.hasListeners()) {
var player = kjs$self().player;
for (var hand : InteractionHand.values()) {
var stack = player.getItemInHand(hand);
var key = stack.getItem().kjs$getKey();
if (ItemEvents.FIRST_RIGHT_CLICKED.hasListeners(key)) {
ItemEvents.FIRST_RIGHT_CLICKED.post(ScriptType.CLIENT, key, new ItemClickedKubeEvent(player, hand, stack));
}
}
}
if(!CommonProperties.get().serverOnly) {
PacketDistributor.sendToServer(new FirstClickPayload(1));
}
} |
Minecraft Version
1.21.1
KubeJS Version
2101.7.1-build.181
Rhino Version
2101.2.6-build.56
Architectury Version
None
Forge/Fabric Version
Neoforge 21.1.89
Describe your issue
So, I wanted my friend with a vanilla client to connect to my kubejs server mode server. We got the error that they have to install neoforge, but the issue disappeared once I removed kubejs. So, I went ahead and set up a real server because we were using e4mc. The issue persistet (I had client and server running on my machine but that shouldn't be an issue). Then I installed neoforge on the client and finally got usable info (See the picture). This prevents any client from connecting unless they have kubejs installed, which Im pretty sure is not the usecase for servermode. Would be really nice if this could be fixed.
Also, a little feature request: Would it be possible to send the assets folder to the players as a server resource pack?
Thanks a lot in advance
debug_client.log
latest_client.log
latest_server.log
debug_server.log
Crash report/logs
No response
The text was updated successfully, but these errors were encountered: