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

Refactor ColorSprayBehaviour for gt pipes and ae2 cables #2532

Draft
wants to merge 3 commits into
base: 1.20.1
Choose a base branch
from

Conversation

omergunr100
Copy link
Contributor

What

Spray paint only paints pipes/cables of the same color as the original block when painting a line.
Spray paint will stop painting when 2 adjacent pipes/cables are disconnected instead of ignoring connections.

Additionally

Resolves #2518

@omergunr100 omergunr100 requested a review from a team as a code owner December 12, 2024 05:22
if (be instanceof CableBusBlockEntity cable && first instanceof CableBusBlockEntity og) {
var side = getPaintDirection(player).getOpposite();
if (!first.getBlockPos().equals(be.getBlockPos()) &&
(cable.getPart(side) != null || cable.getCableConnectionType(side) == AECableType.NONE)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am reading this right, for each block, it checks if near side has a cable part, and if so, stops before painting that block. I think you also want to check is the previous block has a cable part on the far side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for both ae2 cables and gt pipes it's almost the same thing iirc, if the previous cable has a part on the far side the near side of the current one will either be disconnected or have another part.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With no knowledge of how AE represents things internally, is that true of ME P2P tunnel? Certainly, from a logical perspective, the cable opposite the tunnel is connected to the tunnel. I don't know what that means in terms of getCableConnectionType though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, p2p is an edge case, I'll see how it can be handled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the right way to do it would probably be a refactor of the behaviour to use some custom collector logic for each block paintable block type, that would also help if we want to paint the connected network instead of just a straight line, I'll give it a shot later

@omergunr100 omergunr100 marked this pull request as draft December 12, 2024 06:54
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

Successfully merging this pull request may close these issues.

When spray painting AE2 cables, it should stop at any face that has a cable part.
2 participants