Skip to content
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

Portal color is always black #60

Open
Unreal852 opened this issue Aug 11, 2022 · 11 comments
Open

Portal color is always black #60

Unreal852 opened this issue Aug 11, 2022 · 11 comments

Comments

@Unreal852
Copy link

Unreal852 commented Aug 11, 2022

Hi, I'm using CPA with a mod that i made. Everything is working nicely except that the portal is always black no matter which color i use.
I create the world and the portal on the server side.
Am i doing it wrong or is this a bug?

@Unreal852
Copy link
Author

I just noticed, if i disconnect and then reconnect to my server the color is the good one, i assume there is a sync issue when creating a portal.

@kyrptonaught
Copy link
Owner

What mc version and cpa are you using? Is your mod installed on both the server and client?

@Unreal852
Copy link
Author

I'm using minecraft 1.19.2 and CPA 0.0.1-beta53-1.19. Yes the mod is installed on both the server and client.

@kyrptonaught
Copy link
Owner

I never officially updated cpa to 1.19.1 or .2, I wonder if that could be causing any issues. I'll investigate later today.

In the meantime, could you link your code somewhere? Just to check it out and rule out any errors that might be there

@Unreal852
Copy link
Author

Unreal852 commented Aug 11, 2022

Sure, here is the project and here is where i create the portal. If you want to try it, start a dedicated server and a client, OP your client and then use /quantum create your_world_name. When thats done just build a bedrock portal and ignite it with a diamond, you should see it black, then disconnect and reconnect your client and you should see it green.

@kyrptonaught
Copy link
Owner

kyrptonaught commented Aug 11, 2022

I think I see why. The portal is getting created on the sever when you generate a world with the command. Portals get synced to the client on join. So since the portal is created after the client has already joined, it never syncs.

I'll have to add a way to force sync a portal

Syncing code: https://github.com/kyrptonaught/customportalapi/blob/1.19/src/main/java/net/kyrptonaught/customportalapi/networking/PortalRegistrySync.java

@Unreal852
Copy link
Author

Yeah i see the problem, i can write my own sync code for now. If you don't want to always sync portals on creation maybe you can add a .forceSync() in the portal builder class and then when registering the portal if the forceSync was used, you broadcast a packet to all connected clients.

@kyrptonaught
Copy link
Owner

kyrptonaught commented Aug 12, 2022

One issue with this is that we need to get an instance of the MinecraftServer. I did add the methods to send the packet in PortalRegistrySync. Just not sure on the best way to call this.

See latest commit for more info

@Unreal852
Copy link
Author

Maybe you can ask for a MinecraftServer instance within the forceSync in the builder but i don't think its a good way of doing it.

@warior456
Copy link
Contributor

wierd issue i have something similar:
in my dev enviroment with intellij my portal color is completely fine but in my released version it is broken somehow

@kyrptonaught
Copy link
Owner

There was a sodium incompatibility. This was fixed in beta63

wierd issue i have something similar: in my dev enviroment with intellij my portal color is completely fine but in my released version it is broken somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants