Implemented Ritual of Grounding, a Ritual to change gravity behavior (#1501)

*  Implemented Ritual of Grounding, a Ritual to change gravity behavior

[x] <- x are new potion effects
 - (NoMod) moves entities towards the ground, prevents jumping [Grounded]
 - (Raw) affects players
 - (Corrosive) disables gravity [Suspension]
 - (Destructive) increases fall damage [Heavy Heart]
 - (Steadfast) affects bosses
 - (Vengeful) stronger effects, (+Corrosive) applies levitation (+Destructive) stronger effect

 [Grounded] prevents jumping and moves entities towards the ground, higher amplifiers cause a faster descend, interesting interaction with Sigil of Air

 [Suspension] disables gravity (keeps movement)

 [Heavy Heart] increases fall height and fall damage multiplier by 1 per level.

 Fixed a possible division by 0 in RitualConder.
 Saved event entity variable in PotionEventHandlers.
 Made rune configuration more readable in RitualHarvest.

Signed-off-by: tobias <angryaeon@icloud.com>

* Fixed Ritual area

* Lists are cleared on world unload.
This commit is contained in:
Tobias Gremeyer 2019-02-01 01:33:46 +01:00 committed by Nick Ignoffo
parent 865968a4b8
commit 827ee85e81
7 changed files with 335 additions and 95 deletions

View file

@ -59,7 +59,10 @@ 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 final Potion GROUNDED = MobEffects.HASTE;
public static final Potion HEAVY_HEART = MobEffects.HASTE;
public static final Potion SUSPENDED = MobEffects.HASTE;
public static final Potion FEATHERED = MobEffects.HASTE;
public static IForgeRegistry<BloodOrb> BLOOD_ORBS = null;
@ -73,10 +76,10 @@ public class RegistrarBloodMagic
new BloodOrb("magician", 3, 150000, 15).withModel(new ModelResourceLocation(orb, "type=magician")).setRegistryName("magician"),
new BloodOrb("master", 4, 1000000, 25).withModel(new ModelResourceLocation(orb, "type=master")).setRegistryName("master"),
new BloodOrb("archmage", 5, 10000000, 50).withModel(new ModelResourceLocation(orb, "type=archmage")).setRegistryName("archmage")
);
);
if (ConfigHandler.general.enableTierSixEvenThoughThereIsNoContent) {
event.getRegistry().register(
new BloodOrb("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent")
new BloodOrb("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent")
);
}
}
@ -97,8 +100,11 @@ public class RegistrarBloodMagic
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("Grounded", true, 0x000000, 1, 0).setRegistryName("grounded"),
new PotionBloodMagic("Suspended", false, 0x000000, 1, 0).setRegistryName("suspended"),
new PotionBloodMagic("Heavy Heart", true, 0x000000, 1, 0).setRegistryName("heavy_heart"),
new PotionBloodMagic("Feathered", false, 0x000000, 0, 0).setRegistryName("feathered")
);
);
}
@SubscribeEvent
@ -117,7 +123,7 @@ public class RegistrarBloodMagic
EntityEntryBuilder.create().id("corrupted_sheep", ++entities).entity(EntityCorruptedSheep.class).name("corrupted_sheep").tracker(16 * 4, 3, true).build(),
EntityEntryBuilder.create().id("corrupted_chicken", ++entities).entity(EntityCorruptedChicken.class).name("corrupted_chicken").tracker(16 * 4, 3, true).build(),
EntityEntryBuilder.create().id("corrupted_spider", ++entities).entity(EntityCorruptedSpider.class).name("corrupted_spider").tracker(16 * 4, 3, true).build()
);
);
}
@SubscribeEvent

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.handler.event.GenericHandler;
import WayofTime.bloodmagic.util.helper.PlayerHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -15,6 +15,6 @@ public class ItemSigilFilledHand extends ItemSigilToggleableBase {
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
if (PlayerHelper.isFakePlayer(player))
return;
GenericHandler.filledHandMap.put(player, 4);
GenericHandler.filledHandMapMap.get(world).put(player, 4);
}
}

View file

@ -4,6 +4,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@ -11,57 +12,67 @@ import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
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.living.LivingFallEvent;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class PotionEventHandlers
{
public static List<EntityPlayer> flightList = new ArrayList<EntityPlayer>();
public class PotionEventHandlers {
public static Map<World, List<EntityPlayer>> flightListMap = new HashMap<>();
public static Map<World, List<EntityLivingBase>> noGravityListMap = new HashMap<>();
@SubscribeEvent
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
event.getEntityLiving().motionY += (0.1f) * (2 + i);
public static void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
EntityLivingBase eventEntityLiving = event.getEntityLiving();
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.BOOST)) {
int i = eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
eventEntityLiving.motionY += (0.1f) * (2 + i);
}
// if (event.getEntityLiving().isPotionActive(ModPotions.heavyHeart)) {
// event.getEntityLiving().motionY = 0;
// }
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.GROUNDED))
eventEntityLiving.motionY = 0;
}
@SubscribeEvent
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (!player.world.isRemote)
{
if (player.isPotionActive(RegistrarBloodMagic.FLIGHT))
{
if (!player.isSpectator() && !player.capabilities.allowFlying)
{
public static void onLivingFall(LivingFallEvent event) {
EntityLivingBase eventEntityLiving = event.getEntityLiving();
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.HEAVY_HEART)) {
int i = eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.HEAVY_HEART).getAmplifier() + 1;
event.setDamageMultiplier(event.getDamageMultiplier() + i);
event.setDistance(event.getDistance() + i);
}
}
@SubscribeEvent
public static void onEntityUpdate(LivingEvent.LivingUpdateEvent event) {
EntityLivingBase eventEntityLiving = event.getEntityLiving();
List<EntityPlayer> flightList = flightListMap.get(eventEntityLiving.getEntityWorld());
if (eventEntityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) eventEntityLiving;
if (!player.world.isRemote) {
if (player.isPotionActive(RegistrarBloodMagic.FLIGHT)) {
if (!player.isSpectator() && !player.capabilities.allowFlying) {
player.capabilities.allowFlying = true;
player.sendPlayerAbilities();
flightList.add(player);
}
} else
{
if (flightList.contains(player))
{
} else {
if (flightList.contains(player)) {
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
player.sendPlayerAbilities();
@ -70,30 +81,42 @@ public class PotionEventHandlers
}
}
}
// if (event.getEntityLiving().isPotionActive(ModPotions.boost))
// if (eventEntityLiving.isPotionActive(ModPotions.boost))
// {
// int i = event.getEntityLiving().getActivePotionEffect(ModPotions.boost).getAmplifier();
// int i = eventEntityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
// {
// float percentIncrease = (i + 1) * 0.05f;
//
// if (event.getEntityLiving() instanceof EntityPlayer)
// if (eventEntityLiving instanceof EntityPlayer)
// {
// EntityPlayer entityPlayer = (EntityPlayer) event.getEntityLiving();
// EntityPlayer entityPlayer = (EntityPlayer) eventEntityLiving;
//
// if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
// entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
// }
// }
// }
List<EntityLivingBase> noGravityList = noGravityListMap.get(event.getEntityLiving().getEntityWorld());
if ((!(eventEntityLiving instanceof EntityPlayer) || !((EntityPlayer) eventEntityLiving).isSpectator()) && eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED)) {
eventEntityLiving.setNoGravity(true);
noGravityList.add(eventEntityLiving);
} else {
eventEntityLiving.setNoGravity(false);
noGravityList.remove(eventEntityLiving);
}
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND))
{
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.GROUNDED))
if (eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying)
eventEntityLiving.motionY -= (0.05D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
else
eventEntityLiving.motionY -= (0.1D * (double) (eventEntityLiving.getActivePotionEffect(RegistrarBloodMagic.GROUNDED).getAmplifier() + 1) - eventEntityLiving.motionY) * 0.2D;
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.WHIRLWIND)) {
int d0 = 3;
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(event.getEntityLiving().posX - 0.5, event.getEntityLiving().posY - 0.5, event.getEntityLiving().posZ - 0.5, event.getEntityLiving().posX + 0.5, event.getEntityLiving().posY + 0.5, event.getEntityLiving().posZ + 0.5).expand(d0, d0, d0);
List<Entity> entityList = event.getEntityLiving().getEntityWorld().getEntitiesWithinAABB(Entity.class, axisAlignedBB);
AxisAlignedBB axisAlignedBB = new AxisAlignedBB(eventEntityLiving.posX - 0.5, eventEntityLiving.posY - 0.5, eventEntityLiving.posZ - 0.5, eventEntityLiving.posX + 0.5, eventEntityLiving.posY + 0.5, eventEntityLiving.posZ + 0.5).expand(d0, d0, d0);
List<Entity> entityList = eventEntityLiving.getEntityWorld().getEntitiesWithinAABB(Entity.class, axisAlignedBB);
for (Entity projectile : entityList)
{
for (Entity projectile : entityList) {
if (projectile == null)
continue;
if (!(projectile instanceof IProjectile))
@ -106,12 +129,12 @@ public class PotionEventHandlers
else if (projectile instanceof EntityThrowable)
throwingEntity = ((EntityThrowable) projectile).getThrower();
if (throwingEntity != null && throwingEntity.equals(event.getEntityLiving()))
if (throwingEntity != null && throwingEntity.equals(eventEntityLiving))
continue;
double delX = projectile.posX - event.getEntityLiving().posX;
double delY = projectile.posY - event.getEntityLiving().posY;
double delZ = projectile.posZ - event.getEntityLiving().posZ;
double delX = projectile.posX - eventEntityLiving.posX;
double delY = projectile.posY - eventEntityLiving.posY;
double delZ = projectile.posZ - eventEntityLiving.posZ;
double angle = (delX * projectile.motionX + delY * projectile.motionY + delZ * projectile.motionZ) / (Math.sqrt(delX * delX + delY * delY + delZ * delZ) * Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ));
@ -120,8 +143,7 @@ public class PotionEventHandlers
if (angle < 3 * (Math.PI / 4))
continue; // angle is < 135 degrees
if (throwingEntity != null)
{
if (throwingEntity != null) {
delX = -projectile.posX + throwingEntity.posX;
delY = -projectile.posY + (throwingEntity.posY + throwingEntity.getEyeHeight());
delZ = -projectile.posZ + throwingEntity.posZ;
@ -141,31 +163,26 @@ public class PotionEventHandlers
}
@SubscribeEvent
public static void onPlayerRespawn(PlayerEvent.Clone event)
{
public static void onPlayerRespawn(PlayerEvent.Clone event) {
if (event.isWasDeath())
event.getEntityPlayer().addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, 400));
}
@SubscribeEvent
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event)
{
public static void onSacrificeKnifeUsed(SacrificeKnifeUsedEvent event) {
if (event.player.isPotionActive(RegistrarBloodMagic.SOUL_FRAY))
event.lpAdded = (int) (event.lpAdded * 0.1D);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onPlayerDamageEvent(LivingAttackEvent event)
{
public static void onPlayerDamageEvent(LivingAttackEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.WHIRLWIND) && event.isCancelable() && event.getSource().isProjectile())
event.setCanceled(true);
}
@SubscribeEvent
public static void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable())
{
public static void onEndermanTeleportEvent(EnderTeleportEvent event) {
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.PLANAR_BINDING) && event.isCancelable()) {
event.setCanceled(true);
}
}

