Add Movable Amethyst Rule (#894)

* Add Pushable Amethyst Rule

As discussed in #79 of ilmangos peaceful challenge. He said he'd do it, I figured I could beat him to the punch :)
https://youtu.be/0-fAKpr_J8k?t=1076

* Name change - movableAmethyst

Co-authored-by: hugeblank <hugeblank@gmail.com>
This commit is contained in:
hugeblankandhugeblank authored and GitHub committed 2021-05-31 16:15:16 -03:00
1 parent 38b2e83d05
commit a3954d50f4
3 files changed
+22

No files matched your search

@@ -0,0 +1,18 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.BuddingAmethystBlock;
import net.minecraft.block.piston.PistonBehavior;
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(BuddingAmethystBlock.class)
public class BuddingAmethystBlock_getPistonBehaviorMixin {
@Inject(at = @At("HEAD"), method = "getPistonBehavior(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/piston/PistonBehavior;", cancellable = true)
void getPistonBehavior(BlockState state, CallbackInfoReturnable<PistonBehavior> cir) {
if (CarpetSettings.movableAmethyst) cir.setReturnValue(PistonBehavior.NORMAL);
}
}