diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/ColorSprayBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/ColorSprayBehaviour.java index 97e3470d53b..5568beff413 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/ColorSprayBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/ColorSprayBehaviour.java @@ -44,6 +44,9 @@ import appeng.api.util.AEColor; import appeng.blockentity.networking.CableBusBlockEntity; import com.google.common.collect.ImmutableMap; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllTags; +import com.simibubi.create.foundation.utility.BlockHelper; import it.unimi.dsi.fastutil.ints.IntIntPair; import org.jetbrains.annotations.Nullable; @@ -302,7 +305,6 @@ private static boolean recolorBlockState(Level level, BlockPos pos, DyeColor col return false; } - @SuppressWarnings("RedundantIfStatement") private boolean tryPaintSpecialBlock(Level world, BlockPos pos, Block block) { if (block.defaultBlockState().is(Tags.Blocks.GLASS)) { if (recolorBlockNoState(GLASS_MAP, this.color, world, pos, Blocks.GLASS)) { @@ -344,6 +346,9 @@ private boolean tryPaintSpecialBlock(Level world, BlockPos pos, Block block) { return true; } } + if (GTCEu.Mods.isCreateLoaded() && block.defaultBlockState().is(AllTags.AllBlockTags.WINDMILL_SAILS.tag)) { + return recolorCreateSail(world, pos, color); + } return false; } @@ -405,6 +410,9 @@ private static boolean tryStripBlockColor(Level world, BlockPos pos, Block block recolorBlockNoState(CANDLE_MAP, DyeColor.WHITE, world, pos); return true; } + if (GTCEu.Mods.isCreateLoaded() && block.defaultBlockState().is(AllTags.AllBlockTags.WINDMILL_SAILS.tag)) { + return recolorCreateSail(world, pos, DyeColor.WHITE); + } // General case BlockState state = world.getBlockState(pos); @@ -497,4 +505,17 @@ static boolean ae2CablePredicate(CableBusBlockEntity parent, CableBusBlockEntity parent.getColor() == child.getColor(); } } + + private static boolean recolorCreateSail(Level world, BlockPos pos, @Nullable DyeColor color) { + // logic copied from Create (SailBlock#applyDye). + // skip null color, because we're not shears. + if (color == null) return false; + BlockState oldState = world.getBlockState(pos); + BlockState newState = BlockHelper.copyProperties(oldState, AllBlocks.DYED_SAILS.get(color).getDefaultState()); + if (oldState != newState) { + world.setBlockAndUpdate(pos, newState); + return true; + } + return false; + } }