View file

@ -0,0 +1,199 @@
package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
import java.util.function.Consumer;
@RitualRegister("grounding")
public class RitualGrounding extends Ritual {
public static final int willRefreshTime = 20;
public static final String GROUNDING_RANGE = "groundingRange";
public static final double willDrain = 0.5;
public RitualGrounding() {
super("ritualGrounding", 0, 5000, "ritual." + BloodMagic.MODID + ".groundingRitual");
addBlockRange(GROUNDING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, 0, -10), 21, 30, 21));
setMaximumVolumeAndDistanceOfRange(GROUNDING_RANGE, 0, 200, 200);
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone) {
/* Default Ritual Stuff */
World world = masterRitualStone.getWorldObj();
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
BlockPos pos = masterRitualStone.getBlockPos();
if (currentEssence < getRefreshCost()) {
masterRitualStone.getOwnerNetwork().causeNausea();
return;
}
int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0;
/* Default will augment stuff */
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, pos);
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
double rawDrained = 0;
double corrosiveDrained = 0;
double destructiveDrained = 0;
double steadfastDrained = 0;
double vengefulDrained = 0;
/* Actual ritual stuff begins here */
AreaDescriptor groundingRange = getBlockRange(GROUNDING_RANGE);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, groundingRange.getAABB(pos));
for (EntityLivingBase entity : entities) {
if (totalEffects >= maxEffects) {
break;
}
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).isCreative())
continue;
totalEffects++;
if (entity instanceof EntityPlayer) {
/* Raw will effect: Affects players */
if (world.getTotalWorldTime() % 10 == 0) {
if (rawWill >= willDrain) {
rawDrained += willDrain;
double[] drainagePlayer = sharedWillEffects(world, entity, corrosiveWill, destructiveWill, vengefulWill, corrosiveDrained, destructiveDrained, vengefulDrained);
corrosiveDrained += drainagePlayer[0];
destructiveDrained += drainagePlayer[1];
vengefulDrained += drainagePlayer[2];
}
}
} else if (entity.isNonBoss()) {
if (world.getTotalWorldTime() % 10 == 0) {
double[] drainageEntity = sharedWillEffects(world, entity, corrosiveWill, destructiveWill, vengefulWill, corrosiveDrained, destructiveDrained, vengefulDrained);
corrosiveDrained += drainageEntity[0];
destructiveDrained += drainageEntity[1];
vengefulDrained += drainageEntity[2];
}
} else if (!entity.isNonBoss()) {
/* Steadfast will effect: Affects bosses
(some bosses, like the wither, have a restriction to motion modification,
others, like the Ender Dragon, don't do potions) */
if (steadfastWill >= willDrain) {
if (entity instanceof EntityWither || entity instanceof EntityDragon)
entity.move(MoverType.SELF, 0, -0.05, 0); // to work on Wither and EnderDragon without interfering with other mod author's decisions (looking at you, Vazkii)
steadfastDrained += willDrain / 10f;
double[] drainagePlayer = sharedWillEffects(world, entity, corrosiveWill, destructiveWill, vengefulWill, corrosiveDrained, destructiveDrained, vengefulDrained);
corrosiveDrained += drainagePlayer[0];
destructiveDrained += drainagePlayer[1];
vengefulDrained += drainagePlayer[2];
}
}
}
if (rawDrained > 0)
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrained, true);
if (corrosiveDrained > 0)
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrained, true);
if (destructiveDrained > 0)
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrained, true);
if (steadfastDrained > 0)
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrained, true);
if (vengefulDrained > 0)
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrained, true);
masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost() * totalEffects));
}
@Override
public int getRefreshTime() {
return 1;
}
@Override
public int getRefreshCost() {
return Math.max(1, getBlockRange(GROUNDING_RANGE).getVolume() / 10000);
}
@Override
public void gatherComponents(Consumer<RitualComponent> components) {
addParallelRunes(components, 1, 0, EnumRuneType.DUSK);
addCornerRunes(components, 2, 2, EnumRuneType.EARTH);
addCornerRunes(components, 3, 3, EnumRuneType.EARTH);
}
@Override
public Ritual getNewCopy() {
return new RitualGrounding();
}
public double[] sharedWillEffects(World world, EntityLivingBase entity, double corrosiveWill, double destructiveWill, double vengefulWill, double corrosiveDrained, double destructiveDrained, double vengefulDrained) {
/* Combination of corrosive + vengeful will: Levitation */
if (corrosiveWill >= willDrain && vengefulWill >= willDrain) {
entity.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 20, 10));
vengefulDrained += willDrain;
corrosiveDrained += willDrain;
/* Corrosive will effect: Suspension */
} else if (corrosiveWill >= willDrain) {
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SUSPENDED, 20, 0));
corrosiveDrained += willDrain;
/* Vengeful will effect: Stronger effect */
} else if (vengefulWill >= willDrain) {
vengefulDrained += willDrain;
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.GROUNDED, 40, 20));
} else
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.GROUNDED, 20, 10));
/* Destructive will effect: Increased fall damage */
if (destructiveWill >= willDrain) {
destructiveDrained += willDrain;
/* Combination of destructive + vengeful will: stronger destructive effect */
if (vengefulWill >= willDrain + vengefulDrained) {
if (world.getTotalWorldTime() % 100 == 0) {
vengefulDrained += willDrain;
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.HEAVY_HEART, 200, 2));
}
} else if (world.getTotalWorldTime() % 50 == 0)
entity.addPotionEffect(new PotionEffect(RegistrarBloodMagic.HEAVY_HEART, 100, 1));
}
return new double[]{corrosiveDrained, destructiveDrained, vengefulDrained};
}
}

