Skip to content

Commit 3d1c341

Browse files
authored
Spray cans with AE2 IColorableBlockEntity support (#4264)
1 parent 59d17a0 commit 3d1c341

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import net.minecraftforge.common.Tags;
4141
import net.minecraftforge.common.util.TriPredicate;
4242

43+
import appeng.api.implementations.blockentities.IColorableBlockEntity;
4344
import appeng.api.util.AEColor;
4445
import appeng.blockentity.networking.CableBusBlockEntity;
4546
import com.google.common.collect.ImmutableMap;
@@ -204,8 +205,13 @@ private boolean handleSpecialBlockEntities(BlockEntity first, int limit, UseOnCo
204205
if (player == null) {
205206
return false;
206207
}
207-
if (GTCEu.Mods.isAE2Loaded() && AE2CallWrapper.isAE2Cable(first)) {
208-
var collected = AE2CallWrapper.collect(first, limit);
208+
if (GTCEu.Mods.isAE2Loaded() && AE2CallWrapper.isColorable(first)) {
209+
Set<? extends IColorableBlockEntity> collected;
210+
if (first instanceof CableBusBlockEntity) {
211+
collected = AE2CallWrapper.collect(first, limit);
212+
} else {
213+
collected = Set.of((IColorableBlockEntity) first);
214+
}
209215
var ae2Color = color == null ? AEColor.TRANSPARENT : AEColor.values()[color.ordinal()];
210216
for (var c : collected) {
211217
if (c.getColor() == ae2Color) {
@@ -479,8 +485,8 @@ static Set<CableBusBlockEntity> collect(BlockEntity first, int limit) {
479485
limit, limit * 6);
480486
}
481487

482-
static boolean isAE2Cable(BlockEntity be) {
483-
return be instanceof CableBusBlockEntity;
488+
static boolean isColorable(BlockEntity be) {
489+
return be instanceof IColorableBlockEntity;
484490
}
485491

486492
static boolean ae2CablePredicate(CableBusBlockEntity parent, CableBusBlockEntity child, Direction direction) {

0 commit comments

Comments
 (0)