Skip to content

Commit

Permalink
Fix NoGhostBlocks in singleplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Avanatiker committed Nov 5, 2022
1 parent 827ef82 commit d6cbd97
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/lambda/mixin/world/MixinItemBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.lambda.client.module.modules.player.NoGhostBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand All @@ -11,9 +12,12 @@

@Mixin(ItemBlock.class)
public class MixinItemBlock {

private final Minecraft mc = Minecraft.getMinecraft();

@Redirect(method = "placeBlockAt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;I)Z"))
private boolean ignoreSetBlockState(World instance, BlockPos p_setBlockState_1_, IBlockState p_setBlockState_2_, int p_setBlockState_3_) {
if (NoGhostBlocks.INSTANCE.isEnabled()) {
if (NoGhostBlocks.INSTANCE.isEnabled() && !mc.isSingleplayer()) {
return true;
} else {
return instance.setBlockState(p_setBlockState_1_, p_setBlockState_2_, p_setBlockState_3_);
Expand Down

0 comments on commit d6cbd97

Please sign in to comment.