Fixed AreaDescriptor and edited the Jumping ritual slightly.

This commit is contained in:
WayofTime 2015-12-31 10:05:38 -05:00
parent f56261e766
commit 63da257260
2 changed files with 39 additions and 20 deletions

View file

@ -60,7 +60,7 @@ public class AreaDescriptor
@Override @Override
public AxisAlignedBB getAABB(BlockPos pos) public AxisAlignedBB getAABB(BlockPos pos)
{ {
AxisAlignedBB tempAABB = new AxisAlignedBB(minimumOffset, maximumOffset); AxisAlignedBB tempAABB = new AxisAlignedBB(minimumOffset.getX(), minimumOffset.getY(), minimumOffset.getZ(), maximumOffset.getX() + 1, maximumOffset.getY() + 1, maximumOffset.getZ() + 1);
return tempAABB.offset(pos.getX(), pos.getY(), pos.getZ()); return tempAABB.offset(pos.getX(), pos.getY(), pos.getZ());
} }

View file

@ -1,20 +1,21 @@
package WayofTime.bloodmagic.ritual; package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.BloodMagic; import java.util.ArrayList;
import WayofTime.bloodmagic.api.Constants; import java.util.List;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import java.util.ArrayList; import WayofTime.bloodmagic.api.network.SoulNetwork;
import java.util.List; import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
public class RitualJumping extends Ritual public class RitualJumping extends Ritual
{ {
@ -36,37 +37,49 @@ public class RitualJumping extends Ritual
if (currentEssence < getRefreshCost()) if (currentEssence < getRefreshCost())
return; return;
int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0;
AreaDescriptor jumpRange = getBlockRange(JUMP_RANGE); AreaDescriptor jumpRange = getBlockRange(JUMP_RANGE);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, jumpRange.getAABB(masterRitualStone.getPos())); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, jumpRange.getAABB(masterRitualStone.getPos()));
if (entities != null) if (entities != null)
{ {
for (EntityLivingBase entity : entities) for (EntityLivingBase entity : entities)
{ {
if (entity.isSneaking()) if (totalEffects >= maxEffects)
continue; {
break;
}
double motionY = 1.5; double motionY = 1.5;
if (entity instanceof EntityPlayer && entity instanceof EntityPlayerMP) if (entity instanceof EntityPlayer && entity instanceof EntityPlayerMP)
{ {
((EntityPlayerMP) entity).fallDistance = 0;
if (entity.isSneaking())
continue;
// TODO Packet handlers if needed // TODO Packet handlers if needed
// BloodMagicPacketHandler.INSTANCE.sendTo(); // BloodMagicPacketHandler.INSTANCE.sendTo();
((EntityPlayerMP) entity).motionY = motionY; ((EntityPlayerMP) entity).motionY = motionY;
((EntityPlayerMP) entity).fallDistance = 0; totalEffects++;
} } else
else
{ {
entity.motionY = motionY;
entity.fallDistance = 0; entity.fallDistance = 0;
if (entity.isSneaking())
continue;
entity.motionY = motionY;
totalEffects++;
} }
} }
} }
network.syphon(getRefreshCost() * totalEffects);
} }
@Override @Override
public int getRefreshTime() public int getRefreshTime()
{ {
return 20; return 1;
} }
@Override @Override
@ -85,4 +98,10 @@ public class RitualJumping extends Ritual
return components; return components;
} }
@Override
public Ritual getNewCopy()
{
return new RitualJumping();
}
} }