-
Notifications
You must be signed in to change notification settings - Fork 2
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
b81bc69
commit d7d1a07
Showing
3 changed files
with
41 additions
and
2 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
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
39 changes: 39 additions & 0 deletions
39
src/main/java/firok/tiths/modifier/armor/ModifierMidasTouch.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,39 @@ | ||
package firok.tiths.modifier.armor; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.inventory.EquipmentSlotType; | ||
import net.minecraft.util.DamageSource; | ||
import slimeknights.tconstruct.TConstruct; | ||
import slimeknights.tconstruct.library.modifiers.impl.TotalArmorLevelModifier; | ||
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability; | ||
import slimeknights.tconstruct.library.tools.context.EquipmentContext; | ||
import slimeknights.tconstruct.library.tools.helper.ModifierUtil; | ||
import slimeknights.tconstruct.library.tools.nbt.IModifierToolStack; | ||
|
||
/** | ||
* 迈达斯之触 | ||
* | ||
* 有几率将物理投射伤害抵消转化为金粒 | ||
*/ | ||
public class ModifierMidasTouch extends TotalArmorLevelModifier | ||
{ | ||
private static final TinkerDataCapability.TinkerDataKey<Integer> LEVELS = TConstruct.createKey("midas_touch"); | ||
public ModifierMidasTouch() | ||
{ | ||
super(0, LEVELS); | ||
} | ||
|
||
@Override | ||
public void onAttacked( | ||
IModifierToolStack tool, int level, | ||
EquipmentContext context, EquipmentSlotType slotType, | ||
DamageSource source, float amount, boolean isDirectDamage | ||
) { | ||
if(source.isMagicDamage() || source.isUnblockable() || source.isFireDamage()) return; | ||
LivingEntity entity = context.getEntity(); | ||
int levelTotal = ModifierUtil.getTotalModifierLevel(entity, LEVELS); | ||
System.out.printf("level %d, total level %d",level,levelTotal); | ||
|
||
// todo 整个挪到isSourceBlocked里面 | ||
} | ||
} |