Skip to content

Commit 29a5777

Browse files
committed
Add a config option to skip copying block configuration data when middle-clicking (#8111)
1 parent 9873384 commit 29a5777

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import mekanism.common.block.interfaces.IHasTileEntity;
1414
import mekanism.common.block.states.BlockStateHelper;
1515
import mekanism.common.block.states.IStateFluidLoggable;
16+
import mekanism.common.config.MekanismConfig;
1617
import mekanism.common.lib.multiblock.MultiblockData;
1718
import mekanism.common.lib.radiation.Meltdown.MeltdownExplosion;
1819
import mekanism.common.lib.security.ISecurityTile;
@@ -85,9 +86,11 @@ protected boolean canBeReplaced(@NotNull BlockState state, @NotNull Fluid fluid)
8586
@Override
8687
public ItemStack getCloneItemStack(@NotNull BlockState state, @NotNull HitResult target, @NotNull LevelReader world, @NotNull BlockPos pos, @NotNull Player player) {
8788
ItemStack stack = super.getCloneItemStack(state, target, world, pos, player);
88-
TileEntityUpdateable tile = WorldUtils.getTileEntity(TileEntityUpdateable.class, world, pos);
89-
if (tile != null) {
90-
stack.applyComponents(tile.collectComponents());
89+
if (MekanismConfig.common.copyBlockData.get()) {
90+
TileEntityUpdateable tile = WorldUtils.getTileEntity(TileEntityUpdateable.class, world, pos);
91+
if (tile != null) {
92+
stack.applyComponents(tile.collectComponents());
93+
}
9194
}
9295
return stack;
9396
}

src/main/java/mekanism/common/config/CommonConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class CommonConfig extends BaseMekanismConfig {
1414
public final CachedEnumValue<EnergyUnit> energyUnit;
1515
public final CachedEnumValue<TemperatureUnit> tempUnit;
1616
public final CachedBooleanValue enableDecayTimers;
17+
public final CachedBooleanValue copyBlockData;
1718
public final CachedBooleanValue holidays;
1819

1920
CommonConfig() {
@@ -25,6 +26,8 @@ public class CommonConfig extends BaseMekanismConfig {
2526
.defineEnum("temperatureUnit", TemperatureUnit.KELVIN));
2627
enableDecayTimers = CachedBooleanValue.wrap(this, builder.comment("Show time to decay radiation when readings are above safe levels. Set to false on the client side to disable MekaSuit Geiger and Dosimeter Unit timers. Set to false on the server side to disable handheld Geiger Counter and Dosimeter timers.")
2728
.define("enableDecayTimers", true));
29+
copyBlockData = CachedBooleanValue.wrap(this, builder.comment("Determines whether machine configuration data is copied when using middle click. If this is set to false no data will be copied and the default instance of the stack will be returned.")
30+
.define("copyBlockData", true));
2831
holidays = CachedBooleanValue.wrap(this, builder.comment("Should holiday greetings and easter eggs play for holidays (ex: Christmas and New Years) on the client. And should robit skins be randomized on the server.")
2932
.define("holidays", true));
3033
builder.pop();

0 commit comments

Comments
 (0)