View file

@ -2,8 +2,8 @@ package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.ritual.harvest.IHarvestHandler;
import WayofTime.bloodmagic.ritual.harvest.HarvestRegistry;
import WayofTime.bloodmagic.ritual.harvest.IHarvestHandler;
import com.google.common.collect.Lists;
import net.minecraft.block.state.IBlockState;
import net.minecraft.inventory.InventoryHelper;
@ -77,30 +77,10 @@ public class RitualHarvest extends Ritual {
@Override
public void gatherComponents(Consumer<RitualComponent> components) {
components.accept(new RitualComponent(new BlockPos(1, 0, 1), EnumRuneType.DUSK));
components.accept(new RitualComponent(new BlockPos(1, 0, -1), EnumRuneType.DUSK));
components.accept(new RitualComponent(new BlockPos(-1, 0, -1), EnumRuneType.DUSK));
components.accept(new RitualComponent(new BlockPos(-1, 0, 1), EnumRuneType.DUSK));
components.accept(new RitualComponent(new BlockPos(2, 0, 0), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(-2, 0, 0), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(0, 0, 2), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(0, 0, -2), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(3, 0, 1), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(3, 0, -1), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(-3, 0, 1), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(-3, 0, -1), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(1, 0, 3), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(-1, 0, 3), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(1, 0, -3), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(-1, 0, -3), EnumRuneType.EARTH));
components.accept(new RitualComponent(new BlockPos(2, 0, 3), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(3, 0, 2), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(2, 0, -3), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(-3, 0, 2), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(-2, 0, 3), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(3, 0, -2), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(-2, 0, -3), EnumRuneType.WATER));
components.accept(new RitualComponent(new BlockPos(-3, 0, -2), EnumRuneType.WATER));
addCornerRunes(components, 1, 0, EnumRuneType.DUSK);
addParallelRunes(components, 2, 0, EnumRuneType.EARTH);
addOffsetRunes(components, 3, 1, 0, EnumRuneType.EARTH);
addOffsetRunes(components, 3, 2, 0, EnumRuneType.WATER);
}
@Override

View file

@ -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.potion.PotionEventHandlers;
import WayofTime.bloodmagic.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.ritual.RitualManager;
import WayofTime.bloodmagic.soul.DemonWillHolder;
@ -76,6 +77,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -87,10 +89,10 @@ 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 Map<World, Map<EntityPlayer, Double>> bounceMapMap = new HashMap<>();
public static Map<World, Map<EntityPlayer, Integer>> filledHandMapMap = new HashMap<>();
private static Map<World, Map<EntityAnimal, EntityAITarget>> targetTaskMapMap = new HashMap<>();
private static Map<World, Map<EntityAnimal, EntityAIBase>> attackTaskMapMap = new HashMap<>();
public static Set<IMasterRitualStone> featherRitualSet;
@SubscribeEvent
@ -103,7 +105,7 @@ public class GenericHandler {
if (player.getEntityWorld().isRemote) {
player.motionY *= -0.9;
player.fallDistance = 0;
bounceMap.put(player, player.motionY);
bounceMapMap.get(player.getEntityWorld()).put(player, player.motionY);
} else {
player.fallDistance = 0;
event.setCanceled(true);
@ -114,10 +116,13 @@ public class GenericHandler {
@SubscribeEvent
public static void playerTickPost(TickEvent.PlayerTickEvent event) {
World world = event.player.getEntityWorld();
Map<EntityPlayer, Double> bounceMap = bounceMapMap.get(world);
if (event.phase == TickEvent.Phase.END && bounceMap.containsKey(event.player)) {
event.player.motionY = bounceMap.remove(event.player);
}
Map<EntityPlayer, Integer> filledHandMap = filledHandMapMap.get(world);
if (event.phase == TickEvent.Phase.END) {
if (filledHandMap.containsKey(event.player)) {
int value = filledHandMap.get(event.player) - 1;
@ -217,6 +222,9 @@ public class GenericHandler {
sendPlayerDemonWillAura((EntityPlayer) entity);
}
World world = entity.getEntityWorld();
Map<EntityAnimal, EntityAITarget> targetTaskMap = targetTaskMapMap.get(world);
Map<EntityAnimal, EntityAIBase> attackTaskMap = attackTaskMapMap.get(world);
if (event.getEntityLiving() instanceof EntityAnimal) {
EntityAnimal animal = (EntityAnimal) event.getEntityLiving();
if (animal.isPotionActive(RegistrarBloodMagic.SACRIFICIAL_LAMB)) {
@ -449,4 +457,26 @@ public class GenericHandler {
private static int durabilityToXp(int durability) {
return durability / 2;
}
@SubscribeEvent
public static void onWorldLoad(WorldEvent.Load event) {
World world = event.getWorld();
bounceMapMap.computeIfAbsent(world, k -> new HashMap<>());
filledHandMapMap.computeIfAbsent(world, k -> new HashMap<>());
attackTaskMapMap.computeIfAbsent(world, k -> new HashMap<>());
targetTaskMapMap.computeIfAbsent(world, k -> new HashMap<>());
PotionEventHandlers.flightListMap.computeIfAbsent(world, k -> new ArrayList<>());
PotionEventHandlers.noGravityListMap.computeIfAbsent(world, k -> new ArrayList<>());
}
@SubscribeEvent
public static void onWorldUnload(WorldEvent.Unload event) {
World world = event.getWorld();
bounceMapMap.get(world).clear();
filledHandMapMap.get(world).clear();
attackTaskMapMap.get(world).clear();
targetTaskMapMap.get(world).clear();
PotionEventHandlers.flightListMap.get(world).clear();
PotionEventHandlers.noGravityListMap.get(world).clear();
}
}

View file

@ -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.groundingRitual=Ritual of Grounding
ritual.bloodmagic.featheredEarthRitual=Ritual of the Feathered Earth
ritual.bloodmagic.waterRitual.info=Generates a source of water from the master ritual stone.
@ -667,6 +668,14 @@ ritual.bloodmagic.animalGrowthRitual.steadfast.info=(Steadfast) Automatically br
ritual.bloodmagic.animalGrowthRitual.default.info=(Raw) Increases the speed of the ritual based on the total Will in the Aura.
ritual.bloodmagic.animalGrowthRitual.destructive.info=(Destructive) Causes adults that have not bred lately to run at mobs and explode.
ritual.bloodmagic.animalGrowthRitual.corrosive.info=(Corrosive) Unimplemented.
ritual.bloodmagic.groundingRitual.info=Forces entities on the ground and prevents jumping.
ritual.bloodmagic.groundingRitual.default.info=(Raw) Affects players.
ritual.bloodmagic.groundingRitual.corrosive.info=(Corrosive) Disables gravity (+Vengeful) Applies Levitation.
ritual.bloodmagic.groundingRitual.destructive.info=(Destructive) Applies Heavy Heart (increases fall damage) (+Vengeful) Stronger effect.
ritual.bloodmagic.groundingRitual.steadfast.info=(Steadfast) Affects Bosses. Doesn't affect bosses that are immune against motion change or immune against potions (except Wither and Ender Dragon).
ritual.bloodmagic.groundingRitual.vengeful.info=(Vengeful) Makes effects stronger. (+Corrosive) Applies Levitation. (+Destructive) Higher Heavy Heart amplifier.
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.
ritual.bloodmagic.crystalSplitRitual.info=Splits apart a well-grown Raw crystal cluster into seperal aspected crystal clusters.
ritual.bloodmagic.fullStomachRitual.info=Takes food from the linked chest and fills the player's saturation with it.
@ -713,7 +722,7 @@ ritual.bloodmagic.fullStomachRitual.fillRange.info=(Feeding) The range that the
ritual.bloodmagic.fullStomachRitual.chest.info=(Chest) The location of the inventory that the ritual will grab food from to feed players in range.
ritual.bloodmagic.interdictionRitual.interdictionRange.info=(Push) The area of the ritual where mobs will be pushed. All mobs are pushed away from the master ritual stone, regardless of where this area is.
ritual.bloodmagic.containmentRitual.containmentRange.info=(Containment) The area of the ritual where mobs will be pulled. All mobs are pulled towards the master ritual stone, regardless of where this area is.
ritual.bloodmagic.speedRitual.sanicRange.info=(Speed) All entities within this area are launched in the direction of the arrow formed by the ritual.
ritual.bloodmagic.speedRitual.sanicRange.info=(Speed) All entities within this area are launched in the direction of the arrow formed by the ritual.
ritual.bloodmagic.suppressionRitual.suppressionRange.info=(Suppress) All liquids within the range are suppressed.
ritual.bloodmagic.expulsionRitual.expulsionRange.info=(Expulsion) The area from which players that are not owner or have an orb in the chest will be teleported away from.
ritual.bloodmagic.zephyrRitual.zephyrRange.info=(Suction) Items within this range will be sucked into the linked chest.
@ -724,11 +733,11 @@ ritual.bloodmagic.forsakenSoulRitual.crystal.info=(Crystal) Demon Crystals in th
ritual.bloodmagic.forsakenSoulRitual.damage.info=(Damage) Mobs within this range will be slowly damaged, and when killed will grow the crystals.
ritual.bloodmagic.crystalHarvestRitual.crystal.info=(Crystal) All Demon Will crystal clusters have a single crystal broken off, spawning the crystal into the world. If there is only one crystal on the cluster, it will not break it.
ritual.bloodmagic.ellipseRitual.info=Creates a hollow spheroid around the ritual using the blocks in the attached chest.
ritual.bloodmagic.ellipseRitual.info=Creates a hollow spheroid around the ritual using the blocks in the attached chest.
ritual.bloodmagic.ellipseRitual.spheroidRange.info=(Placement) The range that the ritual will place its blocks in. Spheroid is centered on the ritual - if one side is shorter than the side opposite the spheroid is truncated.
ritual.bloodmagic.ellipseRitual.chest.info=(Chest) The location of the inventory that the ritual will grab blocks from to place in the world.
ritual.bloodmagic.placerRitual.placerRange.info=(Placement) The range that the ritual will place its blocks in.
ritual.bloodmagic.placerRitual.placerRange.info=(Placement) The range that the ritual will place its blocks in.
ritual.bloodmagic.placerRitual.chest.info=(Chest) The location of the inventory that the ritual will grab blocks from to place in the world.
ritual.bloodmagic.fellingRitual.fellingRange.info=(Cutting) The range that the ritual will search out logs and leaves in order to cut down.
ritual.bloodmagic.fellingRitual.chest.info=(Chest) The location of the inventory that the ritual will place the results into.
@ -756,7 +765,6 @@ 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