-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
7 changed files
with
110 additions
and
9 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
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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/potion/MixinsPotionPoison.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 jss.bugtorch.mixins.early.minecraft.tweaks.potion; | ||
|
||
import jss.bugtorch.config.BugTorchConfig; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.potion.Potion; | ||
import net.minecraft.util.DamageSource; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = Potion.class) | ||
public class MixinsPotionPoison { | ||
|
||
/** | ||
* @author jss2a98aj | ||
* @reason Makes poison effect damage scale with max health. | ||
*/ | ||
@Redirect( | ||
method = "performEffect", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", | ||
ordinal = 0 | ||
) | ||
) | ||
private boolean bugTorch$scalingWitherEffectDamage(EntityLivingBase entity, DamageSource source, float damage) { | ||
return entity.attackEntityFrom(source, | ||
(entity instanceof EntityPlayer) | ||
? Math.min( | ||
BugTorchConfig.scaledPoisonDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledPoisonDamageMaxHealthFlat, | ||
entity.getHealth() - 1f | ||
) | ||
: damage); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/potion/MixinsPotionWither.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,34 @@ | ||
package jss.bugtorch.mixins.early.minecraft.tweaks.potion; | ||
|
||
import jss.bugtorch.config.BugTorchConfig; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.potion.Potion; | ||
import net.minecraft.util.DamageSource; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = Potion.class) | ||
public class MixinsPotionWither { | ||
|
||
/** | ||
* @author jss2a98aj | ||
* @reason Makes wither effect damage scale with max health. | ||
*/ | ||
@Redirect( | ||
method = "performEffect", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/entity/EntityLivingBase;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z", | ||
ordinal = 1 | ||
) | ||
) | ||
private boolean bugTorch$scalingWitherEffectDamage(EntityLivingBase entity, DamageSource source, float damage) { | ||
return entity.attackEntityFrom(source, | ||
(entity instanceof EntityPlayer) | ||
? BugTorchConfig.scaledWitherDamageMaxHealthMult * entity.getMaxHealth() + BugTorchConfig.scaledWitherDamageMaxHealthFlat | ||
: damage); | ||
} | ||
|
||
} |