Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.minecraftforge.common.util.TriPredicate;

import appeng.api.implementations.blockentities.IColorableBlockEntity;
import appeng.api.util.AEColor;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -182,13 +183,27 @@ private boolean handleSpecialBlockEntities(BlockEntity first, DyeColor color, in
var player = context.getPlayer();
if (player == null) return false;

if (GTCEu.Mods.isAE2Loaded() && first instanceof IColorableBlockEntity colorable) {
appeng.api.util.AEColor ae2Color = color == null ?
appeng.api.util.AEColor.TRANSPARENT :
appeng.api.util.AEColor.values()[color.ordinal()];

if (colorable.getColor() != ae2Color) {
colorable.recolourBlock(null, ae2Color, player);
if (GTCEu.Mods.isAE2Loaded() && first instanceof IColorableBlockEntity) {
var collected = BreadthFirstBlockSearch.conditionalSearch(
IColorableBlockEntity.class,
(IColorableBlockEntity) first,
first.getLevel(),
be -> ((BlockEntity) be).getBlockPos(),
(parent, child, dir) -> {
if (parent == null) return true;
return parent.getColor() == child.getColor();
},
limit,
limit * 6);

AEColor ae2Color = color == null ?
AEColor.TRANSPARENT :
AEColor.values()[color.ordinal()];

for (IColorableBlockEntity colorable : collected) {
if (colorable.getColor() != ae2Color) {
colorable.recolourBlock(null, ae2Color, player);
}
}
return true;
}
Expand Down
Loading