Skip to content

Commit

Permalink
Fix #4392
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Oct 22, 2023
1 parent 6235e35 commit 9a9850e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public boolean isOriginal(Block block) {
}

public boolean isVariant(Block block) {
return blockVariants.containsKey(block) && !blockVariants.get(block).isEmpty();
return originals.containsKey(block);
}

private VariantMap getVariants(Block block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,22 @@ public InteractionResult useOn(UseOnContext context) {
if (player != null) {
String variant = VariantSelectorModule.getSavedVariant(player);
Block variantBlock = VariantSelectorModule.getVariantOrOriginal(block, variant);

if (variantBlock != null) {
level.removeBlock(pos, false);

BlockPlaceContext bpc = new YungsBetterBlockPlaceContext(context);
BlockState place = variantBlock.getStateForPlacement(bpc);

place = LockRotationModule.fixBlockRotation(place, bpc);

if (place != null && !place.equals(state) && !level.isClientSide) {
level.removeBlock(pos, false);
level.setBlock(pos, place, 1 | 2);
player.swing(context.getHand());

level.playSound(null, pos, place.getSoundType().getPlaceSound(), SoundSource.BLOCKS, 1.0F, 1.0F);
} else {
level.setBlock(pos, state, 0);
}

return InteractionResult.SUCCESS;
Expand All @@ -72,6 +77,7 @@ public YungsBetterBlockPlaceContext(UseOnContext ctx) {
@Override
public BlockPos getClickedPos() {
boolean oldRepl = replaceClicked;

replaceClicked = true;
BlockPos pos = super.getClickedPos();

Expand Down

0 comments on commit 9a9850e

Please sign in to comment.