-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Rule:
movingBlocksDestroyPathFix
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/carpetfixes/mixins/blockFixes/DirtPathBlock_movingBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package carpetfixes.mixins.blockFixes; | ||
|
||
import carpetfixes.CarpetFixesSettings; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.DirtPathBlock; | ||
import net.minecraft.block.FenceGateBlock; | ||
import net.minecraft.block.PistonExtensionBlock; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.WorldView; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(DirtPathBlock.class) | ||
public class DirtPathBlock_movingBlockMixin { | ||
|
||
@Inject(method= "canPlaceAt(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z",at=@At("HEAD"),cancellable = true) | ||
public void canPlaceAt(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { | ||
if (CarpetFixesSettings.movingBlocksDestroyPathFix) { | ||
BlockState blockState = world.getBlockState(pos.up()); | ||
cir.setReturnValue(!blockState.getMaterial().isSolid() || blockState.getBlock() instanceof FenceGateBlock || blockState.getBlock() instanceof PistonExtensionBlock); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters