-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d5882a
commit 19083f4
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/com/sammy/malum/mixin/BlockBehaviorMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.sammy.malum.mixin; | ||
|
||
import com.sammy.malum.common.item.curiosities.curios.sets.prospector.CurioProspectorBelt; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Explosion; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.state.BlockBehaviour; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.storage.loot.LootParams; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.function.BiConsumer; | ||
|
||
@Mixin(BlockBehaviour.class) | ||
public class BlockBehaviorMixin { | ||
|
||
@Unique | ||
Explosion malum$explosion; | ||
|
||
@Inject(method = "onExplosionHit", at = @At(value = "HEAD")) | ||
private void malum$getBlockDrops$cacheExplosion(BlockState state, Level level, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> dropConsumer, CallbackInfo ci) { | ||
malum$explosion = explosion; | ||
} | ||
@ModifyArg(method = "onExplosionHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;getDrops(Lnet/minecraft/world/level/storage/loot/LootParams$Builder;)Ljava/util/List;")) | ||
private LootParams.Builder malum$getBlockDrops(LootParams.Builder builder) { | ||
if (malum$explosion == null) { | ||
return builder; | ||
} | ||
return CurioProspectorBelt.applyFortune(malum$explosion.getIndirectSourceEntity(), builder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.