Skip to content

Commit

Permalink
Allow colour applicator to remove colour from glass/terracotta (#7392)
Browse files Browse the repository at this point in the history
Partly addresses #7366.
  • Loading branch information
62832 committed Sep 17, 2023
1 parent 0dccd8b commit 2bc05c6
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/main/java/appeng/items/tools/powered/ColorApplicatorItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,34 +167,34 @@ public InteractionResult useOn(UseOnContext context) {
return InteractionResult.FAIL;
}

if (!paintBall.isEmpty() && paintBall.getItem() instanceof SnowballItem) {
var be = level.getBlockEntity(pos);
// clean cables.
if (p != null
&& be instanceof IColorableBlockEntity colorableBlockEntity
&& this.getAECurrentPower(is) > POWER_PER_USE
&& colorableBlockEntity.getColor() != AEColor.TRANSPARENT) {
if (colorableBlockEntity.recolourBlock(side, AEColor.TRANSPARENT, p)) {
if (!paintBall.isEmpty()) {
if (paintBall.getItem() instanceof SnowballItem) {
// clean cables.
if (p != null
&& level.getBlockEntity(pos) instanceof IColorableBlockEntity colorableBlockEntity
&& this.getAECurrentPower(is) > POWER_PER_USE
&& colorableBlockEntity.getColor() != AEColor.TRANSPARENT) {
if (colorableBlockEntity.recolourBlock(side, AEColor.TRANSPARENT, p)) {
consumeItem(is, paintBallKey, false);
return InteractionResult.sidedSuccess(level.isClientSide());
}
}

// clean paint balls..
final Block testBlk = level.getBlockState(pos.relative(side)).getBlock();
final BlockEntity painted = level.getBlockEntity(pos.relative(side));
if (this.getAECurrentPower(is) > POWER_PER_USE && testBlk instanceof PaintSplotchesBlock
&& painted instanceof PaintSplotchesBlockEntity) {
consumeItem(is, paintBallKey, false);
((PaintSplotchesBlockEntity) painted).cleanSide(side.getOpposite());
return InteractionResult.sidedSuccess(level.isClientSide());
}
}

// clean paint balls..
final Block testBlk = level.getBlockState(pos.relative(side)).getBlock();
final BlockEntity painted = level.getBlockEntity(pos.relative(side));
if (this.getAECurrentPower(is) > POWER_PER_USE && testBlk instanceof PaintSplotchesBlock
&& painted instanceof PaintSplotchesBlockEntity) {
consumeItem(is, paintBallKey, false);
((PaintSplotchesBlockEntity) painted).cleanSide(side.getOpposite());
return InteractionResult.sidedSuccess(level.isClientSide());
}
} else if (!paintBall.isEmpty()) {
final AEColor color = this.getColorFromItem(paintBall);

if (color != null
&& this.getAECurrentPower(is) > POWER_PER_USE
&& color != AEColor.TRANSPARENT
&& this.recolourBlock(blk, side, level, pos, color, p)) {
consumeItem(is, paintBallKey, false);
return InteractionResult.sidedSuccess(level.isClientSide());
Expand Down

0 comments on commit 2bc05c6

Please sign in to comment.