Skip to content

Commit 452e4a1

Browse files
Fixed shift spray paint.
1 parent 7db2d8a commit 452e4a1

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

src/main/java/net/neganote/gtutilities/common/item/InfiniteSprayCanBehaviour.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.neganote.gtutilities.common.item;
22

3+
import appeng.api.util.AEColor;
34
import com.gregtechceu.gtceu.GTCEu;
45
import com.gregtechceu.gtceu.api.blockentity.IPaintable;
56
import com.gregtechceu.gtceu.api.item.component.IAddInformation;
@@ -182,13 +183,28 @@ private boolean handleSpecialBlockEntities(BlockEntity first, DyeColor color, in
182183
var player = context.getPlayer();
183184
if (player == null) return false;
184185

185-
if (GTCEu.Mods.isAE2Loaded() && first instanceof IColorableBlockEntity colorable) {
186-
appeng.api.util.AEColor ae2Color = color == null ?
187-
appeng.api.util.AEColor.TRANSPARENT :
188-
appeng.api.util.AEColor.values()[color.ordinal()];
189-
190-
if (colorable.getColor() != ae2Color) {
191-
colorable.recolourBlock(null, ae2Color, player);
186+
if (GTCEu.Mods.isAE2Loaded() && first instanceof IColorableBlockEntity) {
187+
var collected = BreadthFirstBlockSearch.conditionalSearch(
188+
IColorableBlockEntity.class,
189+
(IColorableBlockEntity) first,
190+
first.getLevel(),
191+
be -> ((BlockEntity) be).getBlockPos(),
192+
(parent, child, dir) -> {
193+
if (parent == null) return true;
194+
return parent.getColor() == child.getColor();
195+
},
196+
limit,
197+
limit * 6
198+
);
199+
200+
AEColor ae2Color = color == null ?
201+
AEColor.TRANSPARENT :
202+
AEColor.values()[color.ordinal()];
203+
204+
for (IColorableBlockEntity colorable : collected) {
205+
if (colorable.getColor() != ae2Color) {
206+
colorable.recolourBlock(null, ae2Color, player);
207+
}
192208
}
193209
return true;
194210
}

0 commit comments

Comments
 (0)