diff --git a/gradle.properties b/gradle.properties index 48dbcb74..2b89fa29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file +guideapi_version=1.12-2.1.4-57 diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java index 613d8fcc..d3f3ebcc 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagic.java @@ -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 BLOOD_ORBS = null; @@ -95,7 +96,8 @@ public class RegistrarBloodMagic 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") ); } diff --git a/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java b/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java index 2ffb368b..d875c4d3 100644 --- a/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java +++ b/src/main/java/WayofTime/bloodmagic/potion/PotionEventHandlers.java @@ -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 @@ -169,4 +169,11 @@ public class PotionEventHandlers event.setCanceled(true); } } + + @SubscribeEvent + public static void onEntityHurtEvent(LivingDamageEvent event) { + if (event.getSource() == DamageSource.FALL) + if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.FEATHERED)) + event.setCanceled(true); + } } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredEarth.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredEarth.java new file mode 100644 index 00000000..823ceb1b --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualFeatheredEarth.java @@ -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 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 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(); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java index e21ff121..e27f53b4 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java @@ -188,9 +188,10 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS 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); diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java index 9dbc6711..46a7180a 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java @@ -29,6 +29,7 @@ import WayofTime.bloodmagic.network.DemonAuraPacketProcessor; 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; @@ -82,10 +83,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; 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 { @@ -93,6 +91,7 @@ public class GenericHandler { public static Map filledHandMap = new HashMap<>(); private static Map targetTaskMap = new HashMap<>(); private static Map attackTaskMap = new HashMap<>(); + public static Set featherRitualSet; @SubscribeEvent public static void onEntityFall(LivingFallEvent event) { diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index 0fcd5be5..a7aea094 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -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. @@ -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