-
Notifications
You must be signed in to change notification settings - Fork 4
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
ab16477
commit 0a80816
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/infamous/dungeons_libraries/mixin/LivingEntityMixin.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,29 @@ | ||
package com.infamous.dungeons_libraries.mixin; | ||
|
||
import com.infamous.dungeons_libraries.capabilities.minionmaster.Follower; | ||
import com.infamous.dungeons_libraries.capabilities.minionmaster.FollowerLeaderHelper; | ||
import net.minecraft.world.damagesource.DamageSource; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.level.Level; | ||
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.CallbackInfo; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntityMixin extends Entity { | ||
|
||
public LivingEntityMixin(EntityType<?> p_19870_, Level p_19871_) { | ||
super(p_19870_, p_19871_); | ||
} | ||
|
||
@Inject(method = "dropFromLootTable", at = @At("HEAD"), cancellable = true) | ||
private void cancelDropFromLootTableIfSummoned(DamageSource source, boolean hurtByPlayer, CallbackInfo ci){ | ||
Follower cap = FollowerLeaderHelper.getFollowerCapability(this); | ||
if (cap.isSummon()) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
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