movableAmethyst extension
This commit is contained in:
1 parent
a3954d50f4
commit
020dd6a8f4
4 files changed
+54
-20
No files matched your search
@@ -315,7 +315,14 @@ public class CarpetSettings
|
||||
)
|
||||
public static boolean hopperCounters = false;
|
||||
|
||||
@Rule( desc = "Allows Budding Amethyst blocks to be moved by pistons", category = FEATURE )
|
||||
@Rule(
|
||||
desc = "Allows Budding Amethyst blocks to be moved",
|
||||
extra = {
|
||||
"Allow for them to be moved by pistons",
|
||||
"as well as adds extra drop when mining with silk touch pickaxe"
|
||||
},
|
||||
category = FEATURE
|
||||
)
|
||||
public static boolean movableAmethyst = false;
|
||||
|
||||
@Rule( desc = "Guardians turn into Elder Guardian when struck by lightning", category = FEATURE )
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BuddingAmethystBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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_movableAmethystMixin extends Block {
|
||||
public BuddingAmethystBlock_movableAmethystMixin(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
|
||||
super.afterBreak(world, player, pos, state, blockEntity, stack);
|
||||
// doing it here rather than though loottables since loottables are loaded on reload
|
||||
// drawback - not controlled via loottables, but hey
|
||||
if (CarpetSettings.movableAmethyst &&
|
||||
stack.getItem() instanceof PickaxeItem &&
|
||||
EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, stack) > 0
|
||||
)
|
||||
dropStack(world, pos, Items.BUDDING_AMETHYST.getDefaultStack());
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@
|
||||
"ServerWorld_onePlayerSleepingMixin",
|
||||
"CoralBlockMixin",
|
||||
"CoralFeatureMixin",
|
||||
"BuddingAmethystBlock_getPistonBehaviorMixin",
|
||||
"BuddingAmethystBlock_movableAmethystMixin",
|
||||
"FluidBlock_renewableBlackstoneMixin",
|
||||
"FluidBlock_renewableDeepslateMixin",
|
||||
"LavaFluid_renewableDeepslateMixin",
|
||||
|
||||
Reference in new issue
Block a user