mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
added inexplicable anger
This commit is contained in:
parent
3493a43f17
commit
7ec222996b
4 changed files with 99 additions and 1 deletions
|
@ -32,6 +32,7 @@ public final class ModConfig {
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> cacheRechargeEffect;
|
public ForgeConfigSpec.ConfigValue<Boolean> cacheRechargeEffect;
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> explosionEffect;
|
public ForgeConfigSpec.ConfigValue<Boolean> explosionEffect;
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> breathlessEffect;
|
public ForgeConfigSpec.ConfigValue<Boolean> breathlessEffect;
|
||||||
|
public ForgeConfigSpec.ConfigValue<Boolean> angerEffect;
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> animalEffect;
|
public ForgeConfigSpec.ConfigValue<Boolean> animalEffect;
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> oreEffect;
|
public ForgeConfigSpec.ConfigValue<Boolean> oreEffect;
|
||||||
public ForgeConfigSpec.ConfigValue<Boolean> auraBlooms;
|
public ForgeConfigSpec.ConfigValue<Boolean> auraBlooms;
|
||||||
|
@ -111,6 +112,10 @@ public final class ModConfig {
|
||||||
.comment("If the Aura Imbalance effect of breathlessness if Aura levels are too low should occur")
|
.comment("If the Aura Imbalance effect of breathlessness if Aura levels are too low should occur")
|
||||||
.translation("config." + NaturesAura.MOD_ID + ".breathlessEffect")
|
.translation("config." + NaturesAura.MOD_ID + ".breathlessEffect")
|
||||||
.define("breathlessEffect", true);
|
.define("breathlessEffect", true);
|
||||||
|
this.angerEffect = builder
|
||||||
|
.comment("If the Aura Imbalance effect of passive mobs being angered if Aura levels are too low should occur")
|
||||||
|
.translation("config." + NaturesAura.MOD_ID + ".angerEffect")
|
||||||
|
.define("angerEffect", true);
|
||||||
this.animalEffect = builder
|
this.animalEffect = builder
|
||||||
.comment("If the Aura Imbalance effect of farm animals being affected in positive ways if Aura levels are too high should occur")
|
.comment("If the Aura Imbalance effect of farm animals being affected in positive ways if Aura levels are too high should occur")
|
||||||
.translation("config." + NaturesAura.MOD_ID + ".animalEffect")
|
.translation("config." + NaturesAura.MOD_ID + ".animalEffect")
|
||||||
|
@ -166,7 +171,7 @@ public final class ModConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply() {
|
public void apply() {
|
||||||
if (!this.grassDieEffect.get() && !this.netherDecayEffect.get() && !this.explosionEffect.get() && !this.breathlessEffect.get())
|
if (!this.grassDieEffect.get() && !this.netherDecayEffect.get() && !this.explosionEffect.get() && !this.breathlessEffect.get() && !this.angerEffect.get())
|
||||||
throw new IllegalStateException("Nature's Aura has detected that all negative Aura Imbalance effects are disabled in the config file. This is disallowed behavior. Please enable at least one negative effect.");
|
throw new IllegalStateException("Nature's Aura has detected that all negative Aura Imbalance effects are disabled in the config file. This is disallowed behavior. Please enable at least one negative effect.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package de.ellpeck.naturesaura.chunk.effect;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.ModConfig;
|
||||||
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
|
import net.minecraft.entity.IAngerable;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AngerEffect implements IDrainSpotEffect {
|
||||||
|
|
||||||
|
public static final ResourceLocation NAME = new ResourceLocation(NaturesAura.MOD_ID, "anger");
|
||||||
|
|
||||||
|
private AxisAlignedBB bb;
|
||||||
|
|
||||||
|
private boolean calcValues(World world, BlockPos pos, Integer spot) {
|
||||||
|
if (spot >= 0)
|
||||||
|
return false;
|
||||||
|
int aura = IAuraChunk.getAuraInArea(world, pos, 50);
|
||||||
|
if (aura > 0)
|
||||||
|
return false;
|
||||||
|
int dist = Math.min(Math.abs(aura) / 50000, 75);
|
||||||
|
if (dist < 10)
|
||||||
|
return false;
|
||||||
|
this.bb = new AxisAlignedBB(pos).grow(dist);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||||
|
if (!this.calcValues(player.world, pos, spot))
|
||||||
|
return ActiveType.INACTIVE;
|
||||||
|
if (!this.bb.contains(player.getPositionVec()))
|
||||||
|
return ActiveType.INACTIVE;
|
||||||
|
return ActiveType.ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getDisplayIcon() {
|
||||||
|
return new ItemStack(Items.FIRE_CHARGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||||
|
if (world.getGameTime() % 100 != 0)
|
||||||
|
return;
|
||||||
|
if (!this.calcValues(world, pos, spot))
|
||||||
|
return;
|
||||||
|
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, this.bb);
|
||||||
|
for (LivingEntity entity : entities) {
|
||||||
|
if (!(entity instanceof IAngerable))
|
||||||
|
continue;
|
||||||
|
PlayerEntity player = world.getClosestPlayer(entity, 25);
|
||||||
|
if (player == null)
|
||||||
|
continue;
|
||||||
|
((IAngerable) entity).setAttackTarget(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean appliesHere(Chunk chunk, IAuraChunk auraChunk, IAuraType type) {
|
||||||
|
return ModConfig.instance.angerEffect.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ public final class DrainSpotEffects {
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(OreSpawnEffect.NAME, OreSpawnEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(OreSpawnEffect.NAME, OreSpawnEffect::new);
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(NetherGrassEffect.NAME, NetherGrassEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(NetherGrassEffect.NAME, NetherGrassEffect::new);
|
||||||
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(NetherDecayEffect.NAME, NetherDecayEffect::new);
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(NetherDecayEffect.NAME, NetherDecayEffect::new);
|
||||||
|
NaturesAuraAPI.DRAIN_SPOT_EFFECTS.put(AngerEffect.NAME, AngerEffect::new);
|
||||||
|
|
||||||
NaturesAuraAPI.EFFECT_POWDERS.put(PlantBoostEffect.NAME, 0xc2f442);
|
NaturesAuraAPI.EFFECT_POWDERS.put(PlantBoostEffect.NAME, 0xc2f442);
|
||||||
NaturesAuraAPI.EFFECT_POWDERS.put(CacheRechargeEffect.NAME, 0x1fb0d1);
|
NaturesAuraAPI.EFFECT_POWDERS.put(CacheRechargeEffect.NAME, 0x1fb0d1);
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Inexplicable Anger",
|
||||||
|
"icon": "minecraft:fire_charge",
|
||||||
|
"category": "effects",
|
||||||
|
"advancement": "naturesaura:negative_imbalance",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "When $(aura) levels get low enough in any area of any world, the increasing pressure of the environment makes it harder to contain oneself. Certain monsters, like $(item)Zombified Piglins$(), $(item)Endermen$() and other creatures that would usually only feel bothered when disturbed will instead start to $(thing)get angry$() seemingly completely out of the blue as soon as one comes close enough to them."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in a new issue