-
Notifications
You must be signed in to change notification settings - Fork 19
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
5 changed files
with
105 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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinFireDamage_Entity.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,36 @@ | ||
package jss.bugtorch.mixins.early.minecraft.tweaks.damage; | ||
|
||
import jss.bugtorch.BugTorch; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.DamageSource; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = Entity.class) | ||
public abstract class MixinFireDamage_Entity { | ||
|
||
/** | ||
* @author jss2a98aj | ||
* @reason Makes fire damage scale with max health. | ||
*/ | ||
@Redirect( | ||
method = "onEntityUpdate()V", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/entity/Entity;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z" | ||
) | ||
) | ||
private boolean bugTorch$scalingFireDamage(Entity entity, DamageSource source, float damage) { | ||
return bugTorch$doFireDamage(); | ||
} | ||
|
||
public boolean bugTorch$doFireDamage() { | ||
return attackEntityFrom(DamageSource.onFire, 1.0F); | ||
} | ||
|
||
@Shadow | ||
public abstract boolean attackEntityFrom(DamageSource source, float amount); | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
.../java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinFireDamage_EntityPlayer.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,23 @@ | ||
package jss.bugtorch.mixins.early.minecraft.tweaks.damage; | ||
|
||
import jss.bugtorch.config.BugTorchConfig; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.DamageSource; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(value = EntityPlayer.class) | ||
public abstract class MixinFireDamage_EntityPlayer extends EntityLivingBase { | ||
|
||
public boolean bugTorch$doFireDamage() { | ||
return attackEntityFrom(DamageSource.onFire, | ||
BugTorchConfig.scaledFireDamageMaxHealthMult * getMaxHealth() + BugTorchConfig.scaledFireDamageMaxHealthFlat | ||
); | ||
} | ||
|
||
public MixinFireDamage_EntityPlayer(World world) { | ||
super(world); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/jss/bugtorch/mixins/early/minecraft/tweaks/damage/MixinLavaDamage.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,31 @@ | ||
package jss.bugtorch.mixins.early.minecraft.tweaks.damage; | ||
|
||
import jss.bugtorch.config.BugTorchConfig; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.DamageSource; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(value = EntityPlayer.class) | ||
public abstract class MixinLavaDamage extends EntityLivingBase { | ||
|
||
/** | ||
* @author jss2a98aj | ||
* @reason Makes lava damage scale with max health. | ||
*/ | ||
@Override | ||
protected void setOnFireFromLava() { | ||
if(!isImmuneToFire) { | ||
attackEntityFrom(DamageSource.lava, | ||
BugTorchConfig.scaledLavaDamageMaxHealthMult * getMaxHealth() + BugTorchConfig.scaledLavaDamageMaxHealthFlat | ||
); | ||
setFire(15); | ||
} | ||
} | ||
|
||
public MixinLavaDamage(World world) { | ||
super(world); | ||
} | ||
|
||
} |