BloodMagic/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectMovement.java

75 lines
1.9 KiB
Java
Raw Normal View History

package WayofTime.bloodmagic.alchemyArray;
import WayofTime.bloodmagic.iface.IAlchemyArray;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
2017-08-15 21:30:48 -07:00
public class AlchemyArrayEffectMovement extends AlchemyArrayEffect {
public AlchemyArrayEffectMovement(String key) {
super(key);
}
@Override
2017-08-15 21:30:48 -07:00
public boolean update(TileEntity tile, int ticksActive) {
return false;
}
@Override
2017-08-15 21:30:48 -07:00
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) {
double motionY = 0.5;
double speed = 3;
EnumFacing direction = array.getRotation();
entity.motionY = motionY;
entity.fallDistance = 0;
2017-08-15 21:30:48 -07:00
switch (direction) {
case NORTH:
entity.motionX = 0;
entity.motionY = motionY;
entity.motionZ = -speed;
break;
2017-08-15 21:30:48 -07:00
case SOUTH:
entity.motionX = 0;
entity.motionY = motionY;
entity.motionZ = speed;
break;
2017-08-15 21:30:48 -07:00
case WEST:
entity.motionX = -speed;
entity.motionY = motionY;
entity.motionZ = 0;
break;
2017-08-15 21:30:48 -07:00
case EAST:
entity.motionX = speed;
entity.motionY = motionY;
entity.motionZ = 0;
break;
default:
break;
}
}
@Override
2017-08-15 21:30:48 -07:00
public void writeToNBT(NBTTagCompound tag) {
}
@Override
2017-08-15 21:30:48 -07:00
public void readFromNBT(NBTTagCompound tag) {
}
@Override
2017-08-15 21:30:48 -07:00
public AlchemyArrayEffect getNewCopy() {
return new AlchemyArrayEffectMovement(key);
}
}