-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
"Epic" issue about network node and world representation desyncs #3424
Comments
Some work for this has been done already on: 885d46c |
Could be in some other places as well but let's see what this does.
Could be in some other places as well but let's see what this does.
Note to addon developers If you are using Starting from RS v1.12.4 for MC 1.20.1 (and version v1.11.7 for MC 1.19.2, v1.10.6 for MC 1.18.2) it is strongly advised to pass the network node class type to the constructor. For example: public DetectorBlockEntity(BlockPos pos, BlockState state) {
- super(RSBlockEntities.DETECTOR.get(), pos, state, SPEC);
+ super(RSBlockEntities.DETECTOR.get(), pos, state, SPEC, DetectorNetworkNode.class);
} In order to avoid crashing bugs at runtime when a block entity mismatches with its network node representation, RS needs to know the class type. Both constructors will keep existing to ensure compatibility, but please move to this new format to avoid crashes (see this bug report for a nice list). When can I use this API? Now!
If you are not using If you have a custom implementation of @Override
@Nonnull
@SuppressWarnings("unchecked")
public N getNode() {
INetworkNodeManager manager = API.instance().getNetworkNodeManager((ServerLevel) level);
try {
INetworkNode node = manager.getNode(worldPosition);
if (node == null) {
LOGGER.warn("Expected a node @ {} but couldn't find it, creating a new one...", worldPosition);
node = createAndSetNode(manager);
}
- return (N) node;
+ return networkNodeClass.cast(node);
} catch (ClassCastException e) {
LOGGER.warn("Node @ {} got desynced with it's block entity container, recreating", worldPosition, e);
return (N) createAndSetNode(manager);
}
} |
Fixed in 9b30bec Will be fixed for RS v1.12.4 for MC 1.20.1 and will probably be backported to MC 1.19.2. |
This is now backported to MC 1.19.2 in version v1.11.7. |
This is now backported to MC 1.18.2 in version v1.10.6. |
A long time ago... I made an architectural decision for RS that has worked good for us for years. Unfortunately, since mods and Minecraft are evolving, this decision is quite problematic now.
This issue is alleviated in RS 2, but needs (temporary) fixing/workaround in RS 1.
Blockstate mismatch
Network(Node) mismatch
*NetworkNode
s can fail to cast toCableNetworkNode
s #3459Confusing behavior
The text was updated successfully, but these errors were encountered: