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

+3
View File
@@ -315,6 +315,9 @@ public class CarpetSettings
)
public static boolean hopperCounters = false;
@Rule( desc = "Allows Budding Amethyst blocks to be moved by pistons", category = FEATURE )
public static boolean movableAmethyst = false;
@Rule( desc = "Guardians turn into Elder Guardian when struck by lightning", category = FEATURE )
public static boolean renewableSponges = false;
@@ -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);
}
}
+1
View File
@@ -89,6 +89,7 @@
"ServerWorld_onePlayerSleepingMixin",
"CoralBlockMixin",
"CoralFeatureMixin",
"BuddingAmethystBlock_getPistonBehaviorMixin",
"FluidBlock_renewableBlackstoneMixin",
"FluidBlock_renewableDeepslateMixin",
"LavaFluid_renewableDeepslateMixin",