Skip to content

Commit

Permalink
收割附魔
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing committed Sep 28, 2024
1 parent 5406d6e commit 4f2f2a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantedItemInUse;
import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CropBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void apply(ServerLevel level, int enchantmentLevel, EnchantedItemInUse en
BlockState newState = block.getStateForAge(0);
cropBlock.playerWillDestroy(level, pos, targetBlockState, player);
cropBlock.playerDestroy(level, player, pos, targetBlockState, level.getBlockEntity(currentIterating), tool);
level.setBlockAndUpdate(currentIterating, newState);
level.setBlock(currentIterating, newState, 11);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/dubhe/anvilcraft/mixin/HoeItemMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@Mixin(HoeItem.class)
public class HoeItemMixin {
@Inject(method = "useOn", at = @At("HEAD"))
@Inject(method = "useOn", at = @At("RETURN"))
void onUse(UseOnContext context, CallbackInfoReturnable<InteractionResult> cir) {
if (context.getLevel().isClientSide) return;
ModEnchantmentHelper.onUseOnBlock(
Expand Down

0 comments on commit 4f2f2a6

Please sign in to comment.