Skip to content

Commit d7f3985

Browse files
committed
review comments
1 parent 96059ca commit d7f3985

4 files changed

Lines changed: 8 additions & 20 deletions

File tree

src/main/java/gregtech/api/pipenet/block/BlockPipe.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -656,26 +656,18 @@ private List<IndexedCuboid6> getCollisionBox(IBlockAccess world, BlockPos pos, @
656656

657657
public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, Entity entity) {
658658
if (entity instanceof EntityPlayer) {
659-
return hasPipeCollisionChangingItem(world, pos, ((EntityPlayer) entity).getHeldItem(EnumHand.MAIN_HAND),
660-
entity) ||
661-
hasPipeCollisionChangingItem(world, pos, ((EntityPlayer) entity).getHeldItem(EnumHand.OFF_HAND),
662-
entity) ||
659+
return hasPipeCollisionChangingItem(world, pos, ((EntityPlayer) entity).getHeldItem(EnumHand.MAIN_HAND)) ||
660+
hasPipeCollisionChangingItem(world, pos, ((EntityPlayer) entity).getHeldItem(EnumHand.OFF_HAND)) ||
663661
entity.isSneaking() && isHoldingPipe((EntityPlayer) entity);
664662
}
665663
return false;
666664
}
667665

668666
public abstract boolean isHoldingPipe(EntityPlayer player);
669667

670-
public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, ItemStack stack,
671-
@Nullable Entity entity) {
668+
public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, ItemStack stack) {
672669
if (isPipeTool(stack)) return true;
673670

674-
if (entity != null && entity.isSneaking() && entity instanceof EntityPlayer player &&
675-
(GTUtility.isSprayCan(player.getHeldItem(EnumHand.MAIN_HAND)) ||
676-
GTUtility.isSprayCan(player.getHeldItem(EnumHand.OFF_HAND))))
677-
return true;
678-
679671
IPipeTile<PipeType, NodeDataType> pipeTile = getPipeTileEntity(world, pos);
680672
if (pipeTile == null) return false;
681673

@@ -688,10 +680,6 @@ public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, It
688680
return GTUtility.isCoverBehaviorItem(stack, () -> hasAnyCover, coverDef -> acceptsCovers);
689681
}
690682

691-
public boolean hasPipeCollisionChangingItem(IBlockAccess world, BlockPos pos, ItemStack stack) {
692-
return hasPipeCollisionChangingItem(world, pos, stack, null);
693-
}
694-
695683
@Override
696684
public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) {
697685
return true;

src/main/java/gregtech/common/items/behaviors/ColorSprayBehavior.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ private boolean traversePipes(EntityPlayer player, World world, EnumHand hand, B
140140
if (connectedTe instanceof IPipeTile<?, ?>startPipe) {
141141
List<IPipeTile<?, ?>> pipes = PipeCollectorWalker.collectPipeNet(world, startPos, startPipe,
142142
Math.min(MAX_PIPE_TRAVERSAL_LENGTH, getUsesLeft(heldItem)));
143+
int colour = this.color == null ? -1 : this.color.colorValue;
143144
for (IPipeTile<?, ?> pipe : pipes) {
144-
if (pipe.getPaintingColor() != (this.color == null ? -1 : this.color.colorValue)) {
145-
pipe.setPaintingColor(this.color == null ? -1 : this.color.colorValue);
145+
if (pipe.getPaintingColor() != colour) {
146+
pipe.setPaintingColor(colour);
146147
pipe.scheduleRenderUpdate();
147148
if (getUsesLeft(heldItem) == 1) {
148149
useItemDurability(player, hand, heldItem, empty.copy());

src/main/java/gregtech/common/pipelike/PipeCollectorWalker.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
public class PipeCollectorWalker<T extends IPipeTile<?, ?>> extends PipeNetWalker<T> {
1919

2020
@NotNull
21-
@SuppressWarnings("unchecked")
2221
public static List<IPipeTile<?, ?>> collectPipeNet(World world, BlockPos sourcePipe, IPipeTile<?, ?> pipe,
2322
int limit) {
2423
PipeCollectorWalker<? extends IPipeTile<?, ?>> walker = (PipeCollectorWalker<? extends IPipeTile<?, ?>>) new PipeCollectorWalker<>(
2524
world, sourcePipe, 0, pipe.getClass());
2625
walker.traversePipeNet(limit);
27-
return walker.isFailed() ? Collections.EMPTY_LIST : Collections.unmodifiableList(walker.pipes);
26+
return walker.isFailed() ? Collections.emptyList() : Collections.unmodifiableList(walker.pipes);
2827
}
2928

3029
public static List<IPipeTile<?, ?>> collectPipeNet(World world, BlockPos sourcePipe, IPipeTile<?, ?> pipe) {

src/main/resources/assets/gregtech/lang/en_us.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4701,7 +4701,7 @@ behaviour.paintspray.red.tooltip=Can paint things in Red
47014701
behaviour.paintspray.black.tooltip=Can paint things in Black
47024702
behaviour.paintspray.uses=Remaining Uses: %,d
47034703
behaviour.paintspray.offhand=Hold in offhand to color while placing blocks
4704-
behaviour.paintspray.crouch=Crouch to spray a network of pipes
4704+
behaviour.paintspray.crouch=Crouch to spray connected pipes
47054705
behaviour.prospecting=Usable for Prospecting
47064706

47074707
# Multiblock machine controllers

0 commit comments

Comments
 (0)