Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.madcrazydrumma.skyrimcraft.spell;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.util.math.AxisAlignedBB;
- import net.minecraft.util.math.Vec3d;
- import net.minecraft.util.text.TextComponentString;
- import net.minecraft.world.World;
- import java.util.List;
- public class FusRoDah
- {
- public static void cast(EntityPlayer player) {
- player.addChatComponentMessage(new TextComponentString("Fus... Ro Dah!"));
- AxisAlignedBB fanBox = getEffectAABB(player.worldObj, player);
- Vec3d lookVec = player.getLookVec();
- fanEntitiesAABB(player.worldObj, player, fanBox);
- }
- private static void fanEntitiesAABB(World world, EntityPlayer player, AxisAlignedBB fanBox) {
- Vec3d moveVec = player.getLookVec();
- List<Entity> inBox = world.getEntitiesWithinAABBExcludingEntity(player, fanBox);
- float force = 2.0F;
- for (Entity entity : inBox) {
- if (entity.canBePushed() || entity instanceof EntityItem) {
- entity.addVelocity(moveVec.xCoord * force, moveVec.yCoord * force, moveVec.zCoord * force);
- }
- }
- }
- private static AxisAlignedBB getEffectAABB(World world, EntityPlayer player) {
- double range = 3.0D;
- double radius = 2.0D;
- Vec3d srcVec = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
- Vec3d lookVec = player.getLookVec();
- Vec3d destVec = srcVec.addVector(lookVec.xCoord * range, lookVec.yCoord * range, lookVec.zCoord * range);
- AxisAlignedBB crumbleBox = new AxisAlignedBB(destVec.xCoord - radius, destVec.yCoord - radius, destVec.zCoord - radius, destVec.xCoord + radius, destVec.yCoord + radius, destVec.zCoord + radius);
- return crumbleBox;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement