mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
* init 1.21.4, and boom! * build change, but weight not work * just work * Build changes, and delete timings * Fix API patches (#406) * Fix API patches * merge --------- Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> * 0006/0129 * 0009/0129 * 0011/0129 * 0018/0129 * 0030/0129 * 0035/0129 * 0043/0129 * 0048/0129 * 0049/0129 * 0057/0129 * 0065/0129 * 0086/0129 (#408) * 0072/0129 * 0080/0129 * Readd patch infos * 0086/0129 * Delete applied patches * 0087/0129 * 0091/0129 * 0097/0129 * 0101/0129 * 102/129 * 0107/0129 * 0112/0129 * 0118/0129 * 0129/0129, 100% patched * fix some * server work * Protocol... (#409) * Jade v7 * Fix changed part for Jade * Formatting imports, add Lms Paster protocol * REI payloads 5/8 * Add REI support, remove unnecessary content in Jade * Rename * Make jade better * Make action work * fix action jar * Fix some protocol * Fix bot action, and entity tickCount * Fix Warden GameEventListener register on load * Fix extra Raider drop * Fix grindstone overstacking * Update Paper, and some doc * Merge * [ci skip] Update Action --------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
38 lines
2.3 KiB
Diff
38 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Tue, 27 Jun 2023 14:07:00 +0800
|
|
Subject: [PATCH] Shave snow layers
|
|
|
|
|
|
diff --git a/net/minecraft/world/item/ShovelItem.java b/net/minecraft/world/item/ShovelItem.java
|
|
index 75bbe901e79d9ba3250ed2426a36c1c3363c19c1..29849cd8f53daf2da0b9973c805d44376984013c 100644
|
|
--- a/net/minecraft/world/item/ShovelItem.java
|
|
+++ b/net/minecraft/world/item/ShovelItem.java
|
|
@@ -44,6 +44,26 @@ public class ShovelItem extends DiggerItem {
|
|
return InteractionResult.PASS;
|
|
} else {
|
|
Player player = context.getPlayer();
|
|
+ // Leaves start - shaveSnowLayers
|
|
+ if (org.leavesmc.leaves.LeavesConfig.modify.shaveSnowLayers && blockState.is(Blocks.SNOW)) {
|
|
+ int layers = blockState.getValue(net.minecraft.world.level.block.SnowLayerBlock.LAYERS);
|
|
+ ItemStack tool = context.getItemInHand();
|
|
+ boolean hasSilkTouch = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(level.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getOrThrow(net.minecraft.world.item.enchantment.Enchantments.SILK_TOUCH), tool) > 0;
|
|
+ BlockState shavedBlockState = layers > 1 ? blockState.setValue(net.minecraft.world.level.block.SnowLayerBlock.LAYERS, layers - 1) : Blocks.AIR.defaultBlockState();
|
|
+
|
|
+ level.setBlock(clickedPos, shavedBlockState, Block.UPDATE_ALL_IMMEDIATE);
|
|
+ level.gameEvent(GameEvent.BLOCK_CHANGE, clickedPos, GameEvent.Context.of(player, shavedBlockState));
|
|
+
|
|
+ Block.popResource(level, clickedPos, new ItemStack(hasSilkTouch ? Items.SNOW : Items.SNOWBALL));
|
|
+ level.playSound(player, clickedPos, SoundEvents.SNOW_BREAK, SoundSource.BLOCKS, 1.0F, 1.0F);
|
|
+
|
|
+ if (player != null) {
|
|
+ tool.hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
|
|
+ }
|
|
+
|
|
+ return InteractionResult.SUCCESS;
|
|
+ }
|
|
+ // Leaves end - shaveSnowLayers
|
|
BlockState blockState1 = FLATTENABLES.get(blockState.getBlock());
|
|
BlockState blockState2 = null;
|
|
Runnable afterAction = null; // Paper
|