Skip to content

Conversation

@Zorbatron
Copy link
Member

What

  • Refactors the spray can behavior to be more extensible and easier to work with.
  • Adds recursive pipe painting to spray cans (supersedes Pipe colouring #2368).
  • Adds a creative spray can similar to the one in GTNH.

Implementation Details

  • Separated the spray behavior out into a base abstract class that holds all of the spraying logic. Durability based spray cans and the creative spray can extend that.
  • Added a new suite of classes for interacting with different colored blocks for one unified interface across mods.
  • Added a new iface for items that listen on client mouse events separate from normal use.

Outcome

Spray cans are better to use.

Potential Compatibility Issues

Shouldn't be any, the durability based cans use the same NBT key so that should carry over.

Zorbatron added 30 commits July 18, 2025 15:10
…c) but usable items (spray cans, lighters, etc) weren't accounted for
…a mouse button or scroll event happened (looking around emits an event per tick, too many packets!)
@Zorbatron Zorbatron requested a review from a team as a code owner August 25, 2025 01:21
@Zorbatron Zorbatron added type: feature New feature or request type: refactor Suggestion to refactor a section of code labels Aug 25, 2025
@Zorbatron Zorbatron mentioned this pull request Aug 25, 2025
Copy link
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

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

The Color name in the tooltips of the spray cans should be colored the appropriate color

The default Creeative Spray can in JEI has an empty NBT tag on it, which should probably be removed. It also defaults to Solvent, whereas I would rather have it default to one of the existing colors, or have some tooltip saying that is can provide all colors.

When testing on Hardened Clay (Terracotta), if I use solvent on a block, I can then not recolor the block using a spray can. Seems like Vanilla Blocks only

In the toolbelt, the Durability bar of the default creative spray can from JEI goes over 1 slot width.

Using a spray can from the toolbelt transformed the spray can into a Copper Credit after one use.

The pipe walker from the linked superseded PR has some issues (It did in that PR as well). When arranging pipes into a +, not all branches of the net are walked and colored. When the pipes are set up like image, the pipe walk is not performed, and the pink pipe is not colored
2025-09-26_20-26

When a spray can runs out of contents, an empty tag is left on the canister. This tag should probably be removed somehow when the last spray is used.

try {
// try to read the default color value from the default state instead of just
// blindly setting it to default state, and potentially resetting other values
defaultColor = (EnumDyeColor) defaultState.getValue(prop);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to null check this here at all, in case it is a mod doing something weird with properties?

// blindly setting it to default state, and potentially resetting other values
defaultColor = (EnumDyeColor) defaultState.getValue(prop);
} catch (IllegalArgumentException ignored) {
// no default color, we may have to fallback to WHITE here
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a line of info text into the log in this case, to catch common other mod blocks? Probably gated behind the debug config option.

return GTGuiTheme.STANDARD;
}

// TODO: change to abstract once MUI2 port is complete
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any other Items that need a MUI2 GUI that can be opened from the hand?

}

public static MapColor getMapColor(int rgb) {
public static @NotNull MapColor getMapColor(int rgb) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go in ColorUtil now? As well as the other color stuff used for prospector stuff with the various map mods.

if (pipeTile.getNumConnections() == 2) {
int connections = pipeTile.getConnections();
connections &= ~(1 << facing.getOpposite().getIndex());
for (EnumFacing other : EnumFacing.VALUES) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't the superseded PR create a custom pipe net walker to walk the pipe network, with a limit on the number of steps based on max uses left of the can. Why did we switch to just iterating over every direction? Also, I think this was causing the case where a + would not get fully colored.


if (pipeTile.getNumConnections() == 2) {
int connections = pipeTile.getConnections();
connections &= ~(1 << facing.getOpposite().getIndex());
Copy link
Contributor

Choose a reason for hiding this comment

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

You already have the facing of the spray, so why do you have to check over all other directions, instead of just the direction of the spray and its opposite?

@Zorbatron
Copy link
Member Author

When testing on Hardened Clay (Terracotta), if I use solvent on a block, I can then not recolor the block using a spray can. Seems like Vanilla Blocks only

Fixed.

Using a spray can from the toolbelt transformed the spray can into a Copper Credit after one use.

This isn't exclusive to the spray can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature or request type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants