Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Ported Ritual of the Feathered Earth to BM2. (WayofTime#1492)
Browse files Browse the repository at this point in the history
* Ported Ritual of the Feathered Earth to BM2.

* Changed maximum area

* Feathered Earth Hurt timer fall damage negation based on Set part1

* Part 2, switched to handling through potions, digging into area descriptor range bug

* Fixed Ritual area

* Update gradle.properties
  • Loading branch information
Tobias Gremeyer authored and TehNut committed Feb 1, 2019
1 parent 6b25caa commit 865968a
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ mappings_version=snapshot_20180201

jei_version=4.8.5.147
waila_version=1.8.23-B38_1.12
guideapi_version=1.12-2.1.4-57
guideapi_version=1.12-2.1.4-57
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class RegistrarBloodMagic
public static final Potion CLING = MobEffects.HASTE;
public static final Potion SACRIFICIAL_LAMB = MobEffects.HASTE;
public static final Potion FLIGHT = MobEffects.HASTE;
public static final Potion FEATHERED = MobEffects.SPEED;

public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null;

Expand Down Expand Up @@ -95,7 +96,8 @@ public static void registerPotions(RegistryEvent.Register<Potion> event)
new PotionBloodMagic("Bounce", false, 0x000000, 1, 1).setRegistryName("bounce"),
new PotionBloodMagic("Cling", false, 0x000000, 2, 1).setRegistryName("cling"),
new PotionBloodMagic("S. Lamb", false, 0x000000, 3, 1).setRegistryName("sacrificial_lamb"),
new PotionBloodMagic("Flight", false, 0x000000, 4, 0).setRegistryName("flight")
new PotionBloodMagic("Flight", false, 0x000000, 4, 0).setRegistryName("flight"),
new PotionBloodMagic("Feathered", false, 0x000000, 0, 0).setRegistryName("feathered")
);
}

Expand Down
23 changes: 15 additions & 8 deletions src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package WayofTime.bloodmagic.potion;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;

import java.util.ArrayList;
import java.util.List;

@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class PotionEventHandlers
Expand Down Expand Up @@ -169,4 +169,11 @@ public static void onEndermanTeleportEvent(EnderTeleportEvent event)
event.setCanceled(true);
}
}

@SubscribeEvent
public static void onEntityHurtEvent(LivingDamageEvent event) {
if (event.getSource() == DamageSource.FALL)
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.FEATHERED))
event.setCanceled(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package WayofTime.bloodmagic.ritual.types;

import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.ritual.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import java.util.List;
import java.util.function.Consumer;

@RitualRegister("feathered_earth")
public class RitualFeatheredEarth extends Ritual {
public static final String FALL_PROTECTION_RANGE = "fallProtRange";

public RitualFeatheredEarth() {
super("ritualFeatheredEarth", 0, 5000, "ritual." + BloodMagic.MODID + ".featheredEarthRitual");
addBlockRange(FALL_PROTECTION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-25, 0, -25), new BlockPos(25, 30, 25)));
setMaximumVolumeAndDistanceOfRange(FALL_PROTECTION_RANGE, 0, 200, 200);
}

@Override
public void performRitual(IMasterRitualStone masterRitualStone) {
World world = masterRitualStone.getWorldObj();

int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
BlockPos pos = masterRitualStone.getBlockPos();
double x = pos.getX();
double y = pos.getY();
double z = pos.getZ();

if (currentEssence < getRefreshCost()) {
masterRitualStone.getOwnerNetwork().causeNausea();
return;
}

int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0;

if (masterRitualStone.getCooldown() > 0) {
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z + 4, false));
world.addWeatherEffect(new EntityLightningBolt(world, x + 4, y + 5, z - 4, false));
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z - 4, false));
world.addWeatherEffect(new EntityLightningBolt(world, x - 4, y + 5, z + 4, false));
masterRitualStone.setCooldown(0);
}

AreaDescriptor fallProtRange = masterRitualStone.getBlockRange(FALL_PROTECTION_RANGE);
AxisAlignedBB fallProtBB = fallProtRange.getAABB(masterRitualStone.getBlockPos());
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, fallProtBB);

for (EntityLivingBase entity : entities) {
if (totalEffects >= maxEffects) {
break;
}
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FEATHERED, 20, 0));
totalEffects++;
}

masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost() * totalEffects));
}

@Override
public int getRefreshTime() {
return 10;
}

@Override
public int getRefreshCost() {
return 5;
}

@Override
public void gatherComponents(Consumer<RitualComponent> components) {
addParallelRunes(components, 1, 0, EnumRuneType.DUSK);
addCornerRunes(components, 2, 0, EnumRuneType.AIR);
addOffsetRunes(components, 1, 3, 0, EnumRuneType.EARTH);
addParallelRunes(components, 3, 0, EnumRuneType.EARTH);
addCornerRunes(components, 4, 4, EnumRuneType.FIRE);
addOffsetRunes(components, 4, 5, 5, EnumRuneType.AIR);
addOffsetRunes(components, 3, 4, 5, EnumRuneType.AIR);
}


@Override
public Ritual getNewCopy() {
return new RitualFeatheredEarth();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ public void performRitual(World world, BlockPos pos) {

if (MinecraftForge.EVENT_BUS.post(event))
return;

if (!checkBlockRanges(ritual.getModableRangeMap()))
addBlockRanges(ritual.getModableRangeMap());

if (!checkBlockRanges(getCurrentRitual().getModableRangeMap()))
addBlockRanges(getCurrentRitual().getModableRangeMap());

getCurrentRitual().performRitual(this);
} else {
stopRitual(Ritual.BreakType.BREAK_STONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.potion.BMPotionUtils;
import WayofTime.bloodmagic.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.ritual.RitualManager;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.util.Constants;
Expand Down Expand Up @@ -82,17 +83,15 @@
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.*;

@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class GenericHandler {
public static Map<EntityPlayer, Double> bounceMap = new HashMap<>();
public static Map<EntityPlayer, Integer> filledHandMap = new HashMap<>();
private static Map<EntityAnimal, EntityAITarget> targetTaskMap = new HashMap<>();
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<>();
public static Set<IMasterRitualStone> featherRitualSet;

@SubscribeEvent
public static void onEntityFall(LivingFallEvent event) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/bloodmagic/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ ritual.bloodmagic.downgradeRitual=Penance of the Leadened Soul
ritual.bloodmagic.crystalSplitRitual=Resonance of the Faceted Crystal
ritual.bloodmagic.condorRitual=Reverence of the Condor
ritual.bloodmagic.eternalSoulRitual=Cry of the Eternal Soul
ritual.bloodmagic.featheredEarthRitual=Ritual of the Feathered Earth

ritual.bloodmagic.waterRitual.info=Generates a source of water from the master ritual stone.
ritual.bloodmagic.lavaRitual.info=Generates a source of lava from the master ritual stone.
Expand Down Expand Up @@ -751,10 +752,11 @@ ritual.bloodmagic.downgradeRitual.dialogue.slowHeal.100=Unlike my comrades, I of
ritual.bloodmagic.downgradeRitual.dialogue.slowHeal.300=Although your wounds may heal, they will do so slowly if you accept my "offering," and the stings of battle will plague you even more.
ritual.bloodmagic.downgradeRitual.dialogue.slowHeal.500=So think carefully before you rush into something that you may regret, since even though your cup may be empty it will be almost impossible to fill once more...

ritual.bloodmagic.featheredEarthRitual.info=Prevents falldamage in an area.
ritual.bloodmagic.condorRitual.info=Provides flight in an area around the ritual.

ritual.bloodmagic.eternalSoulRitual.info=Capable of transferring Life Essence from a Network back into an Altar at a cost.


# Chat
chat.bloodmagic.altarMaker.setTier=Set Tier to: %d
chat.bloodmagic.altarMaker.building=Building a Tier %d Altar
Expand Down

0 comments on commit 865968a

Please sign in to comment.