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

Server-Client desync of cable collision shapes for recently painted cables #8314

Closed
coyo-t opened this issue Jan 2, 2025 · 2 comments · Fixed by #8317
Closed

Server-Client desync of cable collision shapes for recently painted cables #8314

coyo-t opened this issue Jan 2, 2025 · 2 comments · Fixed by #8317
Labels
bug Self explanatory?

Comments

@coyo-t
Copy link
Contributor

coyo-t commented Jan 2, 2025

Describe the bug

Cables which have been painted with the colourizer (and thusly have their collision shape changed as they dont connect to each other anymore) are desyncronized between the client and server until a block update occurs next to them. the server still thinks the cables are connected while the client recognises that they arent.

Video Example
(Here breaking the sandstone blocs causes the block updates)

How to reproduce the bug

have two sets of cables connected to each other. paint them so they disconnect from each other

Expected behavior

you should be able to walk between them

Additional details

Neighbor block updates are required for both cables's collision shapes to be changed server side, one cable's shape changing will not change the neighboring cable's

Which minecraft version are you using?

1.21

On which mod loaders does it happen?

NeoForge

Crash log

https://pastebin.com/Kz9rARSp

@coyo-t coyo-t added the bug Self explanatory? label Jan 2, 2025
@Mithi83
Copy link
Contributor

Mithi83 commented Jan 4, 2025

I could reproduce that in my test setup. I've tested a simple patch, which solves the problem. But I'm not sure if that is the right place to do that or not with regards to side effects or performance implications, so I'm not posting that as a PR:

diff --git a/src/main/java/appeng/block/networking/CableBusBlock.java b/src/main/java/appeng/block/networking/CableBusBlock.java
index 59dbf7fda..66fdf6ebc 100644
--- a/src/main/java/appeng/block/networking/CableBusBlock.java
+++ b/src/main/java/appeng/block/networking/CableBusBlock.java
@@ -248,7 +248,9 @@ protected InteractionResult useWithoutItem(BlockState state, Level level, BlockP
     public boolean recolorBlock(BlockGetter level, BlockPos pos, Direction side,
             DyeColor color, Player who) {
         try {
-            return this.cb(level, pos).recolourBlock(side, AEColor.fromDye(color), who);
+            boolean result = this.cb(level, pos).recolourBlock(side, AEColor.fromDye(color), who);
+            this.getBlockEntity(level, pos).partChanged();
+            return result;
         } catch (Throwable ignored) {
         }
         return false;

@shartte
Copy link
Member

shartte commented Jan 4, 2025

Should probably go into appeng.parts.networking.CablePart#changeColor
Since the bug here is that the connections changed and due to the connections changing, the collision mesh should be updated hm.

Mithi83 added a commit to Mithi83/Applied-Energistics-2 that referenced this issue Jan 4, 2025
shartte pushed a commit that referenced this issue Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Self explanatory?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants