Skip to content

Commit

Permalink
Implement the Eldritch Pan
Browse files Browse the repository at this point in the history
  • Loading branch information
Aizistral committed Jul 27, 2024
1 parent 979a233 commit b53dd79
Show file tree
Hide file tree
Showing 34 changed files with 1,004 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ private void onServerStarted(ServerStartedEvent event) {

/**
* Alright boys, it's cleanup time!
* @param event
*/

public void performCleanup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Objects;
import java.util.function.Supplier;

import com.aizistral.enigmaticlegacy.items.EldritchPan;
import com.aizistral.etherium.core.IEtheriumConfig;

import net.minecraft.resources.ResourceLocation;
Expand All @@ -19,8 +20,7 @@
*/

public enum EnigmaticMaterials implements Tier {
FORBIDDENAXE(0, 2000, 6.0F, 3.0F, 16, () -> Ingredient.EMPTY),
ENDERSLAYER(0, 2000, 6.0F, 3.0F, 16, () -> Ingredient.of(Blocks.OBSIDIAN)),
ELDRITCH_PAN(0, 4000, 6.0F, 3.0F, 24, EldritchPan::getRepairMaterial),
FORBIDDEN_AXE(0, 2000, 6.0F, 3.0F, 16, () -> Ingredient.EMPTY),
ENDER_SLAYER(0, 2000, 6.0F, 3.0F, 16, () -> Ingredient.of(Blocks.OBSIDIAN)),
ETHERIUM(5, 3000, 8.0F, 5.0F, 32, () -> getEtheriumConfig().getRepairMaterial()),
Expand Down
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;
}

}
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;
}

}
Loading

0 comments on commit b53dd79

Please sign in to comment.