Skip to content

Commit 8a9d1e6

Browse files
committed
Check against the tag
1 parent 2542aa2 commit 8a9d1e6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/java/mrbysco/constructionstick/basics/StickUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ public static boolean isBlockRemovable(Level level, Player player, BlockPos pos)
250250
public static boolean isBlockReplaceable(Level level, Player player, BlockPos pos) {
251251
if (!isPositionModifiable(level, player, pos)) return false;
252252

253+
if (level.getBlockState(pos).is(ModTags.NON_REPLACABLE)) return false;
254+
253255
if (!player.isCreative()) {
254256
return !(level.getBlockState(pos).getDestroySpeed(level, pos) <= -1) && level.getBlockEntity(pos) == null;
255257
}

src/main/java/mrbysco/constructionstick/stick/action/ActionReplace.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import mrbysco.constructionstick.api.IStickAction;
44
import mrbysco.constructionstick.api.IStickSupplier;
5+
import mrbysco.constructionstick.basics.ModTags;
56
import mrbysco.constructionstick.basics.option.StickOptions;
67
import mrbysco.constructionstick.config.ConstructionConfig;
78
import mrbysco.constructionstick.stick.undo.ISnapshot;
8-
import mrbysco.constructionstick.stick.undo.PlaceSnapshot;
99
import mrbysco.constructionstick.stick.undo.ReplaceSnapshot;
1010
import net.minecraft.core.BlockPos;
1111
import net.minecraft.core.Direction;
@@ -57,8 +57,7 @@ public List<ISnapshot> getSnapshots(Level level, Player player, BlockHitResult b
5757
BlockState candidateBlock = level.getBlockState(currentCandidate);
5858
if (candidateBlock.is(newBlock.getBlock())) continue;
5959

60-
if (options.matchBlocks(targetBlock.getBlock(), candidateBlock.getBlock()) &&
61-
allCandidates.add(currentCandidate)) {
60+
if (!targetBlock.is(ModTags.NON_REPLACABLE)) {
6261
ReplaceSnapshot snapshot = ReplaceSnapshot.get(level, player, currentCandidate, newBlock, blockItem);
6362
if (snapshot == null) continue;
6463
replaceSnapshots.add(snapshot);

0 commit comments

Comments
 (0)