Skip to content

Commit 40ba329

Browse files
committed
Fix interacting with unformed multiblocks briefly displaying the GUI (#8089)
1 parent d847fa1 commit 40ba329

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

src/main/java/mekanism/common/block/BlockMekanism.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import net.minecraft.core.BlockPos;
2727
import net.minecraft.core.Direction;
2828
import net.minecraft.util.RandomSource;
29-
import net.minecraft.world.InteractionResult;
3029
import net.minecraft.world.ItemInteractionResult;
3130
import net.minecraft.world.entity.LivingEntity;
3231
import net.minecraft.world.entity.player.Player;
@@ -273,13 +272,6 @@ public void animateTick(@NotNull BlockState state, @NotNull Level world, @NotNul
273272
}
274273
}
275274

276-
protected InteractionResult genericClientActivated(BlockEntity blockEntity) {
277-
if (Attribute.has(this, AttributeGui.class)) {
278-
return InteractionResult.SUCCESS;
279-
}
280-
return InteractionResult.PASS;
281-
}
282-
283275
protected ItemInteractionResult genericClientActivated(ItemStack stack, BlockEntity blockEntity) {
284276
if (!Attribute.has(this, AttributeGui.class) && MekanismUtils.canUseAsWrench(stack)) {
285277
if (blockEntity instanceof ITileRadioactive tileRadioactive && tileRadioactive.getRadiationScale() > 0) {

src/main/java/mekanism/common/block/basic/BlockStructuralGlass.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,11 @@ protected ItemInteractionResult useItemOn(@NotNull ItemStack stack, @NotNull Blo
4343
}
4444
return tile.onActivate(player, hand, stack);
4545
}
46+
47+
@NotNull
48+
@Override
49+
protected InteractionResult useWithoutItem(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos, @NotNull Player player, @NotNull BlockHitResult hit) {
50+
//We handle opening the gui via useItemOn
51+
return InteractionResult.PASS;
52+
}
4653
}

src/main/java/mekanism/common/block/prefab/BlockBasicMultiblock.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@ protected ItemInteractionResult useItemOn(@NotNull ItemStack stack, @NotNull Blo
5050
}
5151
return tile.onActivate(player, hand, stack);
5252
}
53+
54+
@NotNull
55+
@Override
56+
protected InteractionResult useWithoutItem(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos, @NotNull Player player, @NotNull BlockHitResult hit) {
57+
//We handle opening the gui via useItemOn
58+
return InteractionResult.PASS;
59+
}
5360
}

src/main/java/mekanism/common/block/prefab/BlockTile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.function.Function;
44
import java.util.function.UnaryOperator;
55
import mekanism.common.block.attribute.Attribute;
6+
import mekanism.common.block.attribute.AttributeGui;
67
import mekanism.common.block.attribute.AttributeParticleFX;
78
import mekanism.common.block.attribute.AttributeParticleFX.Particle;
89
import mekanism.common.block.attribute.Attributes.AttributeRedstoneEmitter;
@@ -68,7 +69,7 @@ protected InteractionResult useWithoutItem(@NotNull BlockState state, @NotNull L
6869
if (tile == null) {
6970
return InteractionResult.PASS;
7071
} else if (world.isClientSide) {
71-
return genericClientActivated(tile);
72+
return Attribute.has(this, AttributeGui.class) ? InteractionResult.SUCCESS : InteractionResult.PASS;
7273
}
7374
return tile.openGui(player);
7475
}

0 commit comments

Comments
 (0)