Files
Purpur/patches/server/0231-Silk-touchable-budding-amethyst.patch
William Blake Galbreath 8fc79317c7 Update Upstream (Paper)
2021-08-28 22:23:37 -05:00

42 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 16 Jul 2021 22:00:17 -0500
Subject: [PATCH] Silk touchable budding amethyst
diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
index 02fc3ede12eadbf72e26e31b1c475c7f5b2ad73a..2288e727929ffb3a3bca138fb02894080d631594 100644
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -53,4 +53,14 @@ public class BuddingAmethystBlock extends AmethystBlock {
public static boolean canClusterGrowAtState(BlockState state) {
return state.isAir() || state.is(Blocks.WATER) && state.getFluidState().getAmount() == 8;
}
+
+ // Purpur start
+ @Override
+ public void playerDestroy(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
+ if (level.purpurConfig.buddingAmethystSilkTouch && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.SILK_TOUCH, stack) > 0) {
+ popResource(level, pos, net.minecraft.world.item.Items.BUDDING_AMETHYST.getDefaultInstance());
+ }
+ super.playerDestroy(level, player, pos, state, blockEntity, stack);
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 3caf11332258b6bbb6cf239b67f5fa58841b90c9..f56155c44c2d2107aaef4f2066a7a5e8ec214417 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -712,6 +712,11 @@ public class PurpurWorldConfig {
}
}
+ public boolean buddingAmethystSilkTouch = false;
+ private void buddingAmethystSettings() {
+ buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);
+ }
+
public double caveVinesGrowthModifier = 0.10D;
public int caveVinesMaxGrowthAge = 25;
private void caveVinesSettings() {