-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
34 changed files
with
1,004 additions
and
47 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
74 changes: 74 additions & 0 deletions
74
src/main/java/com/aizistral/enigmaticlegacy/effects/GrowingBloodlustEffect.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,74 @@ | ||
package com.aizistral.enigmaticlegacy.effects; | ||
|
||
import com.aizistral.enigmaticlegacy.api.generic.SubscribeConfig; | ||
import com.aizistral.omniconfig.Configuration; | ||
import com.aizistral.omniconfig.wrappers.Omniconfig; | ||
import com.aizistral.omniconfig.wrappers.OmniconfigWrapper; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.effect.MobEffect; | ||
import net.minecraft.world.effect.MobEffectCategory; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.world.entity.ai.attributes.Attributes; | ||
|
||
public class GrowingBloodlustEffect extends MobEffect { | ||
public static Omniconfig.DoubleParameter damageBoost = null; | ||
public static Omniconfig.DoubleParameter lifestealBoost = null; | ||
public static Omniconfig.DoubleParameter healthLossLimit = null; | ||
public static Omniconfig.IntParameter healthLossTicks = null; | ||
public static Omniconfig.IntParameter ticksPerLevel = null; | ||
|
||
@SubscribeConfig(receiveClient = true) | ||
public static void onConfig(OmniconfigWrapper builder) { | ||
builder.pushPrefix("GrowingBloodlust"); | ||
|
||
if (builder.config.getSidedType() != Configuration.SidedConfigType.CLIENT) { | ||
damageBoost = builder | ||
.comment("Damage boost granted by the Growing Bloodlust, per level of effect.") | ||
.max(100) | ||
.getDouble("DamageBoost", 0.05); | ||
|
||
lifestealBoost = builder | ||
.comment("Lifesteal granted by the Growing Bloodlust, per level of effect.") | ||
.max(100) | ||
.getDouble("LifestealBoost", 0.025); | ||
|
||
healthLossTicks = builder | ||
.comment("How often the player loses 1 HP at level one of Growing Bloodlust, in ticks.") | ||
.getInt("HealthLossTicks", 160); | ||
|
||
healthLossLimit = builder | ||
.comment("How much health Growing Bloodlust leaves the player with, as a fraction of max health.") | ||
.getDouble("HealthLossLimit", 0.3); | ||
|
||
ticksPerLevel = builder | ||
.comment("How lock the The Voracious Pan needs to be held, in ticks, to increase the strength " | ||
+ "of the Growing Bloodlust effect by one level.") | ||
.getInt("TicksPerLevel", 300); | ||
} | ||
|
||
builder.popPrefix(); | ||
} | ||
|
||
public GrowingBloodlustEffect() { | ||
super(MobEffectCategory.BENEFICIAL, 0xC30018); | ||
this.addAttributeModifier(Attributes.ATTACK_DAMAGE, "d88f6930-fefb-4bf7-a418-f368458355ff", | ||
damageBoost.getValue(), AttributeModifier.Operation.MULTIPLY_TOTAL); | ||
} | ||
|
||
@Override | ||
public void applyEffectTick(LivingEntity living, int amplifier) { | ||
if (living instanceof ServerPlayer player && !player.isCreative() && !player.isSpectator()) { | ||
if ((player.getHealth() / player.getMaxHealth()) > healthLossLimit.getValue()) { | ||
player.setHealth(player.getHealth() - 1); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isDurationEffectTick(int duration, int amplifier) { | ||
int period = healthLossTicks.getValue() / (1 + amplifier); | ||
return duration % period == 0; | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
src/main/java/com/aizistral/enigmaticlegacy/effects/GrowingHungerEffect.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,69 @@ | ||
package com.aizistral.enigmaticlegacy.effects; | ||
|
||
import com.aizistral.enigmaticlegacy.api.generic.SubscribeConfig; | ||
import com.aizistral.omniconfig.Configuration; | ||
import com.aizistral.omniconfig.wrappers.Omniconfig; | ||
import com.aizistral.omniconfig.wrappers.OmniconfigWrapper; | ||
import com.google.common.collect.ImmutableList; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.damagesource.DamageSource; | ||
import net.minecraft.world.damagesource.DamageType; | ||
import net.minecraft.world.damagesource.DamageTypes; | ||
import net.minecraft.world.effect.MobEffect; | ||
import net.minecraft.world.effect.MobEffectCategory; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.ai.attributes.Attribute; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.world.entity.ai.attributes.Attributes; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class GrowingHungerEffect extends MobEffect { | ||
public static Omniconfig.DoubleParameter damageBoost = null; | ||
public static Omniconfig.DoubleParameter exhaustionGain = null; | ||
public static Omniconfig.IntParameter ticksPerLevel = null; | ||
|
||
@SubscribeConfig(receiveClient = true) | ||
public static void onConfig(OmniconfigWrapper builder) { | ||
builder.pushPrefix("GrowingHunger"); | ||
|
||
if (builder.config.getSidedType() != Configuration.SidedConfigType.CLIENT) { | ||
damageBoost = builder | ||
.comment("Damage boost granted by the Growing Hunger, per level of effect.") | ||
.max(100) | ||
.getDouble("DamageBoost", 0.1); | ||
|
||
exhaustionGain = builder | ||
.comment("Exhaustion applied by Growing Hunger every 4 ticks, per level of effect.") | ||
.getDouble("ExhaustionGain", 0.5); | ||
|
||
ticksPerLevel = builder | ||
.comment("How lock the The Voracious Pan needs to be held, in ticks, to increase the strength " | ||
+ "of the Growing Hunger effect by one level.") | ||
.getInt("TicksPerLevel", 300); | ||
} | ||
|
||
builder.popPrefix(); | ||
} | ||
|
||
public GrowingHungerEffect() { | ||
super(MobEffectCategory.BENEFICIAL, 0xBD1BE5); | ||
this.addAttributeModifier(Attributes.ATTACK_DAMAGE, "c281d54f-3277-4e4c-899e-c27f4f697b24", | ||
damageBoost.getValue(), AttributeModifier.Operation.MULTIPLY_TOTAL); | ||
} | ||
|
||
@Override | ||
public void applyEffectTick(LivingEntity living, int amplifier) { | ||
if (living instanceof ServerPlayer player) { | ||
player.causeFoodExhaustion((float) (exhaustionGain.getValue() * (1 + amplifier))); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isDurationEffectTick(int duration, int amplifier) { | ||
return duration % 4 == 0; | ||
} | ||
|
||
} |
Oops, something went wrong.